PTRACE_ATTACH to a group-stopped child can enter do_jobctl_trap(), which calls ptrace_stop() without siginfo. PTRACE_GETSIGINFO then returns -EINVAL, as expected. If the tracer writes NT_ARM_SYSTEM_CALL, system_call_set() stores the new syscallno before calling update_syscall_orig_x0_after_ptrace(). Its NO_SYSCALL guard no longer applies, so WARN_ON_ONCE(!info) fires. A tracer can trigger this on its own child. do_jobctl_trap() omits siginfo only for non-seized group-stops. Seized, syscall-entry and seccomp stops supply it. Skip orig_x0 synchronization for the non-seized group-stop: el0_svc_common() sets orig_x0 on the next system call. Keep the warning if a seized stop unexpectedly lacks siginfo. Fixes: 88b839ce497c ("arm64: ptrace: Keep 'orig_x0' in-sync with x0 on syscall entry") Cc: stable@vger.kernel.org Signed-off-by: Zhao Gongyi --- Tested on arm64 KVM at af32da41b032. The unpatched kernel reproduced the WARN. An initial fix that returned on every missing siginfo ran without warnings. The final fix was built on the same test baseline. At a group-stop, PTRACE_GETSIGINFO returned -EINVAL and an NT_ARM_SYSTEM_CALL write succeeded without a warning. An ordinary PTRACE_SYSCALL entry/exit round trip completed normally. Changing x0 at syscall-entry and seccomp stops produced the expected exit status. No kernel warnings occurred. arch/arm64/kernel/ptrace.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c index f743cbec1..e12b04b8f 100644 --- a/arch/arm64/kernel/ptrace.c +++ b/arch/arm64/kernel/ptrace.c @@ -573,9 +573,11 @@ static void update_syscall_orig_x0_after_ptrace(struct task_struct *target) if (regs->syscallno == NO_SYSCALL) return; - /* We should only be called when target is in a ptrace stop */ - if (WARN_ON_ONCE(!info)) + /* Only non-seized group-stops lack siginfo (see do_jobctl_trap()). */ + if (!info) { + WARN_ON_ONCE(target->ptrace & PT_SEIZED); return; + } /* * For compat tasks, orig_r0 is provided directly through GPR index base-commit: 24a19b953e2a3d0ea5a8c4951a0ab8f32720c907 -- 2.39.5 (Apple Git-154)