[PATCH] ARM: enable interrupts when arm_notify_die() is handling user mode errors

Xie Yuanbin xieyuanbin1 at huawei.com
Thu Jun 25 03:00:31 PDT 2026


On 2026-06-25 10:05:52 [+0100], Russell King wrote:
> > for this but actual breakpoint handling might be broken or is it 
> > just me? But then your stack trace looks like mine so :/
> 
> ARM Linux doesn't use BKPT. BKPT was an instruction introduced by Arm 
> Ltd in ARMv5TE. Prior to this, we use a UDF instruction instead (we 
> had to pick something!) and gdb and other tools use that as a 
> breapoint.
> 
> Moreover, BKPT isn't guaranteed to trap to the kernel, especially when 
> there is a hardware debugger connected. In that case, DDI0100E states 
> that use of BKPT must be according to the instructions provided with 
> the hardware debugger. This makes BKPT unsuitable for use.

When do_DataAbort()/do_PrefetchAbort() run into `inf->fn()`, and the
hook function return != 0 with interrupts disabled, the WARN may be
triggered. From the code perspective, there are countless possible
places, and "bkpt #0" is just one of these.

For example:
bcm5301x_init_early()->hook_fault_code(bcm5301x_abort_handler).
if CONFIG_ARCH_BCM_5301X=y, then bcm5301x_abort_handler() may return 1
without enabling the interrupts.
if CONFIG_ARCH_BCM_5301X=n, then in the same scenario it will run into
do_bad(), also return 1 without enabling the interrupts.

So I think maybe:
1. enable interrupts in all hook functions, maybe
   multiple points for modification.
2. enable interrupts in do_DataAbort()/do_PrefetchAbort() before
   `inf->fn()`, but harden_branch_predictor() may be difficult.
3. enable interrupts in do_DataAbort()/do_PrefetchAbort() after
   `inf->fn()`, this may be ok.

>From this perspective, arm_notify_die() also seems to be a good place?



More information about the linux-arm-kernel mailing list