Re: [PATCH v2 1/2] ptrace: PTRACE_SET_SYSCALL_INFO syscall skipping support
From: Oleg Nesterov
Date: Sun Jul 12 2026 - 17:28:10 EST
On 07/10, Thomas Bogendoerfer wrote:
>
> On Tue, Jul 07, 2026 at 06:04:56PM +0200, Oleg Nesterov wrote:
> >
> > Agreed, it is not that I think it won't... but it would be nice to have an ACK
> > from arch/mips maintainers. syscall_trace_enter() is called from MIPS asm code
> > which I obviously can't understand.
>
> current code works for SECCOMP and with below untested change it should
> work for PTRACE_SYSCALL, too.
Thanks!
Obviously, I can't know if this patch is correct. I can't even understand
why syscall_trace_enter() has to do syscall_set_return_value(ENOSYS) because
I don't understand the mips asm callers.
But I agree, this should fix the problems we discussed in this thread.
Thank you,
Oleg.
> Thomas.
>
> diff --git a/arch/mips/kernel/ptrace.c b/arch/mips/kernel/ptrace.c
> index 3f4c94c88124..87102a03b6ea 100644
> --- a/arch/mips/kernel/ptrace.c
> +++ b/arch/mips/kernel/ptrace.c
> @@ -1321,8 +1321,12 @@ long arch_ptrace(struct task_struct *child, long request,
> */
> asmlinkage long syscall_trace_enter(struct pt_regs *regs)
> {
> + long syscall;
> +
> user_exit();
>
> + syscall = current_thread_info()->syscall;
> +
> if (test_thread_flag(TIF_SYSCALL_TRACE)) {
> if (ptrace_report_syscall_entry(regs))
> return -1;
> @@ -1342,7 +1346,7 @@ asmlinkage long syscall_trace_enter(struct pt_regs *regs)
> * Negative syscall numbers are mistaken for rejected syscalls, but
> * won't have had the return value set appropriately, so we do so now.
> */
> - if (current_thread_info()->syscall < 0)
> + if (syscall < 0)
> syscall_set_return_value(current, regs, -ENOSYS, 0);
> return current_thread_info()->syscall;
> }
>
> --
> Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
> good idea. [ RFC1925, 2.3 ]
>