Re: [PATCH v4 7/7] kernel.h: Split out might_sleep() and friends

From: kbuild test robot
Date: Fri Apr 24 2020 - 13:46:10 EST


Hi Andy,

I love your patch! Yet something to improve:

[auto build test ERROR on next-20200423]
[cannot apply to tip/locking/core rcu/dev linus/master tip/x86/core v5.7-rc2 v5.7-rc1 v5.6 v5.7-rc2]
[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/drm-shmobile-Reduce-include-dependencies/20200424-044529
base: aefe184e814492e36b2ca350c1522bd71b09b520
config: parisc-allnoconfig (attached as .config)
compiler: hppa-linux-gcc (GCC) 9.3.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
COMPILER_INSTALL_PATH=$HOME/0day GCC_VERSION=9.3.0 make.cross ARCH=parisc

If you fix the issue, kindly add following tag as appropriate
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/parisc/include/generated/asm/current.h:1,
from include/linux/might_sleep.h:6,
from include/linux/kernel.h:14,
from arch/parisc/include/asm/bug.h:5,
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:135:2: error: implicit declaration of function 'WARN' [-Werror=implicit-function-declaration]
135 | 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:151:6: error: implicit declaration of function 'WARN_ON_ONCE' [-Werror=implicit-function-declaration]
151 | if (WARN_ON_ONCE(bytes > INT_MAX))
| ^~~~~~~~~~~~
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:100: kernel/bounds.s] Error 1
make[2]: Target '__build' not remade because of errors.
make[1]: *** [Makefile:1142: prepare0] Error 2
make[1]: Target 'prepare' not remade because of errors.
make: *** [Makefile:180: sub-make] Error 2

vim +/WARN +135 include/linux/thread_info.h

b0377fedb65280 Al Viro 2017-06-29 132
b0377fedb65280 Al Viro 2017-06-29 133 static inline void copy_overflow(int size, unsigned long count)
b0377fedb65280 Al Viro 2017-06-29 134 {
b0377fedb65280 Al Viro 2017-06-29 @135 WARN(1, "Buffer overflow detected (%d < %lu)!\n", size, count);
b0377fedb65280 Al Viro 2017-06-29 136 }
b0377fedb65280 Al Viro 2017-06-29 137
9dd819a15162f8 Kees Cook 2019-09-25 138 static __always_inline __must_check bool
b0377fedb65280 Al Viro 2017-06-29 139 check_copy_size(const void *addr, size_t bytes, bool is_source)
b0377fedb65280 Al Viro 2017-06-29 140 {
b0377fedb65280 Al Viro 2017-06-29 141 int sz = __compiletime_object_size(addr);
b0377fedb65280 Al Viro 2017-06-29 142 if (unlikely(sz >= 0 && sz < bytes)) {
b0377fedb65280 Al Viro 2017-06-29 143 if (!__builtin_constant_p(bytes))
b0377fedb65280 Al Viro 2017-06-29 144 copy_overflow(sz, bytes);
b0377fedb65280 Al Viro 2017-06-29 145 else if (is_source)
b0377fedb65280 Al Viro 2017-06-29 146 __bad_copy_from();
b0377fedb65280 Al Viro 2017-06-29 147 else
b0377fedb65280 Al Viro 2017-06-29 148 __bad_copy_to();
b0377fedb65280 Al Viro 2017-06-29 149 return false;
b0377fedb65280 Al Viro 2017-06-29 150 }
6d13de1489b6bf Kees Cook 2019-12-04 @151 if (WARN_ON_ONCE(bytes > INT_MAX))
6d13de1489b6bf Kees Cook 2019-12-04 152 return false;
b0377fedb65280 Al Viro 2017-06-29 153 check_object_size(addr, bytes, is_source);
b0377fedb65280 Al Viro 2017-06-29 154 return true;
b0377fedb65280 Al Viro 2017-06-29 155 }
b0377fedb65280 Al Viro 2017-06-29 156

:::::: The code at line 135 was first introduced by commit
:::::: b0377fedb6528087ed319b0d054d6ed82240372c copy_{to,from}_user(): consolidate object size checks

:::::: TO: Al Viro <viro@xxxxxxxxxxxxxxxxxx>
:::::: CC: Al Viro <viro@xxxxxxxxxxxxxxxxxx>

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

Attachment: .config.gz
Description: application/gzip