[PATCH v3 11/13] arm64: debug: split brk64 exception entry
Mark Rutland
mark.rutland at arm.com
Wed Jun 18 10:00:28 PDT 2025
This generally looks good;
On Mon, Jun 09, 2025 at 06:34:11PM +0100, Ada Couprie Diaz wrote:
> +static int brk_handler(unsigned long esr, struct pt_regs *regs)
> {
> if (call_break_hook(regs, esr) == DBG_HOOK_HANDLED)
> return 0;
> @@ -279,6 +278,14 @@ static int brk_handler(unsigned long unused, unsigned long esr,
> }
> NOKPROBE_SYMBOL(brk_handler);
>
> +void do_brk64(unsigned long esr, struct pt_regs *regs)
> +{
> + if (brk_handler(esr, regs))
> + arm64_notify_die("BRK handler", regs, SIGTRAP, TRAP_BRKPT, regs->pc,
> + esr);
> +}
> +NOKPROBE_SYMBOL(do_brk64);
Could we please split this into separate do_el{0,1}_brk64() helpers?
e.g. rename call_break_hook() to call_el1_break_hook(), remove
brk_handler(), and have:
| void do_el0_brk64(struct pt_regs *regs, unsigned long esr)
| {
| if (IS_ENABLED(CONFIG_UPROBES) &&
| esr_brk_comment(esr) == UPROBES_BRK_IMM &&
| uprobe_brk_handler(regs, esr) == DBG_HOOK_HANDLED)
| return;
|
| send_user_sigtrap(TRAP_BRKPT);
| }
|
| void do_el1_brk64(unsigned long esr, struct pt_regs *regs)
| {
| if (call_el1_break_hook(regs, esr) == DBG_HOOK_HANDLED)
| return;
|
| pr_warn("Unexpected kernel BRK exception at EL1\n");
| arm64_notify_die("BRK handler", regs, SIGTRAP, TRAP_BRKPT, regs->pc,
| esr);
| }
| NOKPROBE_SYMBOL(do_brk64);
... and we could probably simplify the latter to:
| void do_el1_brk64(unsigned long esr, struct pt_regs *regs)
| {
| if (call_el1_break_hook(regs, esr) == DBG_HOOK_HANDLED)
| return;
|
| die("Oops - BRK", regs, esr);
| }
| NOKPROBE_SYMBOL(do_brk64);
... matching do_el1_undef() and do_el1_bti().
Mark.
More information about the linux-arm-kernel
mailing list