Re: [PATCH v2] RFC: ARM: breakpoint: CFI breakpoints only on demand
From: Linus Walleij
Date: Fri Jul 03 2026 - 08:00:07 EST
On Fri, Jul 3, 2026 at 10:59 AM Mark Rutland <mark.rutland@xxxxxxx> wrote:
> AFAICT, hw_breakpoint_cfi_handler() is only intended to handle
> BKPT instructions executed in kernel mode, and even when the kernel is
> build with CF support, it doesn't make sense to call that for BKPT
> instructions executed in user mode.
>
> On arm64, we have separate paths for BRK exceptions from user mode
> (do_el0_brk64()) and kernel mode (do_el1_brk64()).
>
> Surely you can check kernel_mode(regs) or user_mode(regs) to distinguish
> the two cases, and only call hw_breakpoint_cfi_handler() when the
> exception was taken from kernel mode?
You're right of course... I'll add a check like that and see if this
solves the problem for the reporter.
Yours,
Linus Walleij