mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jinjie Ruan <ruanjinjie@huawei.com>
To: Catalin Marinas <catalin.marinas@arm.com>,
	Zhao Gongyi <zhaogongyi@bytedance.com>
Cc: <will@kernel.org>, <mark.rutland@arm.com>, <oleg@redhat.com>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] arm64: ptrace: don't warn on missing siginfo in a group-stop
Date: Mon, 2 Nov 2026 15:54:07 +0800	[thread overview]
Message-ID: <d8aced38-fb7a-4359-b3ab-c625faae5023@huawei.com> (raw)
In-Reply-To: <at-czRUYRPRxi9dy@arm.com>



在 2026/10/27 2:32, Catalin Marinas 写道:
> On Fri, Oct 23, 2026 at 07:07:10PM +0800, Zhao Gongyi wrote:
>> 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@vger.kernel.org
>> Signed-off-by: Zhao Gongyi <zhaogongyi@bytedance.com>
>> ---
>> 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@bytedance.com
>>
>> 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;
> 
> That's a slight semantic change since this function may now update
> orig_x0 even when !info. However, I think it makes more sense as the aim
> of commit 88b839ce497c ("arm64: ptrace: Keep 'orig_x0' in-sync with x0
> on syscall entry") was to update orig_x0 in all cases other than
> syscall-exit-stop. We can't have the latter with !info.

I think maybe we can refer to ptrace_get_syscall_info_op()?

> 
> I'll wait for a couple of days to see if Will has any comments and queue
> it.
> 
> Thanks.
> 

-- 
Best regards,
Jinjie


  parent reply	other threads:[~2026-11-02  7:54 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-23 11:07 Zhao Gongyi
2026-10-23 13:24 ` Oleg Nesterov
2026-10-24 14:50   ` Zhao Gongyi
2026-10-24 15:09     ` Oleg Nesterov
2026-10-26 18:32 ` Catalin Marinas
2026-11-02  7:42   ` Jinjie Ruan
2026-11-02  7:54   ` Jinjie Ruan [this message]
2026-11-02  8:45     ` Zhao Gongyi
2026-11-02 11:31       ` Oleg Nesterov

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=d8aced38-fb7a-4359-b3ab-c625faae5023@huawei.com \
    --to=ruanjinjie@huawei.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=will@kernel.org \
    --cc=zhaogongyi@bytedance.com \
    /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®