Skip to content

Commit d0db02c

Browse files
guoren83palmer-dabbelt
authored andcommitted
riscv: entry: Add noinstr to prevent instrumentation inserted
Without noinstr the compiler is free to insert instrumentation (think all the k*SAN, KCov, GCov, ftrace etc..) which can call code we're not yet ready to run this early in the entry path, for instance it could rely on RCU which isn't on yet, or expect lockdep state. (by peterz) Link: https://lore.kernel.org/linux-riscv/YxcQ6NoPf3AH0EXe@hirez.programming.kicks-ass.net/ Reviewed-by: Björn Töpel <bjorn@rivosinc.com> Suggested-by: Peter Zijlstra <peterz@infradead.org> Tested-by: Jisheng Zhang <jszhang@kernel.org> Signed-off-by: Guo Ren <guoren@linux.alibaba.com> Signed-off-by: Guo Ren <guoren@kernel.org> Link: https://lore.kernel.org/r/20230222033021.983168-4-guoren@kernel.org Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
1 parent 8574bf8 commit d0db02c

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

arch/riscv/kernel/traps.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,9 @@ static void do_trap_error(struct pt_regs *regs, int signo, int code,
119119
}
120120

121121
#if defined(CONFIG_XIP_KERNEL) && defined(CONFIG_RISCV_ALTERNATIVE)
122-
#define __trap_section __section(".xip.traps")
122+
#define __trap_section __noinstr_section(".xip.traps")
123123
#else
124-
#define __trap_section
124+
#define __trap_section noinstr
125125
#endif
126126
#define DO_ERROR_INFO(name, signo, code, str) \
127127
asmlinkage __visible __trap_section void name(struct pt_regs *regs) \

0 commit comments

Comments
 (0)