[PATCH 07/11] arm64: debug: split single stepping exception entry

Ada Couprie Diaz ada.coupriediaz at arm.com
Thu May 1 04:36:40 PDT 2025


On 25/04/2025 16:36, Ada Couprie Diaz wrote:

> +static void noinstr el0_softstp(struct pt_regs *regs, unsigned long esr)
> +{
> +	enter_from_user_mode(regs);
> +	debug_exception_enter(regs);
> +	do_softstep(esr, regs);

I spent some time digging into the preemptibility of this, specifically 
to be able to fix the reported issue with PREEMPT_RT [1].

 From EL0, the only possible path for the single stepping exception is 
to call `uprobe_singlestep_handler()`, which only operates on the 
task-local uprobe state with proper checks in place and raises a Thread 
Information Flag. The uprobe TIF is processed before returning to 
userspace in `do_notify_resume()`, which is already preemptible. The 
shared uprobe state contained in `current->active_uprobe` is created by 
the preceding BRK and reference counted. It is only cleared when the 
uprobe single stepping is processed.

Thus I feel it should be safe to enable preemption for this exception 
from EL0 in v2, combined with my other comment moving the BP hardening 
to `el0_softstp`. From testing, it seems to fix the reported issue with 
PREEMPT_RT [1].

> +	debug_exception_exit(regs);
> +	local_daif_restore(DAIF_PROCCTX);
> +	exit_to_user_mode(regs);
> +}
> +
[1]: https://lore.kernel.org/linux-arm-kernel/Z6YW_Kx4S2tmj2BP@uudg.org/



More information about the linux-arm-kernel mailing list