* [PATCH] arm64: ptrace: don't warn on missing siginfo in a group-stop
@ 2026-10-16 2:45 Zhao Gongyi
2026-10-16 6:44 ` Oleg Nesterov
0 siblings, 1 reply; 2+ messages in thread
From: Zhao Gongyi @ 2026-10-16 2:45 UTC (permalink / raw)
To: catalin.marinas, will
Cc: mark.rutland, oleg, ruanjinjie, linux-arm-kernel, linux-kernel,
Zhao Gongyi, stable
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 <zhaogongyi@bytedance.com>
---
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)
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] arm64: ptrace: don't warn on missing siginfo in a group-stop
2026-10-16 2:45 [PATCH] arm64: ptrace: don't warn on missing siginfo in a group-stop Zhao Gongyi
@ 2026-10-16 6:44 ` Oleg Nesterov
0 siblings, 0 replies; 2+ messages in thread
From: Oleg Nesterov @ 2026-10-16 6:44 UTC (permalink / raw)
To: Zhao Gongyi
Cc: catalin.marinas, will, mark.rutland, ruanjinjie, linux-arm-kernel,
linux-kernel, stable
On 10/16, Zhao Gongyi wrote:
>
> --- 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;
> + }
Perhaps we can simply remove this WARN_ON_ONCE?
Oleg.
--- x/arch/arm64/kernel/ptrace.c
+++ x/arch/arm64/kernel/ptrace.c
@@ -573,10 +573,6 @@ static void update_syscall_orig_x0_after
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
* 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 == (SIGTRAP | 0x80) &&
target->ptrace_message == PTRACE_EVENTMSG_SYSCALL_EXIT) {
return;
}
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-10-16 6:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-16 2:45 [PATCH] arm64: ptrace: don't warn on missing siginfo in a group-stop Zhao Gongyi
2026-10-16 6:44 ` Oleg Nesterov
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.