mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] arm64: ptrace: don't warn on missing siginfo in a group-stop
@ 2026-10-23 11:07 Zhao Gongyi
  2026-10-23 13:24 ` Oleg Nesterov
  2026-10-26 18:32 ` Catalin Marinas
  0 siblings, 2 replies; 9+ messages in thread
From: Zhao Gongyi @ 2026-10-23 11:07 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 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;
-
 	/*
 	 * 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)

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

* Re: [PATCH v2] arm64: ptrace: don't warn on missing siginfo in a group-stop
  2026-10-23 11:07 [PATCH v2] arm64: ptrace: don't warn on missing siginfo in a group-stop Zhao Gongyi
@ 2026-10-23 13:24 ` Oleg Nesterov
  2026-10-24 14:50   ` Zhao Gongyi
  2026-10-26 18:32 ` Catalin Marinas
  1 sibling, 1 reply; 9+ messages in thread
From: Oleg Nesterov @ 2026-10-23 13:24 UTC (permalink / raw)
  To: Zhao Gongyi
  Cc: catalin.marinas, will, mark.rutland, ruanjinjie,
	linux-arm-kernel, linux-kernel

On 10/23, Zhao Gongyi wrote:
>
> --- 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;

LGTM, but I don't understand this arm-specific code.

And... Do we need to check target->last_siginfo at all?

ptrace_signal() -> ptrace_stop() path sets ->ptrace_message = 0.

In all other cases: if info != NULL, then .si_code == target->exit_code.
ptrace_event(event) users always use event != 0 and != 0x80.

So it seems that we can just do

	if ((target->exit_code & ~0x80) == SIGTRAP &&
	    target->ptrace_message == PTRACE_EVENTMSG_SYSCALL_EXIT)

?

I'll recheck... If I am right, perhaps it makes sense to simplify
ptrace_get_syscall_info_op().

Anyway, up to you.

Oleg.


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

* Re: [PATCH v2] arm64: ptrace: don't warn on missing siginfo in a group-stop
  2026-10-23 13:24 ` Oleg Nesterov
@ 2026-10-24 14:50   ` Zhao Gongyi
  2026-10-24 15:09     ` Oleg Nesterov
  0 siblings, 1 reply; 9+ messages in thread
From: Zhao Gongyi @ 2026-10-24 14:50 UTC (permalink / raw)
  To: Oleg Nesterov
  Cc: catalin.marinas, will, mark.rutland, ruanjinjie,
	linux-arm-kernel, linux-kernel

On 10/23/26 9:24 PM, Oleg Nesterov wrote:
> On 10/23, Zhao Gongyi wrote:
>>
>> --- 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;
> 
> LGTM, but I don't understand this arm-specific code.
> 
> And... Do we need to check target->last_siginfo at all?
> 
> ptrace_signal() -> ptrace_stop() path sets ->ptrace_message = 0.
> 
> In all other cases: if info != NULL, then .si_code == target->exit_code.
> ptrace_event(event) users always use event != 0 and != 0x80.
> 
> So it seems that we can just do
> 
> 	if ((target->exit_code & ~0x80) == SIGTRAP &&
> 	    target->ptrace_message == PTRACE_EVENTMSG_SYSCALL_EXIT)
> 
> ?
> 
> I'll recheck... If I am right, perhaps it makes sense to simplify
> ptrace_get_syscall_info_op().
> 

Hi Oleg,

Thanks for the review. I checked target->exit_code when the tracer calls 
PTRACE_SETREGSET after waitpid(). It
was 0 at syscall-exit-stops both with and without PTRACE_O_TRACESYSGOOD: 
wait_task_stopped() clears it when
reporting the stop. last_siginfo still held the corresponding si_code (5 
or 133).

I also used temporary kernel logging to check orig_x0 before and after 
writing a distinct value to x0 at each
stop. orig_x0 remained unchanged in both cases. Using exit_code in this 
condition would instead fall through
and copy the new x0 into orig_x0.

So I think we should keep the last_siginfo check in v2. The same 
exit_code lifetime also seems relevant to
ptrace_get_syscall_info_op() after waitpid().

Thanks,
Gongyi

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

* Re: [PATCH v2] arm64: ptrace: don't warn on missing siginfo in a group-stop
  2026-10-24 14:50   ` Zhao Gongyi
@ 2026-10-24 15:09     ` Oleg Nesterov
  0 siblings, 0 replies; 9+ messages in thread
From: Oleg Nesterov @ 2026-10-24 15:09 UTC (permalink / raw)
  To: Zhao Gongyi
  Cc: catalin.marinas, will, mark.rutland, ruanjinjie,
	linux-arm-kernel, linux-kernel

On 10/24, Zhao Gongyi wrote:
>
> On 10/23/26 9:24 PM, Oleg Nesterov wrote:
> >
> > So it seems that we can just do
> >
> > 	if ((target->exit_code & ~0x80) == SIGTRAP &&
> > 	    target->ptrace_message == PTRACE_EVENTMSG_SYSCALL_EXIT)
> >
> > ?
> >
> > I'll recheck... If I am right, perhaps it makes sense to simplify
> > ptrace_get_syscall_info_op().
> >
>
> Hi Oleg,
>
> Thanks for the review. I checked target->exit_code when the tracer calls
> PTRACE_SETREGSET after waitpid().

Aaaaah, I forgot that wait_task_stopped() obviously clears ->exit_code ;)

Zhao, sorry for noise and thanks for correcting me!

And let me repeat, you patch LGTM. But I don't think I can ACK it, I don't
understand this arm-specific code.

Thanks!

Oleg.


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

* Re: [PATCH v2] arm64: ptrace: don't warn on missing siginfo in a group-stop
  2026-10-23 11:07 [PATCH v2] arm64: ptrace: don't warn on missing siginfo in a group-stop Zhao Gongyi
  2026-10-23 13:24 ` Oleg Nesterov
@ 2026-10-26 18:32 ` Catalin Marinas
  2026-11-02  7:42   ` Jinjie Ruan
  2026-11-02  7:54   ` Jinjie Ruan
  1 sibling, 2 replies; 9+ messages in thread
From: Catalin Marinas @ 2026-10-26 18:32 UTC (permalink / raw)
  To: Zhao Gongyi
  Cc: will, mark.rutland, oleg, ruanjinjie, linux-arm-kernel, linux-kernel

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'll wait for a couple of days to see if Will has any comments and queue
it.

Thanks.

-- 
Catalin

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

* Re: [PATCH v2] arm64: ptrace: don't warn on missing siginfo in a group-stop
  2026-10-26 18:32 ` Catalin Marinas
@ 2026-11-02  7:42   ` Jinjie Ruan
  2026-11-02  7:54   ` Jinjie Ruan
  1 sibling, 0 replies; 9+ messages in thread
From: Jinjie Ruan @ 2026-11-02  7:42 UTC (permalink / raw)
  To: Catalin Marinas, Zhao Gongyi
  Cc: will, mark.rutland, oleg, linux-arm-kernel, linux-kernel



在 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 agree, our original intent was to avoid the return value contaminating
orig_x0 at syscall exit; apart from that case, it should be kept in sync.

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

-- 
Best regards,
Jinjie


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

* Re: [PATCH v2] arm64: ptrace: don't warn on missing siginfo in a group-stop
  2026-10-26 18:32 ` Catalin Marinas
  2026-11-02  7:42   ` Jinjie Ruan
@ 2026-11-02  7:54   ` Jinjie Ruan
  2026-11-02  8:45     ` Zhao Gongyi
  1 sibling, 1 reply; 9+ messages in thread
From: Jinjie Ruan @ 2026-11-02  7:54 UTC (permalink / raw)
  To: Catalin Marinas, Zhao Gongyi
  Cc: will, mark.rutland, oleg, linux-arm-kernel, linux-kernel



在 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


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

* Re: [PATCH v2] arm64: ptrace: don't warn on missing siginfo in a group-stop
  2026-11-02  7:54   ` Jinjie Ruan
@ 2026-11-02  8:45     ` Zhao Gongyi
  2026-11-02 11:31       ` Oleg Nesterov
  0 siblings, 1 reply; 9+ messages in thread
From: Zhao Gongyi @ 2026-11-02  8:45 UTC (permalink / raw)
  To: Jinjie Ruan, Catalin Marinas
  Cc: will, mark.rutland, oleg, linux-arm-kernel, linux-kernel

Hi Jinjie,


On 11/2/26 3:54 PM, Jinjie Ruan wrote:
> 
> I think maybe we can refer to ptrace_get_syscall_info_op()?
> 

Thanks for the suggestion.

I checked ptrace_get_syscall_info_op(). It is currently static to
kernel/ptrace.c and identifies a syscall stop only when
last_siginfo->si_code is SIGTRAP | 0x80.

The arm64 path here also needs to handle a syscall-exit-stop when the
tracer has not enabled PTRACE_O_TRACESYSGOOD. In that case, the tested
si_code is plain SIGTRAP. Reusing the current logic from
ptrace_get_syscall_info_op() would therefore fail to recognize that
syscall-exit-stop and could update orig_x0 from x0, which contains the
syscall return value at that point.

We could refactor the generic helper and consider recognizing plain
SIGTRAP there as well, but that would broaden this fix and potentially
change the behavior of PTRACE_GET_SYSCALL_INFO. For this patch, I think
the local check of last_siginfo, with bit 0x80 masked and ptrace_message 
checked for PTRACE_EVENTMSG_SYSCALL_EXIT, is the smaller and safer change.

Thanks,
Gongyi

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

* Re: [PATCH v2] arm64: ptrace: don't warn on missing siginfo in a group-stop
  2026-11-02  8:45     ` Zhao Gongyi
@ 2026-11-02 11:31       ` Oleg Nesterov
  0 siblings, 0 replies; 9+ messages in thread
From: Oleg Nesterov @ 2026-11-02 11:31 UTC (permalink / raw)
  To: Zhao Gongyi
  Cc: Jinjie Ruan, Catalin Marinas, will, mark.rutland,
	linux-arm-kernel, linux-kernel

On 11/02, Zhao Gongyi wrote:
>
> Hi Jinjie,
>
>
> On 11/2/26 3:54 PM, Jinjie Ruan wrote:
> >
> > I think maybe we can refer to ptrace_get_syscall_info_op()?
> >
>
> Thanks for the suggestion.
>
> I checked ptrace_get_syscall_info_op(). It is currently static to
> kernel/ptrace.c and identifies a syscall stop only when
> last_siginfo->si_code is SIGTRAP | 0x80.
>
> The arm64 path here also needs to handle a syscall-exit-stop when the
> tracer has not enabled PTRACE_O_TRACESYSGOOD. In that case, the tested

Yes, PTRACE_GET_SYSCALL_INFO/etc depends on PTRACE_O_TRACESYSGOOD
by design, this is even documented in man 2 ptrace.

> For this patch, I think
> the local check of last_siginfo, with bit 0x80 masked and ptrace_message
> checked for PTRACE_EVENTMSG_SYSCALL_EXIT, is the smaller and safer change.

Agreed.

Oleg.


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

end of thread, other threads:[~2026-11-02 11:31 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-23 11:07 [PATCH v2] arm64: ptrace: don't warn on missing siginfo in a group-stop 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
2026-11-02  8:45     ` Zhao Gongyi
2026-11-02 11:31       ` 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®