Re: [PATCH] string.h: work around __builtin_constant_p quirk
From: kbuild test robot
Date: Wed Aug 09 2017 - 02:09:39 EST
Hi Arnd,
[auto build test ERROR on next-20170808]
[also build test ERROR on v4.13-rc4]
[cannot apply to linus/master kees/for-next/pstore arm-soc/for-next v4.13-rc4 v4.13-rc3 v4.13-rc2]
[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/Arnd-Bergmann/string-h-work-around-__builtin_constant_p-quirk/20170809-073927
config: i386-randconfig-i1-08071909 (attached as .config)
compiler: gcc-4.8 (Debian 4.8.4-1) 4.8.4
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
All error/warnings (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/mmzone.h:7,
from include/linux/gfp.h:5,
from include/linux/slab.h:14,
from include/linux/crypto.h:24,
from arch/x86/kernel/asm-offsets.c:8:
include/linux/string.h: In function 'strncpy':
>> include/linux/string.h:212:2: error: first argument to '__builtin_choose_expr' not a constant
__builtin_choose_expr(__builtin_constant_p(arg), (arg), 0)
^
>> include/linux/string.h:217:21: note: in expansion of macro '__constant_argument'
size_t constsize = __constant_argument(size);
^
include/linux/string.h: In function 'strlcpy':
>> include/linux/string.h:212:2: error: first argument to '__builtin_choose_expr' not a constant
__builtin_choose_expr(__builtin_constant_p(arg), (arg), 0)
^
include/linux/string.h:269:21: note: in expansion of macro '__constant_argument'
size_t constlen = __constant_argument(len);
^
include/linux/string.h: In function 'memset':
>> include/linux/string.h:212:2: error: first argument to '__builtin_choose_expr' not a constant
__builtin_choose_expr(__builtin_constant_p(arg), (arg), 0)
^
include/linux/string.h:300:21: note: in expansion of macro '__constant_argument'
size_t constsize = __constant_argument(size);
^
include/linux/string.h: In function 'memcpy':
>> include/linux/string.h:212:2: error: first argument to '__builtin_choose_expr' not a constant
__builtin_choose_expr(__builtin_constant_p(arg), (arg), 0)
^
include/linux/string.h:312:21: note: in expansion of macro '__constant_argument'
size_t constsize = __constant_argument(size);
^
include/linux/string.h: In function 'memmove':
>> include/linux/string.h:212:2: error: first argument to '__builtin_choose_expr' not a constant
__builtin_choose_expr(__builtin_constant_p(arg), (arg), 0)
^
include/linux/string.h:326:21: note: in expansion of macro '__constant_argument'
size_t constsize = __constant_argument(size);
^
include/linux/string.h: In function 'memscan':
>> include/linux/string.h:212:2: error: first argument to '__builtin_choose_expr' not a constant
__builtin_choose_expr(__builtin_constant_p(arg), (arg), 0)
^
include/linux/string.h:340:21: note: in expansion of macro '__constant_argument'
size_t constsize = __constant_argument(size);
^
include/linux/string.h: In function 'memcmp':
>> include/linux/string.h:212:2: error: first argument to '__builtin_choose_expr' not a constant
__builtin_choose_expr(__builtin_constant_p(arg), (arg), 0)
^
include/linux/string.h:352:21: note: in expansion of macro '__constant_argument'
size_t constsize = __constant_argument(size);
^
include/linux/string.h: In function 'memchr':
>> include/linux/string.h:212:2: error: first argument to '__builtin_choose_expr' not a constant
__builtin_choose_expr(__builtin_constant_p(arg), (arg), 0)
^
include/linux/string.h:365:21: note: in expansion of macro '__constant_argument'
size_t constsize = __constant_argument(size);
^
include/linux/string.h: In function 'memchr_inv':
>> include/linux/string.h:212:2: error: first argument to '__builtin_choose_expr' not a constant
__builtin_choose_expr(__builtin_constant_p(arg), (arg), 0)
^
include/linux/string.h:377:21: note: in expansion of macro '__constant_argument'
size_t constsize = __constant_argument(size);
^
include/linux/string.h: In function 'kmemdup':
>> include/linux/string.h:212:2: error: first argument to '__builtin_choose_expr' not a constant
__builtin_choose_expr(__builtin_constant_p(arg), (arg), 0)
^
include/linux/string.h:389:21: note: in expansion of macro '__constant_argument'
size_t constsize = __constant_argument(size);
^
make[2]: *** [arch/x86/kernel/asm-offsets.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
vim +/__builtin_choose_expr +212 include/linux/string.h
206
207 /*
208 * a more reliable check for constant arguments, see
209 * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72785
210 */
211 #define __constant_argument(arg) \
> 212 __builtin_choose_expr(__builtin_constant_p(arg), (arg), 0)
213
214 __FORTIFY_INLINE char *strncpy(char *p, const char *q, __kernel_size_t size)
215 {
216 size_t p_size = __builtin_object_size(p, 0);
> 217 size_t constsize = __constant_argument(size);
218 if (p_size < constsize)
219 __write_overflow();
220 if (p_size < size)
221 fortify_overflow(__func__);
222 return __builtin_strncpy(p, q, size);
223 }
224
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Attachment:
.config.gz
Description: application/gzip