Re: [PATCH] fortify: Use WARN instead of BUG for now

From: kbuild test robot
Date: Thu Jul 27 2017 - 02:02:24 EST


Hi Kees,

[auto build test ERROR on linus/master]
[also build test ERROR on v4.13-rc2 next-20170726]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Kees-Cook/fortify-Use-WARN-instead-of-BUG-for-now/20170727-101839
config: i386-allmodconfig (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 errors (new ones prefixed by >>):

In file included from arch/x86/include/asm/page_32.h:34:0,
from arch/x86/include/asm/page.h:13,
from arch/x86/include/asm/thread_info.h:11,
from include/linux/thread_info.h:37,
from arch/x86/include/asm/preempt.h:6,
from include/linux/preempt.h:80,
from include/linux/spinlock.h:50,
from include/linux/wait.h:8,
from include/linux/wait_bit.h:7,
from include/linux/fs.h:5,
from include/linux/buffer_head.h:11,
from fs/adfs/dir_f.c:12:
In function 'memcpy',
inlined from '__adfs_dir_put' at fs/adfs/dir_f.c:318:2,
inlined from 'adfs_f_update' at fs/adfs/dir_f.c:403:2:
>> include/linux/string.h:308:4: error: call to '__read_overflow2' declared with attribute error: detected read beyond size of object passed as 2nd parameter
__read_overflow2();
^~~~~~~~~~~~~~~~~~

vim +/__read_overflow2 +308 include/linux/string.h

6974f0c4 Daniel Micay 2017-07-12 299
6974f0c4 Daniel Micay 2017-07-12 300 __FORTIFY_INLINE void *memcpy(void *p, const void *q, __kernel_size_t size)
6974f0c4 Daniel Micay 2017-07-12 301 {
6974f0c4 Daniel Micay 2017-07-12 302 size_t p_size = __builtin_object_size(p, 0);
6974f0c4 Daniel Micay 2017-07-12 303 size_t q_size = __builtin_object_size(q, 0);
6974f0c4 Daniel Micay 2017-07-12 304 if (__builtin_constant_p(size)) {
6974f0c4 Daniel Micay 2017-07-12 305 if (p_size < size)
6974f0c4 Daniel Micay 2017-07-12 306 __write_overflow();
6974f0c4 Daniel Micay 2017-07-12 307 if (q_size < size)
6974f0c4 Daniel Micay 2017-07-12 @308 __read_overflow2();
acf23d09 Kees Cook 2017-07-25 309 } else {
acf23d09 Kees Cook 2017-07-25 310 if (p_size < size)
acf23d09 Kees Cook 2017-07-25 311 fortify_write_overflow(__func__);
acf23d09 Kees Cook 2017-07-25 312 if (q_size < size)
acf23d09 Kees Cook 2017-07-25 313 fortify_read_overflow2(__func__);
6974f0c4 Daniel Micay 2017-07-12 314 }
6974f0c4 Daniel Micay 2017-07-12 315 return __builtin_memcpy(p, q, size);
6974f0c4 Daniel Micay 2017-07-12 316 }
6974f0c4 Daniel Micay 2017-07-12 317

:::::: The code at line 308 was first introduced by commit
:::::: 6974f0c4555e285ab217cee58b6e874f776ff409 include/linux/string.h: add the option of fortified string.h functions

:::::: TO: Daniel Micay <danielmicay@xxxxxxxxx>
:::::: CC: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>

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

Attachment: .config.gz
Description: application/gzip