From: "Zhao Gongyi" <zhaogongyi@bytedance.com>
To: "Oleg Nesterov" <oleg@redhat.com>
Cc: <catalin.marinas@arm.com>, <will@kernel.org>,
<mark.rutland@arm.com>, <ruanjinjie@huawei.com>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>, <stable@vger.kernel.org>
Subject: Re: [PATCH] arm64: ptrace: don't warn on missing siginfo in a group-stop
Date: Mon, 19 Oct 2026 10:35:44 +0800 [thread overview]
Message-ID: <b80c0fd0-498b-4c6c-93df-acee59d2be85@bytedance.com> (raw)
In-Reply-To: <atHHttWKtnKHJnVQ@redhat.com>
On 10/16/26 2:44 PM, Oleg Nesterov wrote:
> 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;
> }
Hi Oleg,
Thanks. I agree that we can remove WARN_ON_ONCE() and allow the
orig_x0 update when last_siginfo is NULL.
I tested syscall-exit-stops on an arm64 7.3.0-rc6-syz kernel with and
without PTRACE_O_TRACESYSGOOD. In both cases, ptrace_message was
PTRACE_EVENTMSG_SYSCALL_EXIT, and an NT_PRSTATUS write succeeded.
The observed si_code values were:
without PTRACE_O_TRACESYSGOOD: SIGTRAP (5)
with PTRACE_O_TRACESYSGOOD: SIGTRAP | 0x80 (133)
There were no kernel warnings. With the proposed equality check, the
syscall-exit-stop without PTRACE_O_TRACESYSGOOD would fall through and
update orig_x0 from x0, which contains the syscall return value at
that stop.
I think we should retain the check for both si_code values, while
guarding the dereference:
if (info && (info->si_code & ~0x80) == SIGTRAP &&
target->ptrace_message == PTRACE_EVENTMSG_SYSCALL_EXIT)
return;
I'll send a revised patch with the warning removed and this condition.
Thanks,
Gongyi
prev parent reply other threads:[~2026-10-19 2:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-16 2:45 Zhao Gongyi
2026-10-16 6:44 ` Oleg Nesterov
2026-10-19 2:35 ` Zhao Gongyi [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b80c0fd0-498b-4c6c-93df-acee59d2be85@bytedance.com \
--to=zhaogongyi@bytedance.com \
--cc=catalin.marinas@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=oleg@redhat.com \
--cc=ruanjinjie@huawei.com \
--cc=stable@vger.kernel.org \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®