From: Oleg Nesterov <oleg@redhat.com>
To: "Dmitry V. Levin" <ldv@strace.io>
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: Thu, 2 Jul 2026 16:47:08 +0200 [thread overview]
Message-ID: <akZ57HfJwkwt0IuM@redhat.com> (raw)
In-Reply-To: <akZOAL27z2bmMBFs@redhat.com>
On 07/02, Oleg Nesterov wrote:
>
> Or we can simply allow the ENTRY/SECCOMP -> EXIT transition, I dunno.
> This is more safe.
and more simple
> But somehow I don't like the new PTRACE_SYSCALL_INFO_SECCOMP_SKIP...
Wdyt about something like below?
Oleg.
---
diff --git a/kernel/ptrace.c b/kernel/ptrace.c
index 130043bfc209..ecbfa28dfbf6 100644
--- a/kernel/ptrace.c
+++ b/kernel/ptrace.c
@@ -1084,7 +1084,7 @@ ptrace_set_syscall_info_seccomp(struct task_struct *child, struct pt_regs *regs,
static int
ptrace_set_syscall_info_exit(struct task_struct *child, struct pt_regs *regs,
- struct ptrace_syscall_info *info)
+ struct ptrace_syscall_info *info, bool force)
{
long rval = info->exit.rval;
@@ -1101,6 +1101,9 @@ ptrace_set_syscall_info_exit(struct task_struct *child, struct pt_regs *regs,
else
syscall_set_return_value(child, regs, 0, rval);
+ if (force)
+ syscall_set_nr(child, regs, -1);
+
return 0;
}
@@ -1110,6 +1113,7 @@ ptrace_set_syscall_info(struct task_struct *child, unsigned long user_size,
{
struct pt_regs *regs = task_pt_regs(child);
struct ptrace_syscall_info info;
+ bool force = false;
if (user_size < sizeof(info))
return -EINVAL;
@@ -1127,14 +1131,17 @@ ptrace_set_syscall_info(struct task_struct *child, unsigned long user_size,
return -EINVAL;
/* Changing the type of the system call stop is not supported yet. */
- if (ptrace_get_syscall_info_op(child) != info.op)
- return -EINVAL;
+ if (ptrace_get_syscall_info_op(child) != info.op) {
+ if (info.op != PTRACE_SYSCALL_INFO_EXIT)
+ return -EINVAL;
+ force = true;
+ }
switch (info.op) {
case PTRACE_SYSCALL_INFO_ENTRY:
return ptrace_set_syscall_info_entry(child, regs, &info);
case PTRACE_SYSCALL_INFO_EXIT:
- return ptrace_set_syscall_info_exit(child, regs, &info);
+ return ptrace_set_syscall_info_exit(child, regs, &info, force);
case PTRACE_SYSCALL_INFO_SECCOMP:
return ptrace_set_syscall_info_seccomp(child, regs, &info);
default:
next prev parent reply other threads:[~2026-07-02 14:47 UTC|newest]
Thread overview: 14+ 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 [this message]
2026-07-02 16:10 ` Renzo Davoli
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=akZ57HfJwkwt0IuM@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=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox