Re: [INFO] ratio of const vs dynamic usercopy

From: kbuild test robot
Date: Tue Sep 20 2016 - 01:50:03 EST


Hi Kees,

[auto build test WARNING on linus/master]
[also build test WARNING on v4.8-rc7 next-20160919]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
[Suggest to use git(>=2.9.0) format-patch --base=<commit> (or --base=auto for convenience) to record what (public, well-known) commit your patch series was built on]
[Check https://git-scm.com/docs/git-format-patch for more information]

url: https://github.com/0day-ci/linux/commits/Kees-Cook/ratio-of-const-vs-dynamic-usercopy/20160920-130133
config: i386-randconfig-s0-09191616 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
# save the attached .config to linux build tree
make ARCH=i386

All warnings (new ones prefixed by >>):

In file included from arch/x86/include/asm/preempt.h:6:0,
from include/linux/preempt.h:59,
from include/linux/spinlock.h:50,
from include/linux/mm_types.h:8,
from include/linux/kmemcheck.h:4,
from include/linux/skbuff.h:18,
from include/linux/if_arp.h:26,
from net/ipx/af_ipx.c:33:
In function 'check_object_size',
inlined from 'copy_to_user' at arch/x86/include/asm/uaccess.h:742:3,
inlined from 'ipx_getsockopt' at net/ipx/af_ipx.c:1316:2:
>> include/linux/thread_info.h:129:3: warning: call to '__check_object_size' declared with attribute warning: dynamic usercopy
__check_object_size(ptr, n, to_user);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function 'check_object_size',
inlined from 'copy_from_user' at arch/x86/include/asm/uaccess.h:722:3,
inlined from 'ipxitf_ioctl' at net/ipx/af_ipx.c:1129:3,
inlined from 'ipx_ioctl' at net/ipx/af_ipx.c:1872:6:
>> include/linux/thread_info.h:131:3: warning: call to '__skip_check_object_size' declared with attribute warning: builtin-const usercopy
__skip_check_object_size();
^~~~~~~~~~~~~~~~~~~~~~~~~~
In function 'check_object_size',
inlined from 'copy_from_user' at arch/x86/include/asm/uaccess.h:722:3,
inlined from 'ipxitf_ioctl' at net/ipx/af_ipx.c:1154:3,
inlined from 'ipx_ioctl' at net/ipx/af_ipx.c:1872:6:
>> include/linux/thread_info.h:131:3: warning: call to '__skip_check_object_size' declared with attribute warning: builtin-const usercopy
__skip_check_object_size();
^~~~~~~~~~~~~~~~~~~~~~~~~~
In function 'check_object_size',
inlined from 'copy_to_user' at arch/x86/include/asm/uaccess.h:742:3,
inlined from 'ipxitf_ioctl' at net/ipx/af_ipx.c:1172:3,
inlined from 'ipx_ioctl' at net/ipx/af_ipx.c:1872:6:
>> include/linux/thread_info.h:131:3: warning: call to '__skip_check_object_size' declared with attribute warning: builtin-const usercopy
__skip_check_object_size();
^~~~~~~~~~~~~~~~~~~~~~~~~~
In function 'check_object_size',
inlined from 'copy_to_user' at arch/x86/include/asm/uaccess.h:742:3,
inlined from 'ipxcfg_get_config_data' at net/ipx/af_ipx.c:105:9,
inlined from 'ipx_ioctl' at net/ipx/af_ipx.c:1875:6:
>> include/linux/thread_info.h:131:3: warning: call to '__skip_check_object_size' declared with attribute warning: builtin-const usercopy
__skip_check_object_size();
^~~~~~~~~~~~~~~~~~~~~~~~~~
--
In file included from arch/x86/include/asm/preempt.h:6:0,
from include/linux/preempt.h:59,
from include/linux/spinlock.h:50,
from include/linux/mmzone.h:7,
from include/linux/gfp.h:5,
from include/linux/slab.h:14,
from net/ipx/ipx_route.c:12:
In function 'check_object_size',
inlined from 'copy_from_user' at arch/x86/include/asm/uaccess.h:722:3,
inlined from 'ipxrtr_ioctl' at net/ipx/ipx_route.c:264:2:
>> include/linux/thread_info.h:131:3: warning: call to '__skip_check_object_size' declared with attribute warning: builtin-const usercopy
__skip_check_object_size();
^~~~~~~~~~~~~~~~~~~~~~~~~~
--
In file included from arch/x86/include/asm/preempt.h:6:0,
from include/linux/preempt.h:59,
from include/linux/spinlock.h:50,
from include/linux/seqlock.h:35,
from include/linux/time.h:5,
from include/uapi/linux/timex.h:56,
from include/linux/timex.h:56,
from include/linux/sched.h:19,
from include/linux/uaccess.h:4,
from security/keys/encrypted-keys/encrypted.c:17:
In function 'check_object_size',
inlined from 'copy_to_user' at arch/x86/include/asm/uaccess.h:742:3,
inlined from 'encrypted_read' at security/keys/encrypted-keys/encrypted.c:961:2:
>> include/linux/thread_info.h:129:3: warning: call to '__check_object_size' declared with attribute warning: dynamic usercopy
__check_object_size(ptr, n, to_user);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

vim +/__check_object_size +129 include/linux/thread_info.h

2c4beea2 Kees Cook 2016-09-19 123 __skip_check_object_size(void);
2c4beea2 Kees Cook 2016-09-19 124
a85d6b82 Kees Cook 2016-09-07 125 static __always_inline void check_object_size(const void *ptr, unsigned long n,
f5509cc1 Kees Cook 2016-06-07 126 bool to_user)
f5509cc1 Kees Cook 2016-06-07 127 {
81409e9e Kees Cook 2016-08-31 128 if (!__builtin_constant_p(n))
f5509cc1 Kees Cook 2016-06-07 @129 __check_object_size(ptr, n, to_user);
2c4beea2 Kees Cook 2016-09-19 130 else
2c4beea2 Kees Cook 2016-09-19 @131 __skip_check_object_size();
f5509cc1 Kees Cook 2016-06-07 132 }
f5509cc1 Kees Cook 2016-06-07 133 #else
f5509cc1 Kees Cook 2016-06-07 134 static inline void check_object_size(const void *ptr, unsigned long n,

:::::: The code at line 129 was first introduced by commit
:::::: f5509cc18daa7f82bcc553be70df2117c8eedc16 mm: Hardened usercopy

:::::: TO: Kees Cook <keescook@xxxxxxxxxxxx>
:::::: CC: Kees Cook <keescook@xxxxxxxxxxxx>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

Attachment: .config.gz
Description: application/gzip