Re: [PATCH v3 3/4] kernel.h: Split out might_sleep() and friends

From: kbuild test robot
Date: Sat Feb 08 2020 - 16:49:41 EST


Hi Andy,

I love your patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on next-20200207]
[cannot apply to nfs/linux-next rcu/dev cryptodev/master crypto/master dennis-percpu/for-next tip/sched/core linux/master v5.5]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url: https://github.com/0day-ci/linux/commits/Andy-Shevchenko/kernel-h-Split-out-min-max-et-al-helpers/20200209-041358
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git f757165705e92db62f85a1ad287e9251d1f2cd82
config: openrisc-or1ksim_defconfig (attached as .config)
compiler: or1k-linux-gcc (GCC) 9.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=9.2.0 make.cross ARCH=openrisc

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

In file included from include/asm-generic/current.h:5,
from ./arch/openrisc/include/generated/asm/current.h:1,
from include/linux/might_sleep.h:6,
from include/linux/kernel.h:14,
from include/asm-generic/bug.h:19,
from ./arch/openrisc/include/generated/asm/bug.h:1,
from include/linux/bug.h:5,
from include/linux/page-flags.h:10,
from kernel/bounds.c:10:
include/linux/thread_info.h: In function 'copy_overflow':
include/linux/thread_info.h:134:2: error: implicit declaration of function 'WARN' [-Werror=implicit-function-declaration]
134 | WARN(1, "Buffer overflow detected (%d < %lu)!\n", size, count);
| ^~~~
include/linux/thread_info.h: In function 'check_copy_size':
>> include/linux/thread_info.h:150:6: error: implicit declaration of function 'WARN_ON_ONCE' [-Werror=implicit-function-declaration]
150 | if (WARN_ON_ONCE(bytes > INT_MAX))
| ^~~~~~~~~~~~
cc1: some warnings being treated as errors
make[2]: *** [kernel/bounds.s] Error 1
make[2]: Target '__build' not remade because of errors.
make[1]: *** [prepare0] Error 2
make[1]: Target 'prepare' not remade because of errors.
make: *** [sub-make] Error 2
16 real 6 user 7 sys 83.27% cpu make prepare

vim +/WARN_ON_ONCE +150 include/linux/thread_info.h

b0377fedb652808 Al Viro 2017-06-29 136
9dd819a15162f8f Kees Cook 2019-09-25 137 static __always_inline __must_check bool
b0377fedb652808 Al Viro 2017-06-29 138 check_copy_size(const void *addr, size_t bytes, bool is_source)
b0377fedb652808 Al Viro 2017-06-29 139 {
b0377fedb652808 Al Viro 2017-06-29 140 int sz = __compiletime_object_size(addr);
b0377fedb652808 Al Viro 2017-06-29 141 if (unlikely(sz >= 0 && sz < bytes)) {
b0377fedb652808 Al Viro 2017-06-29 142 if (!__builtin_constant_p(bytes))
b0377fedb652808 Al Viro 2017-06-29 143 copy_overflow(sz, bytes);
b0377fedb652808 Al Viro 2017-06-29 144 else if (is_source)
b0377fedb652808 Al Viro 2017-06-29 145 __bad_copy_from();
b0377fedb652808 Al Viro 2017-06-29 146 else
b0377fedb652808 Al Viro 2017-06-29 147 __bad_copy_to();
b0377fedb652808 Al Viro 2017-06-29 148 return false;
b0377fedb652808 Al Viro 2017-06-29 149 }
6d13de1489b6bf5 Kees Cook 2019-12-04 @150 if (WARN_ON_ONCE(bytes > INT_MAX))
6d13de1489b6bf5 Kees Cook 2019-12-04 151 return false;
b0377fedb652808 Al Viro 2017-06-29 152 check_object_size(addr, bytes, is_source);
b0377fedb652808 Al Viro 2017-06-29 153 return true;
b0377fedb652808 Al Viro 2017-06-29 154 }
b0377fedb652808 Al Viro 2017-06-29 155

:::::: The code at line 150 was first introduced by commit
:::::: 6d13de1489b6bf539695f96d945de3860e6d5e17 uaccess: disallow > INT_MAX copy sizes

:::::: TO: Kees Cook <keescook@xxxxxxxxxxxx>
:::::: CC: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip