From: kernel test robot <lkp@intel.com>
To: Mark Rutland <mark.rutland@arm.com>
Cc: oe-kbuild-all@lists.linux.dev
Subject: [mark:randomize-kstack-siphash 1/1] arch/riscv/kernel/traps.c:340:17: error: implicit declaration of function 'add_random_kstack_offset'
Date: Tue, 25 Nov 2025 21:53:11 +0800 [thread overview]
Message-ID: <202511252102.k102Y7ED-lkp@intel.com> (raw)
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
reply other threads:[~2025-11-25 13:53 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202511252102.k102Y7ED-lkp@intel.com \
--to=lkp@intel.com \
--cc=mark.rutland@arm.com \
--cc=oe-kbuild-all@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.