[PATCH v2] arm64: ptrace: don't warn on missing siginfo in a group-stop

From: Zhao Gongyi

Date: Fri Oct 23 2026 - 07:12:23 EST


PTRACE_ATTACH to a group-stopped child can enter do_jobctl_trap(),
which calls ptrace_stop() without siginfo. If the tracer writes
NT_ARM_SYSTEM_CALL, system_call_set() can change syscallno from
NO_SYSCALL before calling update_syscall_orig_x0_after_ptrace(). The
WARN_ON_ONCE(!info) then fires, although this is a valid ptrace stop.

Remove the warning and guard the syscall-exit-stop check against a
missing siginfo. Keep recognizing both SIGTRAP and SIGTRAP | 0x80:
syscall-exit-stops use either value depending on whether the tracer
enabled PTRACE_O_TRACESYSGOOD. With no siginfo, allow the final
assignment to synchronize orig_x0 from x0.

Fixes: 88b839ce497c ("arm64: ptrace: Keep 'orig_x0' in-sync with x0 on syscall entry")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Zhao Gongyi <zhaogongyi@xxxxxxxxxxxxx>
---
Changes since v1:
- Remove the warning and early return, as suggested by Oleg.
- Keep recognizing syscall-exit-stops with or without PTRACE_O_TRACESYSGOOD.

v1: https://lore.kernel.org/r/20261016024536.18938-1-zhaogongyi@xxxxxxxxxxxxx

Tested on arm64 KVM at af32da41b032 with this v2 applied.
At a group-stop, PTRACE_GETSIGINFO returned -EINVAL and an
NT_ARM_SYSTEM_CALL write succeeded. Syscall-entry and seccomp
x0 rewrites worked. At syscall-exit-stops, NT_PRSTATUS writes succeeded
with and without PTRACE_O_TRACESYSGOOD (si_code 133 and 5,
respectively). No kernel warnings occurred.

arch/arm64/kernel/ptrace.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c
index f743cbec1..22fb9eeed 100644
--- a/arch/arm64/kernel/ptrace.c
+++ b/arch/arm64/kernel/ptrace.c
@@ -573,10 +573,6 @@ 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))
- return;
-
/*
* For compat tasks, orig_r0 is provided directly through GPR index
* 17.
@@ -588,7 +584,7 @@ static void update_syscall_orig_x0_after_ptrace(struct task_struct *target)
* Don't update orig_x0 for a syscall-exit-stop, as x0 now contains the
* return value of the system call.
*/
- if ((info->si_code & ~0x80) == SIGTRAP &&
+ if (info && (info->si_code & ~0x80) == SIGTRAP &&
target->ptrace_message == PTRACE_EVENTMSG_SYSCALL_EXIT) {
return;
}

base-commit: 24a19b953e2a3d0ea5a8c4951a0ab8f32720c907
--
2.39.5 (Apple Git-154)