Re: [PATCH] riscv: entry: Fixup do_trap_break from kernel side

From: Kees Cook

Date: Fri Jun 19 2026 - 19:54:59 EST


*thread encromancy*

On Sat, Jul 01, 2023 at 10:57:07PM -0400, guoren@xxxxxxxxxx wrote:
> From: Guo Ren <guoren@xxxxxxxxxxxxxxxxx>
>
> The irqentry_nmi_enter/exit would force the current context into in_interrupt.
> That would trigger the kernel to dead panic, but the kdb still needs "ebreak" to
> debug the kernel.
>
> Move irqentry_nmi_enter/exit to exception_enter/exit could correct handle_break
> of the kernel side.
>
> Before the fixup:
> $echo BUG > /sys/kernel/debug/provoke-crash/DIRECT
> lkdtm: Performing direct entry BUG
> ------------[ cut here ]------------
> kernel BUG at drivers/misc/lkdtm/bugs.c:78!
> [...]
> Kernel panic - not syncing: Aiee, killing interrupt handler!

This appears to still be unfixed. What's the blocker? The solutions in
this thread seem to work...

I'd like to be exercising an Oops path via KUnit (for KCFI), and riscv
just instantly falls over instead of thread-killing on the exception.

Thanks!

-Kees

--
Kees Cook