Message ID | 1446906642-19372-7-git-send-email-sandyinchina@gmail.com (mailing list archive) |
---|---|
State | Not Applicable |
Delegated to: | Herbert Xu |
Headers | show |
Hi Sandy,
[auto build test ERROR on: char-misc/char-misc-testing]
[also build test ERROR on: v4.3 next-20151106]
url: https://github.com/0day-ci/linux/commits/Sandy-Harris/A-couple-of-generated-files/20151107-223540
config: sh-allyesconfig (attached as .config)
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=sh
All errors (new ones prefixed by >>):
>> scripts/gen_random.c:61:19: fatal error: stdio.h: No such file or directory
compilation terminated.
make[2]: *** [scripts/gen_random] Error 1
<stdin>:1229:2: warning: #warning syscall sched_setattr not implemented [-Wcpp]
<stdin>:1232:2: warning: #warning syscall sched_getattr not implemented [-Wcpp]
<stdin>:1235:2: warning: #warning syscall renameat2 not implemented [-Wcpp]
<stdin>:1238:2: warning: #warning syscall seccomp not implemented [-Wcpp]
<stdin>:1241:2: warning: #warning syscall getrandom not implemented [-Wcpp]
<stdin>:1244:2: warning: #warning syscall memfd_create not implemented [-Wcpp]
<stdin>:1247:2: warning: #warning syscall bpf not implemented [-Wcpp]
<stdin>:1250:2: warning: #warning syscall execveat not implemented [-Wcpp]
<stdin>:1298:2: warning: #warning syscall userfaultfd not implemented [-Wcpp]
<stdin>:1301:2: warning: #warning syscall membarrier not implemented [-Wcpp]
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 +61 scripts/gen_random.c
06038f35 Sandy Harris 2015-11-07 45 * This is certainly done early enough and the data is random
06038f35 Sandy Harris 2015-11-07 46 * enough, but it is not necessarily secret enough.
06038f35 Sandy Harris 2015-11-07 47 *
06038f35 Sandy Harris 2015-11-07 48 * In some cases -- for example, a firewall machine that compiles
06038f35 Sandy Harris 2015-11-07 49 * its own kernel -- this alone might be enough to ensure secure
06038f35 Sandy Harris 2015-11-07 50 * initialisation, since only an enemy who already has root could
06038f35 Sandy Harris 2015-11-07 51 * discover this data. Of course even in those cases it should not
06038f35 Sandy Harris 2015-11-07 52 * be used alone, only as one layer of a defense in depth.
06038f35 Sandy Harris 2015-11-07 53 *
06038f35 Sandy Harris 2015-11-07 54 * In other cases -- a kernel that is compiled once then used in
06038f35 Sandy Harris 2015-11-07 55 * a Linux distro or installed on many devices -- this is likely
06038f35 Sandy Harris 2015-11-07 56 * of very little value. It complicates an attack somewhat, but
06038f35 Sandy Harris 2015-11-07 57 * it clearly will not stop a serious attacker and may not even
06038f35 Sandy Harris 2015-11-07 58 * slow them down much.
06038f35 Sandy Harris 2015-11-07 59 */
06038f35 Sandy Harris 2015-11-07 60
06038f35 Sandy Harris 2015-11-07 @61 #include <stdio.h>
06038f35 Sandy Harris 2015-11-07 62 #include <stdlib.h>
06038f35 Sandy Harris 2015-11-07 63 #include <unistd.h>
06038f35 Sandy Harris 2015-11-07 64 #include <fcntl.h>
06038f35 Sandy Harris 2015-11-07 65 #include <stdint.h>
06038f35 Sandy Harris 2015-11-07 66 #include <ctype.h>
06038f35 Sandy Harris 2015-11-07 67
06038f35 Sandy Harris 2015-11-07 68 /*
06038f35 Sandy Harris 2015-11-07 69 * Configuration information
:::::: The code at line 61 was first introduced by commit
:::::: 06038f35641185897feb14917d89d03fab1710ba Produces generated/random_init.h for random driver
:::::: TO: Sandy Harris <sandyinchina@gmail.com>
:::::: CC: 0day robot <fengguang.wu@intel.com>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Hi Sandy, [auto build test ERROR on: char-misc/char-misc-testing] [also build test ERROR on: v4.3 next-20151106] url: https://github.com/0day-ci/linux/commits/Sandy-Harris/A-couple-of-generated-files/20151107-223540 config: x86_64-allmodconfig (attached as .config) reproduce: # save the attached .config to linux build tree make ARCH=x86_64 All error/warnings (new ones prefixed by >>): drivers/char/random_gcm.c:2366:28: sparse: non-ANSI function declaration of function 'mix_const_all' drivers/char/random_gcm.c:2379:21: sparse: non-ANSI function declaration of function 'big_mix' drivers/char/random_gcm.c:2443:21: sparse: non-ANSI function declaration of function 'top_mix' drivers/char/random_gcm.c:2518:26: sparse: non-ANSI function declaration of function 'clear_addmul' drivers/char/random_gcm.c:3208:25: sparse: non-ANSI function declaration of function 'init_random' drivers/char/random_gcm.c:3571:26: sparse: non-ANSI function declaration of function 'counter_any' drivers/char/random_gcm.c:3652:23: sparse: non-ANSI function declaration of function 'load_input' drivers/char/random_gcm.c:3702:27: sparse: non-ANSI function declaration of function 'load_constants' drivers/char/random_gcm.c:477:14: sparse: undefined identifier 'constants' drivers/char/random_gcm.c:478:14: sparse: undefined identifier 'constants' drivers/char/random_gcm.c:496:14: sparse: undefined identifier 'constants' drivers/char/random_gcm.c:497:14: sparse: undefined identifier 'constants' drivers/char/random_gcm.c:514:14: sparse: undefined identifier 'constants' drivers/char/random_gcm.c:515:14: sparse: undefined identifier 'constants' drivers/char/random_gcm.c:530:14: sparse: undefined identifier 'constants' drivers/char/random_gcm.c:531:14: sparse: undefined identifier 'constants' drivers/char/random_gcm.c:3471:25: sparse: undefined identifier 'counter' drivers/char/random_gcm.c:3474:25: sparse: undefined identifier 'counter' drivers/char/random_gcm.c:3477:25: sparse: undefined identifier 'counter' drivers/char/random_gcm.c:3488:25: sparse: undefined identifier 'counter' drivers/char/random_gcm.c:3495:25: sparse: undefined identifier 'counter' drivers/char/random_gcm.c:3496:25: sparse: undefined identifier 'counter' drivers/char/random_gcm.c:3497:25: sparse: undefined identifier 'counter' drivers/char/random_gcm.c:3517:9: sparse: undefined identifier 'counter' drivers/char/random_gcm.c:3541:9: sparse: undefined identifier 'counter' drivers/char/random_gcm.c:3547:17: sparse: undefined identifier 'counter' drivers/char/random_gcm.c:3555:24: sparse: undefined identifier 'counter' drivers/char/random_gcm.c:3555:58: sparse: undefined identifier 'counter' drivers/char/random_gcm.c:3555:51: sparse: cast from unknown type drivers/char/random_gcm.c:3560:17: sparse: undefined identifier 'counter' drivers/char/random_gcm.c:3709:58: sparse: undefined identifier 'ARRAY_WORDS' drivers/char/random_gcm.c:3709:25: sparse: undefined identifier 'constants' drivers/char/random_gcm.c:2371:19: sparse: undefined identifier 'constants' drivers/char/random_gcm.c:2652:38: sparse: undefined identifier 'counter' >> drivers/char/random_gcm.c:477:7: error: 'constants' undeclared here (not in a function) .A = constants, ^ drivers/char/random_gcm.c: In function 'mix_first': >> drivers/char/random_gcm.c:2652:31: error: 'counter' undeclared (first use in this function) addmul( (u8 *) accum, (u8 *) counter, 16, (u8 *) r->B) ; ^ drivers/char/random_gcm.c:2652:31: note: each undeclared identifier is reported only once for each function it appears in drivers/char/random_gcm.c: In function 'count': drivers/char/random_gcm.c:3471:4: error: 'counter' undeclared (first use in this function) counter[1] += counter[3] ; ^ drivers/char/random_gcm.c: In function 'buffer2counter': drivers/char/random_gcm.c:3541:2: error: 'counter' undeclared (first use in this function) counter[0] ^= jiffies ; ^ drivers/char/random_gcm.c: In function 'load_constants': >> drivers/char/random_gcm.c:3709:27: warning: left-hand operand of comma expression has no effect [-Wunused-value] for( i = 0, p = constants, ret = 1 ; ret && (i < ARRAY_WORDS) ; i++, p++ ) { ^ >> drivers/char/random_gcm.c:3709:51: error: 'ARRAY_WORDS' undeclared (first use in this function) for( i = 0, p = constants, ret = 1 ; ret && (i < ARRAY_WORDS) ; i++, p++ ) { ^ sparse warnings: (new ones prefixed by >>) drivers/char/random_gcm.c:2366:28: sparse: non-ANSI function declaration of function 'mix_const_all' drivers/char/random_gcm.c:2379:21: sparse: non-ANSI function declaration of function 'big_mix' drivers/char/random_gcm.c:2443:21: sparse: non-ANSI function declaration of function 'top_mix' drivers/char/random_gcm.c:2518:26: sparse: non-ANSI function declaration of function 'clear_addmul' drivers/char/random_gcm.c:3208:25: sparse: non-ANSI function declaration of function 'init_random' drivers/char/random_gcm.c:3571:26: sparse: non-ANSI function declaration of function 'counter_any' drivers/char/random_gcm.c:3652:23: sparse: non-ANSI function declaration of function 'load_input' drivers/char/random_gcm.c:3702:27: sparse: non-ANSI function declaration of function 'load_constants' drivers/char/random_gcm.c:477:14: sparse: undefined identifier 'constants' drivers/char/random_gcm.c:478:14: sparse: undefined identifier 'constants' drivers/char/random_gcm.c:496:14: sparse: undefined identifier 'constants' drivers/char/random_gcm.c:497:14: sparse: undefined identifier 'constants' drivers/char/random_gcm.c:514:14: sparse: undefined identifier 'constants' drivers/char/random_gcm.c:515:14: sparse: undefined identifier 'constants' drivers/char/random_gcm.c:530:14: sparse: undefined identifier 'constants' drivers/char/random_gcm.c:531:14: sparse: undefined identifier 'constants' drivers/char/random_gcm.c:3471:25: sparse: undefined identifier 'counter' drivers/char/random_gcm.c:3474:25: sparse: undefined identifier 'counter' drivers/char/random_gcm.c:3477:25: sparse: undefined identifier 'counter' drivers/char/random_gcm.c:3488:25: sparse: undefined identifier 'counter' drivers/char/random_gcm.c:3495:25: sparse: undefined identifier 'counter' drivers/char/random_gcm.c:3496:25: sparse: undefined identifier 'counter' drivers/char/random_gcm.c:3497:25: sparse: undefined identifier 'counter' drivers/char/random_gcm.c:3517:9: sparse: undefined identifier 'counter' drivers/char/random_gcm.c:3541:9: sparse: undefined identifier 'counter' drivers/char/random_gcm.c:3547:17: sparse: undefined identifier 'counter' drivers/char/random_gcm.c:3555:24: sparse: undefined identifier 'counter' drivers/char/random_gcm.c:3555:58: sparse: undefined identifier 'counter' >> drivers/char/random_gcm.c:3555:51: sparse: cast from unknown type drivers/char/random_gcm.c:3560:17: sparse: undefined identifier 'counter' drivers/char/random_gcm.c:3709:58: sparse: undefined identifier 'ARRAY_WORDS' drivers/char/random_gcm.c:3709:25: sparse: undefined identifier 'constants' drivers/char/random_gcm.c:2371:19: sparse: undefined identifier 'constants' drivers/char/random_gcm.c:2652:38: sparse: undefined identifier 'counter' drivers/char/random_gcm.c:477:7: error: 'constants' undeclared here (not in a function) .A = constants, ^ drivers/char/random_gcm.c: In function 'mix_first': drivers/char/random_gcm.c:2652:31: error: 'counter' undeclared (first use in this function) addmul( (u8 *) accum, (u8 *) counter, 16, (u8 *) r->B) ; ^ drivers/char/random_gcm.c:2652:31: note: each undeclared identifier is reported only once for each function it appears in drivers/char/random_gcm.c: In function 'count': drivers/char/random_gcm.c:3471:4: error: 'counter' undeclared (first use in this function) counter[1] += counter[3] ; ^ drivers/char/random_gcm.c: In function 'buffer2counter': drivers/char/random_gcm.c:3541:2: error: 'counter' undeclared (first use in this function) counter[0] ^= jiffies ; ^ drivers/char/random_gcm.c: In function 'load_constants': drivers/char/random_gcm.c:3709:27: warning: left-hand operand of comma expression has no effect [-Wunused-value] for( i = 0, p = constants, ret = 1 ; ret && (i < ARRAY_WORDS) ; i++, p++ ) { ^ drivers/char/random_gcm.c:3709:51: error: 'ARRAY_WORDS' undeclared (first use in this function) for( i = 0, p = constants, ret = 1 ; ret && (i < ARRAY_WORDS) ; i++, p++ ) { ^ vim +/constants +477 drivers/char/random_gcm.c da17cbfa Sandy Harris 2015-11-07 461 unsigned int initialized:1; da17cbfa Sandy Harris 2015-11-07 462 unsigned int limit:1; da17cbfa Sandy Harris 2015-11-07 463 unsigned int last_data_init:1; da17cbfa Sandy Harris 2015-11-07 464 __u8 last_data[EXTRACT_SIZE]; da17cbfa Sandy Harris 2015-11-07 465 u32 *A, *B, which, count ; da17cbfa Sandy Harris 2015-11-07 466 u32 *p, *q, *end, size ; da17cbfa Sandy Harris 2015-11-07 467 }; da17cbfa Sandy Harris 2015-11-07 468 da17cbfa Sandy Harris 2015-11-07 469 static void push_to_pool(struct work_struct *work); da17cbfa Sandy Harris 2015-11-07 470 da17cbfa Sandy Harris 2015-11-07 471 static struct entropy_store input_pool = { da17cbfa Sandy Harris 2015-11-07 472 .poolinfo = &poolinfo_table[0], da17cbfa Sandy Harris 2015-11-07 473 .name = "input", da17cbfa Sandy Harris 2015-11-07 474 .limit = 1, da17cbfa Sandy Harris 2015-11-07 475 .lock = __SPIN_LOCK_UNLOCKED(input_pool.lock), da17cbfa Sandy Harris 2015-11-07 476 .pool = pools, da17cbfa Sandy Harris 2015-11-07 @477 .A = constants, da17cbfa Sandy Harris 2015-11-07 478 .B = constants+4, da17cbfa Sandy Harris 2015-11-07 479 .which = 0, da17cbfa Sandy Harris 2015-11-07 480 .count = 0, da17cbfa Sandy Harris 2015-11-07 481 .size = INPUT_POOL_WORDS, da17cbfa Sandy Harris 2015-11-07 482 .p = pools, da17cbfa Sandy Harris 2015-11-07 483 .q = pools + (INPUT_POOL_WORDS/2), da17cbfa Sandy Harris 2015-11-07 484 .end = pools + INPUT_POOL_WORDS da17cbfa Sandy Harris 2015-11-07 485 }; :::::: The code at line 477 was first introduced by commit :::::: da17cbfaa5c53120c6c5797cf2dc6bd4123b6869 Different version of driver using hash from AES-GCM Compiled if CONFIG_RANDOM_GCM=y :::::: TO: Sandy Harris <sandyinchina@gmail.com> :::::: CC: 0day robot <fengguang.wu@intel.com> --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
Hi Sandy,
[auto build test ERROR on: char-misc/char-misc-testing]
[also build test ERROR on: v4.3 next-20151106]
url: https://github.com/0day-ci/linux/commits/Sandy-Harris/A-couple-of-generated-files/20151107-223540
config: mips-allyesconfig (attached as .config)
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=mips
All errors (new ones prefixed by >>):
>> /bin/sh: scripts/gen_random: cannot execute binary file: Exec format error
make[2]: *** [include/generated/random_init.h] Error 126
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
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
diff --git a/Kbuild b/Kbuild index f55cefd..494c665 100644 --- a/Kbuild +++ b/Kbuild @@ -5,6 +5,7 @@ # 2) Generate timeconst.h # 3) Generate asm-offsets.h (may need bounds.h and timeconst.h) # 4) Check for missing system calls +# 5) Generate random_init.h # Default sed regexp - multiline due to syntax constraints define sed-y @@ -98,3 +99,23 @@ missing-syscalls: scripts/checksyscalls.sh $(offsets-file) FORCE # Keep these three files during make clean no-clean-files := $(bounds-file) $(offsets-file) $(timeconst-file) + +##### +# 5) Generate random_init.h + +ifdef CONFIG_RANDOM_INIT +init-file := include/generated/random_init.h +used-file := scripts/gen_random +source-file := $(used-file).c +always += $(init-file) +targets += $(init-file) +$(init-file) : $(used-file) + $(Q) $(used-file) > $(init-file) +ifdef CONFIG_RANDOM_GCM +$(used-file) : $(source-file) + $(CC) $< -DCONFIG_RANDOM_GCM -o $@ +else +$(used-file) : $(source-file) + $(CC) $< -o $@ +endif +endif diff --git a/scripts/Makefile b/scripts/Makefile index 1b26617..3cea546 100644 --- a/scripts/Makefile +++ b/scripts/Makefile @@ -18,6 +18,7 @@ hostprogs-$(CONFIG_BUILDTIME_EXTABLE_SORT) += sortextable hostprogs-$(CONFIG_ASN1) += asn1_compiler hostprogs-$(CONFIG_MODULE_SIG) += sign-file hostprogs-$(CONFIG_SYSTEM_TRUSTED_KEYRING) += extract-cert +hostprogs-$(CONFIG_RANDOM_INIT) += gen_random HOSTCFLAGS_sortextable.o = -I$(srctree)/tools/include HOSTCFLAGS_asn1_compiler.o = -I$(srctree)/include
Signed-off-by: Sandy Harris <sandyinchina@gmail.com> --- Kbuild | 21 +++++++++++++++++++++ scripts/Makefile | 1 + 2 files changed, 22 insertions(+)