From: Németh Márton on
Hi,

I have some problem building Liunux kernel 2.6.34-rc3 with the attached .config:

$ make clean bzImage modules
[...]
CC net/socket.o
LD net/802/built-in.o
LD net/can/built-in.o
CC [M] net/can/bcm.o
CC [M] net/can/raw.o
In file included from /mnt/store/nmarci/src/linux-2.6.34-rc3/arch/x86/include/asm/uaccess.h:571,
from include/net/checksum.h:25,
from include/linux/skbuff.h:28,
from include/linux/if_ether.h:124,
from include/linux/netdevice.h:29,
from net/can/raw.c:48:
In function 'copy_from_user',
inlined from 'raw_setsockopt' at net/can/raw.c:447:
/mnt/store/nmarci/src/linux-2.6.34-rc3/arch/x86/include/asm/uaccess_32.h:212: error: call to 'copy_from_user_overflow' declared with attribute error:
copy_from_user() buffer size is not provably correct
make[2]: *** [net/can/raw.o] Error 1
make[1]: *** [net/can] Error 2
make: *** [net] Error 2


When I disable CAN driver like this, the compile works:

--- .config.orig 2010-04-10 09:18:40.000000000 +0200
+++ .config 2010-04-10 09:19:05.000000000 +0200
@@ -705,23 +705,7 @@
# CONFIG_NET_PKTGEN is not set
# CONFIG_NET_TCPPROBE is not set
# CONFIG_HAMRADIO is not set
-CONFIG_CAN=m
-CONFIG_CAN_RAW=m
-CONFIG_CAN_BCM=m
-
-#
-# CAN Device Drivers
-#
-CONFIG_CAN_VCAN=m
-CONFIG_CAN_DEV=m
-# CONFIG_CAN_CALC_BITTIMING is not set
-# CONFIG_CAN_SJA1000 is not set
-
-#
-# CAN USB interfaces
-#
-# CONFIG_CAN_EMS_USB is not set
-# CONFIG_CAN_DEBUG_DEVICES is not set
+# CONFIG_CAN is not set
# CONFIG_IRDA is not set
# CONFIG_BT is not set
# CONFIG_AF_RXRPC is not set

Regards,

Márton Németh
From: Eric Dumazet on
Le samedi 10 avril 2010 à 10:13 +0200, Németh Márton a écrit :
> Hi,
>
> I have some problem building Liunux kernel 2.6.34-rc3 with the attached .config:
>
> $ make clean bzImage modules
> [...]
> CC net/socket.o
> LD net/802/built-in.o
> LD net/can/built-in.o
> CC [M] net/can/bcm.o
> CC [M] net/can/raw.o
> In file included from /mnt/store/nmarci/src/linux-2.6.34-rc3/arch/x86/include/asm/uaccess.h:571,
> from include/net/checksum.h:25,
> from include/linux/skbuff.h:28,
> from include/linux/if_ether.h:124,
> from include/linux/netdevice.h:29,
> from net/can/raw.c:48:
> In function 'copy_from_user',
> inlined from 'raw_setsockopt' at net/can/raw.c:447:
> /mnt/store/nmarci/src/linux-2.6.34-rc3/arch/x86/include/asm/uaccess_32.h:212: error: call to 'copy_from_user_overflow' declared with attribute error:
> copy_from_user() buffer size is not provably correct
> make[2]: *** [net/can/raw.o] Error 1
> make[1]: *** [net/can] Error 2
> make: *** [net] Error 2
>
>

Could you give us your compiler version ?

Code is fine, but compiler a bit dumb :(

[PATCH] can: avoids a false warning

At this point optlen == sizeof(sfilter) but some compilers are dumb.

Reported-by: Németh Márton <nm127(a)freemail.h
Signed-off-by: Eric Dumazet <eric.dumazet(a)gmail.com>
---
diff --git a/net/can/raw.c b/net/can/raw.c
index 3a7dffb..da99cf1 100644
--- a/net/can/raw.c
+++ b/net/can/raw.c
@@ -445,7 +445,7 @@ static int raw_setsockopt(struct socket *sock, int level, int optname,
return -EFAULT;
}
} else if (count == 1) {
- if (copy_from_user(&sfilter, optval, optlen))
+ if (copy_from_user(&sfilter, optval, sizeof(sfilter)))
return -EFAULT;
}



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Németh Márton on
Eric Dumazet írta:
> Le samedi 10 avril 2010 à 10:13 +0200, Németh Márton a écrit :
>> Hi,
>>
>> I have some problem building Liunux kernel 2.6.34-rc3 with the attached .config:
>>
>> $ make clean bzImage modules
>> [...]
>> CC net/socket.o
>> LD net/802/built-in.o
>> LD net/can/built-in.o
>> CC [M] net/can/bcm.o
>> CC [M] net/can/raw.o
>> In file included from /mnt/store/nmarci/src/linux-2.6.34-rc3/arch/x86/include/asm/uaccess.h:571,
>> from include/net/checksum.h:25,
>> from include/linux/skbuff.h:28,
>> from include/linux/if_ether.h:124,
>> from include/linux/netdevice.h:29,
>> from net/can/raw.c:48:
>> In function 'copy_from_user',
>> inlined from 'raw_setsockopt' at net/can/raw.c:447:
>> /mnt/store/nmarci/src/linux-2.6.34-rc3/arch/x86/include/asm/uaccess_32.h:212: error: call to 'copy_from_user_overflow' declared with attribute error:
>> copy_from_user() buffer size is not provably correct
>> make[2]: *** [net/can/raw.o] Error 1
>> make[1]: *** [net/can] Error 2
>> make: *** [net] Error 2
>>
>>
>
> Could you give us your compiler version ?

