All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: Renzo Davoli <renzo@cs.unibo.it>,
	linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Shuah Khan <shuah@kernel.org>, Alexey Gladkov <legion@kernel.org>,
	Eugene Syromyatnikov <evgsyr@gmail.com>,
	Davide Berardi <berardi.dav@gmail.com>,
	strace-devel@lists.strace.io, "Dmitry V . Levin" <ldv@strace.io>,
	"open list:MIPS" <linux-mips@vger.kernel.org>
Subject: Re: [PATCH v2 1/2] ptrace: PTRACE_SET_SYSCALL_INFO syscall skipping support
Date: Sun, 12 Jul 2026 23:27:45 +0200	[thread overview]
Message-ID: <alQG0c8eGNi8nLvo@redhat.com> (raw)
In-Reply-To: <alDm5TUIIlGLSRdn@alpha.franken.de>

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 ]
> 


  reply	other threads:[~2026-07-12 21:28 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-04 14:26 [PATCH v2 0/2] ptrace_set_syscall_info: add support for seccomp syscall skipping Renzo Davoli
2026-07-04 14:26 ` [PATCH v2 1/2] ptrace: PTRACE_SET_SYSCALL_INFO syscall skipping support Renzo Davoli
2026-07-05  6:41   ` Renzo Davoli
2026-07-05 14:38     ` Oleg Nesterov
2026-07-07 14:27       ` Renzo Davoli
2026-07-07 16:04         ` Oleg Nesterov
2026-07-07 16:09           ` Thomas Bogendoerfer
2026-07-10 12:34           ` Thomas Bogendoerfer
2026-07-12 21:27             ` Oleg Nesterov [this message]
2026-07-06 16:03     ` Dmitry V. Levin
2026-07-04 14:26 ` [PATCH v2 2/2] selftests/ptrace: add a test case for PTRACE_SYSCALL_INFO syscall skipping Renzo Davoli

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=alQG0c8eGNi8nLvo@redhat.com \
    --to=oleg@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=berardi.dav@gmail.com \
    --cc=evgsyr@gmail.com \
    --cc=ldv@strace.io \
    --cc=legion@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=renzo@cs.unibo.it \
    --cc=shuah@kernel.org \
    --cc=strace-devel@lists.strace.io \
    --cc=tsbogend@alpha.franken.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.