All of lore.kernel.org
 help / color / mirror / Atom feed
* [mark:randomize-kstack-siphash 1/1] arch/riscv/kernel/traps.c:340:17: error: implicit declaration of function 'add_random_kstack_offset'
@ 2025-11-25 13:53 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2025-11-25 13:53 UTC (permalink / raw)
  To: Mark Rutland; +Cc: oe-kbuild-all

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.git randomize-kstack-siphash
head:   0783912db6e30339d55a5dc7eb6a696b440bedb3
commit: 0783912db6e30339d55a5dc7eb6a696b440bedb3 [1/1] HACK: use siphash to generate kstack offset per-task
config: riscv-allnoconfig (https://download.01.org/0day-ci/archive/20251125/202511252102.k102Y7ED-lkp@intel.com/config)
compiler: riscv64-linux-gcc (GCC) 15.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251125/202511252102.k102Y7ED-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202511252102.k102Y7ED-lkp@intel.com/

All errors (new ones prefixed by >>):

   arch/riscv/kernel/traps.c: In function 'do_trap_ecall_u':
>> arch/riscv/kernel/traps.c:340:17: error: implicit declaration of function 'add_random_kstack_offset' [-Wimplicit-function-declaration]
     340 |                 add_random_kstack_offset();
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~
>> arch/riscv/kernel/traps.c:355:17: error: implicit declaration of function 'choose_random_kstack_offset' [-Wimplicit-function-declaration]
     355 |                 choose_random_kstack_offset(get_random_u16());
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~

Kconfig warnings: (for reference only)
   WARNING: unmet direct dependencies detected for ARCH_HAS_ELF_CORE_EFLAGS
   Depends on [n]: BINFMT_ELF [=n] && ELF_CORE [=y]
   Selected by [y]:
   - RISCV [=y]


vim +/add_random_kstack_offset +340 arch/riscv/kernel/traps.c

f0bddf50586da8 Guo Ren     2023-02-21  325  
05d450aabd7386 Song Shuai  2023-11-09  326  asmlinkage __visible __trap_section  __no_stack_protector
05d450aabd7386 Song Shuai  2023-11-09  327  void do_trap_ecall_u(struct pt_regs *regs)
f0bddf50586da8 Guo Ren     2023-02-21  328  {
f0bddf50586da8 Guo Ren     2023-02-21  329  	if (user_mode(regs)) {
52449c17bdd154 Celeste Liu 2023-08-01  330  		long syscall = regs->a7;
f0bddf50586da8 Guo Ren     2023-02-21  331  
f0bddf50586da8 Guo Ren     2023-02-21  332  		regs->epc += 4;
f0bddf50586da8 Guo Ren     2023-02-21  333  		regs->orig_a0 = regs->a0;
61119394631f21 Celeste Liu 2024-06-27  334  		regs->a0 = -ENOSYS;
f0bddf50586da8 Guo Ren     2023-02-21  335  
9657e9b7d2538d Björn Töpel 2023-06-29  336  		riscv_v_vstate_discard(regs);
9657e9b7d2538d Björn Töpel 2023-06-29  337  
9c2598d43510ef Björn Töpel 2023-04-03  338  		syscall = syscall_enter_from_user_mode(regs, syscall);
9c2598d43510ef Björn Töpel 2023-04-03  339  
05d450aabd7386 Song Shuai  2023-11-09 @340  		add_random_kstack_offset();
05d450aabd7386 Song Shuai  2023-11-09  341  
52449c17bdd154 Celeste Liu 2023-08-01  342  		if (syscall >= 0 && syscall < NR_syscalls)
f0bddf50586da8 Guo Ren     2023-02-21  343  			syscall_handler(regs, syscall);
61119394631f21 Celeste Liu 2024-06-27  344  
05d450aabd7386 Song Shuai  2023-11-09  345  		/*
05d450aabd7386 Song Shuai  2023-11-09  346  		 * Ultimately, this value will get limited by KSTACK_OFFSET_MAX(),
05d450aabd7386 Song Shuai  2023-11-09  347  		 * so the maximum stack offset is 1k bytes (10 bits).
05d450aabd7386 Song Shuai  2023-11-09  348  		 *
05d450aabd7386 Song Shuai  2023-11-09  349  		 * The actual entropy will be further reduced by the compiler when
05d450aabd7386 Song Shuai  2023-11-09  350  		 * applying stack alignment constraints: 16-byte (i.e. 4-bit) aligned
05d450aabd7386 Song Shuai  2023-11-09  351  		 * for RV32I or RV64I.
05d450aabd7386 Song Shuai  2023-11-09  352  		 *
05d450aabd7386 Song Shuai  2023-11-09  353  		 * The resulting 6 bits of entropy is seen in SP[9:4].
05d450aabd7386 Song Shuai  2023-11-09  354  		 */
05d450aabd7386 Song Shuai  2023-11-09 @355  		choose_random_kstack_offset(get_random_u16());
f0bddf50586da8 Guo Ren     2023-02-21  356  
f0bddf50586da8 Guo Ren     2023-02-21  357  		syscall_exit_to_user_mode(regs);
f0bddf50586da8 Guo Ren     2023-02-21  358  	} else {
f0bddf50586da8 Guo Ren     2023-02-21  359  		irqentry_state_t state = irqentry_nmi_enter(regs);
f0bddf50586da8 Guo Ren     2023-02-21  360  
f0bddf50586da8 Guo Ren     2023-02-21  361  		do_trap_error(regs, SIGILL, ILL_ILLTRP, regs->epc,
f0bddf50586da8 Guo Ren     2023-02-21  362  			"Oops - environment call from U-mode");
f0bddf50586da8 Guo Ren     2023-02-21  363  
f0bddf50586da8 Guo Ren     2023-02-21  364  		irqentry_nmi_exit(regs, state);
f0bddf50586da8 Guo Ren     2023-02-21  365  	}
f0bddf50586da8 Guo Ren     2023-02-21  366  

:::::: The code at line 340 was first introduced by commit
:::::: 05d450aabd7386246c5aafc341fe9febe5855967 riscv: Support RANDOMIZE_KSTACK_OFFSET

:::::: TO: Song Shuai <songshuaishuai@tinylab.org>
:::::: CC: Palmer Dabbelt <palmer@rivosinc.com>

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-11-25 13:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-25 13:53 [mark:randomize-kstack-siphash 1/1] arch/riscv/kernel/traps.c:340:17: error: implicit declaration of function 'add_random_kstack_offset' kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.