mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v3] arm64: ptrace: don't warn on missing siginfo in a group-stop
@ 2026-11-05 11:30 Zhao Gongyi
  2026-11-08 18:59 ` Oleg Nesterov
  0 siblings, 1 reply; 2+ messages in thread
From: Zhao Gongyi @ 2026-11-05 11:30 UTC (permalink / raw)
  To: catalin.marinas, will
  Cc: mark.rutland, oleg, ruanjinjie, linux-arm-kernel, linux-kernel,
	Zhao Gongyi

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 update_syscall_orig_x0_after_ptrace() checks
last_siginfo. WARN_ON_ONCE(!info) then fires for a valid ptrace stop.

Keep the early return when siginfo is absent, but remove the warning.
This leaves orig_x0 untouched at a non-seized group-stop and preserves
the existing syscall-exit-stop handling.

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>
---
Changes since v2:
- Keep the early return on missing siginfo, as requested by Will.
- Remove v2's NULL guard on the syscall-exit-stop check, which is no
  longer needed after the early return.
- Update the comment to describe the non-seized group-stop case.

v2: https://lore.kernel.org/r/20261023110710.10145-1-zhaogongyi@bytedance.com

A local early-return variant was exercised on arm64 KVM with a non-seized
PTRACE_ATTACH group-stop and an NT_ARM_SYSTEM_CALL write. The write
succeeded without a kernel warning. Additional signal-handling probes
compared this behavior with v2; neither kernel reported a warning,
BUG, KASAN issue, or panic.
 arch/arm64/kernel/ptrace.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c
index f743cbe..ecaa09b 100644
--- a/arch/arm64/kernel/ptrace.c
+++ b/arch/arm64/kernel/ptrace.c
@@ -573,8 +573,8 @@ 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))
+	/* Non-seized group-stops do not provide siginfo (see do_jobctl_trap()). */
+	if (!info)
 		return;
 
 	/*

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-08 18:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-05 11:30 [PATCH v3] arm64: ptrace: don't warn on missing siginfo in a group-stop Zhao Gongyi
2026-11-08 18:59 ` Oleg Nesterov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®