From: "Dmitry V. Levin" <ldv@strace.io>
To: Oleg Nesterov <oleg@redhat.com>
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>,
Mike Frysinger <vapier@gentoo.org>,
Davide Berardi <berardi.dav@gmail.com>,
strace-devel@lists.strace.io
Subject: Re: [PATCH 1/5] ptrace: add PTRACE_SYSCALL_INFO_SECCOMP_SKIP
Date: Mon, 6 Jul 2026 17:16:40 +0300 [thread overview]
Message-ID: <20260706141640.GA5029@strace.io> (raw)
In-Reply-To: <akZL_ERDEeFkhG_Y@redhat.com>
On Thu, Jul 02, 2026 at 01:31:08PM +0200, Oleg Nesterov wrote:
> On 07/02, Dmitry V. Levin wrote:
> > On Thu, Jul 02, 2026 at 11:58:14AM +0200, Oleg Nesterov wrote:
> > [...]
> > > @@ -1047,6 +1069,11 @@ ptrace_set_syscall_info_entry(struct task_struct *child, struct pt_regs *regs,
> > > if (nr != info->entry.nr)
> > > return -ERANGE;
> > >
> > > + syscall_set_nr(child, regs, nr);
> > > + if (nr == -1)
> > > + return __set_syscall_info_exit(child, regs,
> > > + info->entry.rval, info->entry.is_error);
> >
> > The kernel shouldn't suddenly start interpreting info->entry.rval and
> > info->entry.is_error because the current users of this interface are not
> > aware that the kernel might be doing it. If we want to extend
> > PTRACE_SYSCALL_INFO_ENTRY/PTRACE_SYSCALL_INFO_SECCOMP this way, we would
> > have to require setting a flag in info->flags signalling the kernel that
> > the user requests this new behaviour.
>
> Ah. I forgot to mention that (obviously) this is a user-visible change,
> and a new flag in info->flags will be safer. Of course.
>
> Or we can define a special SKIP_AND_SET_RVAL value for info->entry.nr.
>
> But I am just curious, will this change (without new flag) actually break
> strace? What does strace do when it uses PTRACE_SYSCALL_INFO_ENTRY with
> info->entry.nr == -1?
When strace is used for syscall tampering, it first performs a quick
PTRACE_SET_SYSCALL_INFO runtime check - very similar to the test in
tools/testing/selftests/ptrace/set_syscall_info.c. If this check fails,
strace assumes the PTRACE_SET_SYSCALL_INFO interface is unavailable.
Changing the PTRACE_SYSCALL_INFO_ENTRY behavior this way would cause that
initialization check to fail, meaning strace would gracefully fall back
and not use the interface at all.
--
ldv
next prev parent reply other threads:[~2026-07-06 14:16 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-01 15:05 [PATCH 0/5] ptrace_set_syscall_info: add support for seccomp syscall skipping and instruction pointer modification Renzo Davoli
2026-07-01 15:05 ` [PATCH 1/5] ptrace: add PTRACE_SYSCALL_INFO_SECCOMP_SKIP Renzo Davoli
2026-07-02 8:43 ` Oleg Nesterov
2026-07-02 9:09 ` Renzo Davoli
2026-07-02 9:58 ` Oleg Nesterov
2026-07-02 11:07 ` Dmitry V. Levin
2026-07-02 11:31 ` Oleg Nesterov
2026-07-02 11:39 ` Oleg Nesterov
2026-07-02 14:47 ` Oleg Nesterov
2026-07-02 16:10 ` Renzo Davoli
2026-07-03 9:58 ` Oleg Nesterov
2026-07-06 14:16 ` Dmitry V. Levin [this message]
2026-07-01 15:05 ` [PATCH 2/5] selftests/ptrace: add a test case for PTRACE_SYSCALL_INFO_SECCOMP_SKIP Renzo Davoli
2026-07-01 15:05 ` [PATCH 3/5] asm/ptrace.h: add instruction_pointer_set Renzo Davoli
2026-07-01 15:05 ` [PATCH 4/5] ptrace: add PTRACE_SYSCALL_INFO_FLAG_SET_IP Renzo Davoli
2026-07-01 15:05 ` [PATCH 5/5] selftests/ptrace: add a test case for PTRACE_SYSCALL_INFO_FLAG_SET_IP 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=20260706141640.GA5029@strace.io \
--to=ldv@strace.io \
--cc=akpm@linux-foundation.org \
--cc=berardi.dav@gmail.com \
--cc=evgsyr@gmail.com \
--cc=legion@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=oleg@redhat.com \
--cc=renzo@cs.unibo.it \
--cc=shuah@kernel.org \
--cc=strace-devel@lists.strace.io \
--cc=vapier@gentoo.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 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.