tree: git://git.kernel.org/pub/scm/linux/kernel/git/crng/random.git jd/canary-mask head: afb02bbe4c346ac0a902ce5f9df4affc68803a40 commit: 6c054d434f85af5a8e61a81d595796768a2d9fab [8/9] stackprotector: move CANARY_MASK and get_random_canary() into stackprotector.h config: riscv-randconfig-r024-20221023 compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 791a7ae1ba3efd6bca96338e10ffde557ba83920) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # install riscv cross compiling tool for clang build # apt-get install binutils-riscv64-linux-gnu # https://git.kernel.org/pub/scm/linux/kernel/git/crng/random.git/commit/?id=6c054d434f85af5a8e61a81d595796768a2d9fab git remote add crng-random git://git.kernel.org/pub/scm/linux/kernel/git/crng/random.git git fetch --no-tags crng-random jd/canary-mask git checkout 6c054d434f85af5a8e61a81d595796768a2d9fab # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=riscv SHELL=/bin/bash If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot All errors (new ones prefixed by >>): In file included from init/main.c:22: In file included from include/linux/stackprotector.h:28: >> arch/riscv/include/asm/stackprotector.h:26:11: error: no member named 'stack_canary' in 'struct task_struct' current->stack_canary = canary; ~~~~~~~ ^ arch/riscv/include/asm/stackprotector.h:28:32: error: no member named 'stack_canary' in 'struct task_struct' __stack_chk_guard = current->stack_canary; ~~~~~~~ ^ In file included from init/main.c:22: >> include/linux/stackprotector.h:31:20: error: redefinition of 'boot_init_stack_canary' static inline void boot_init_stack_canary(void) ^ arch/riscv/include/asm/stackprotector.h:17:29: note: previous definition is here static __always_inline void boot_init_stack_canary(void) ^ init/main.c:772:20: warning: no previous prototype for function 'arch_post_acpi_subsys_init' [-Wmissing-prototypes] void __init __weak arch_post_acpi_subsys_init(void) { } ^ init/main.c:772:1: note: declare 'static' if the function is not intended to be used outside of this translation unit void __init __weak arch_post_acpi_subsys_init(void) { } ^ static init/main.c:784:20: warning: no previous prototype for function 'mem_encrypt_init' [-Wmissing-prototypes] void __init __weak mem_encrypt_init(void) { } ^ init/main.c:784:1: note: declare 'static' if the function is not intended to be used outside of this translation unit void __init __weak mem_encrypt_init(void) { } ^ static init/main.c:786:20: warning: no previous prototype for function 'poking_init' [-Wmissing-prototypes] void __init __weak poking_init(void) { } ^ init/main.c:786:1: note: declare 'static' if the function is not intended to be used outside of this translation unit void __init __weak poking_init(void) { } ^ static 3 warnings and 3 errors generated. -- In file included from kernel/fork.c:99: In file included from include/linux/stackprotector.h:28: >> arch/riscv/include/asm/stackprotector.h:26:11: error: no member named 'stack_canary' in 'struct task_struct' current->stack_canary = canary; ~~~~~~~ ^ arch/riscv/include/asm/stackprotector.h:28:32: error: no member named 'stack_canary' in 'struct task_struct' __stack_chk_guard = current->stack_canary; ~~~~~~~ ^ In file included from kernel/fork.c:99: >> include/linux/stackprotector.h:31:20: error: redefinition of 'boot_init_stack_canary' static inline void boot_init_stack_canary(void) ^ arch/riscv/include/asm/stackprotector.h:17:29: note: previous definition is here static __always_inline void boot_init_stack_canary(void) ^ kernel/fork.c:162:13: warning: no previous prototype for function 'arch_release_task_struct' [-Wmissing-prototypes] void __weak arch_release_task_struct(struct task_struct *tsk) ^ kernel/fork.c:162:1: note: declare 'static' if the function is not intended to be used outside of this translation unit void __weak arch_release_task_struct(struct task_struct *tsk) ^ static kernel/fork.c:849:20: warning: no previous prototype for function 'arch_task_cache_init' [-Wmissing-prototypes] void __init __weak arch_task_cache_init(void) { } ^ kernel/fork.c:849:1: note: declare 'static' if the function is not intended to be used outside of this translation unit void __init __weak arch_task_cache_init(void) { } ^ static 2 warnings and 3 errors generated. vim +26 arch/riscv/include/asm/stackprotector.h f2c9699f65557a Guo Ren 2020-07-10 10 f2c9699f65557a Guo Ren 2020-07-10 11 /* f2c9699f65557a Guo Ren 2020-07-10 12 * Initialize the stackprotector canary value. f2c9699f65557a Guo Ren 2020-07-10 13 * f2c9699f65557a Guo Ren 2020-07-10 14 * NOTE: this must only be called from functions that never return, f2c9699f65557a Guo Ren 2020-07-10 15 * and it must always be inlined. f2c9699f65557a Guo Ren 2020-07-10 16 */ f2c9699f65557a Guo Ren 2020-07-10 17 static __always_inline void boot_init_stack_canary(void) f2c9699f65557a Guo Ren 2020-07-10 18 { f2c9699f65557a Guo Ren 2020-07-10 19 unsigned long canary; f2c9699f65557a Guo Ren 2020-07-10 20 f2c9699f65557a Guo Ren 2020-07-10 21 /* Try to get a semi random initial value. */ f2c9699f65557a Guo Ren 2020-07-10 22 get_random_bytes(&canary, sizeof(canary)); f2c9699f65557a Guo Ren 2020-07-10 23 canary ^= LINUX_VERSION_CODE; f2c9699f65557a Guo Ren 2020-07-10 24 canary &= CANARY_MASK; f2c9699f65557a Guo Ren 2020-07-10 25 f2c9699f65557a Guo Ren 2020-07-10 @26 current->stack_canary = canary; :::::: The code at line 26 was first introduced by commit :::::: f2c9699f65557a31fed4ddb9e5b4d9489b1bf32f riscv: Add STACKPROTECTOR supported :::::: TO: Guo Ren :::::: CC: Palmer Dabbelt -- 0-DAY CI Kernel Test Service https://01.org/lkp