$ gcc --version
gcc (Debian 4.4.2-9) 4.4.3 20100108 (prerelease)
Copyright (C) 2009 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

> Code is fine, but compiler a bit dumb :(
>
> [PATCH] can: avoids a false warning
>
> At this point optlen == sizeof(sfilter) but some compilers are dumb.
>
> Reported-by: Németh Márton <nm127(a)freemail.h
> Signed-off-by: Eric Dumazet <eric.dumazet(a)gmail.com>
> ---
> diff --git a/net/can/raw.c b/net/can/raw.c
> index 3a7dffb..da99cf1 100644
> --- a/net/can/raw.c
> +++ b/net/can/raw.c
> @@ -445,7 +445,7 @@ static int raw_setsockopt(struct socket *sock, int level, int optname,
> return -EFAULT;
> }
> } else if (count == 1) {
> - if (copy_from_user(&sfilter, optval, optlen))
> + if (copy_from_user(&sfilter, optval, sizeof(sfilter)))
> return -EFAULT;
> }
>
>
>
>
>

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Oliver Hartkopp on
Németh Márton wrote:
> Eric Dumazet írta:
>> Le samedi 10 avril 2010 à 10:13 +0200, Németh Márton a écrit :
>>> Hi,
>>>
>>> I have some problem building Liunux kernel 2.6.34-rc3 with the attached .config:
>>>
>>> $ make clean bzImage modules
>>> [...]
>>> CC net/socket.o
>>> LD net/802/built-in.o
>>> LD net/can/built-in.o
>>> CC [M] net/can/bcm.o
>>> CC [M] net/can/raw.o
>>> In file included from /mnt/store/nmarci/src/linux-2.6.34-rc3/arch/x86/include/asm/uaccess.h:571,
>>> from include/net/checksum.h:25,
>>> from include/linux/skbuff.h:28,
>>> from include/linux/if_ether.h:124,
>>> from include/linux/netdevice.h:29,
>>> from net/can/raw.c:48:
>>> In function 'copy_from_user',
>>> inlined from 'raw_setsockopt' at net/can/raw.c:447:
>>> /mnt/store/nmarci/src/linux-2.6.34-rc3/arch/x86/include/asm/uaccess_32.h:212: error: call to 'copy_from_user_overflow' declared with attribute error:
>>> copy_from_user() buffer size is not provably correct
>>> make[2]: *** [net/can/raw.o] Error 1
>>> make[1]: *** [net/can] Error 2
>>> make: *** [net] Error 2
>>>
>>>
>> Could you give us your compiler version ?
>
> $ gcc --version
> gcc (Debian 4.4.2-9) 4.4.3 20100108 (prerelease)
> Copyright (C) 2009 Free Software Foundation, Inc.
> This is free software; see the source for copying conditions. There is NO
> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
>
>> Code is fine, but compiler a bit dumb :(
>>
>> [PATCH] can: avoids a false warning
>>
>> At this point optlen == sizeof(sfilter) but some compilers are dumb.
>>
>> Reported-by: Németh Márton <nm127(a)freemail.h
>> Signed-off-by: Eric Dumazet <eric.dumazet(a)gmail.com>

Acked-by: Oliver Hartkopp <oliver(a)hartkopp.net>

Btw. i'm using the same compiler here (Debian Squeeze), and i did not have any
build problems with 2.6.24-rc3 and the following kernels like the currently
running 2.6.34-rc3-00288-gab195c5:

$ cat /proc/version
Linux version 2.6.34-rc3-00288-gab195c5 (hartko(a)vwagwolkf320) (gcc version
4.4.3 20100108 (prerelease) (Debian 4.4.2-9) ) #70 SMP Tue Apr 6 19:14:52 CEST
2010

So i wonder why Nemeth trapped into this problem ... probably an include file
mix-up?

Regards,
Oliver


>> ---
>> diff --git a/net/can/raw.c b/net/can/raw.c
>> index 3a7dffb..da99cf1 100644
>> --- a/net/can/raw.c
>> +++ b/net/can/raw.c
>> @@ -445,7 +445,7 @@ static int raw_setsockopt(struct socket *sock, int level, int optname,
>> return -EFAULT;
>> }
>> } else if (count == 1) {
>> - if (copy_from_user(&sfilter, optval, optlen))
>> + if (copy_from_user(&sfilter, optval, sizeof(sfilter)))
>> return -EFAULT;
>> }
>>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: David Miller on
From: Eric Dumazet <eric.dumazet(a)gmail.com>
Date: Sat, 10 Apr 2010 11:47:31 +0200

> Could you give us your compiler version ?
>
> Code is fine, but compiler a bit dumb :(

Build failures happen all over the kernel with that
USER_COPY_CHECK config option enabled, it's not really
a bug report and I've even told people like Stephen
Rothwell to do their allmodconfig builds on platforms
like sparc64 with this option hard disabled.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/