Skip to content

Commit 7ae1163

Browse files
xhackerustcpalmer-dabbelt
authored andcommitted
riscv: keep interrupts disabled for BREAKPOINT exception
Current riscv's kprobe handlers are run with both preemption and interrupt enabled, this violates kprobe requirements. Fix this issue by keeping interrupts disabled for BREAKPOINT exception. Fixes: c22b0bc ("riscv: Add kprobes supported") Cc: stable@vger.kernel.org Signed-off-by: Jisheng Zhang <jszhang@kernel.org> Reviewed-by: Masami Hiramatsu <mhiramat@kernel.org> [Palmer: add a comment] Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
1 parent e31be8d commit 7ae1163

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

arch/riscv/kernel/entry.S

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,9 @@ skip_context_tracking:
130130
*/
131131
andi t0, s1, SR_PIE
132132
beqz t0, 1f
133+
/* kprobes, entered via ebreak, must have interrupts disabled. */
134+
li t0, EXC_BREAKPOINT
135+
beq s4, t0, 1f
133136
#ifdef CONFIG_TRACE_IRQFLAGS
134137
call trace_hardirqs_on
135138
#endif

0 commit comments

Comments
 (0)