From: Cong Wang <xiyou.wangcong@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Andy Lutomirski <luto@amacapital.net>,
Kees Cook <kees@kernel.org>, Will Drewry <wad@chromium.org>,
Christian Brauner <brauner@kernel.org>
Subject: [RFC PATCH 2/9] seccomp: add __NR_seccomp_* aliases for the fork family
Date: Mon, 19 Oct 2026 17:11:17 -0700 [thread overview]
Message-ID: <20261020001124.974063-3-xiyou.wangcong@gmail.com> (raw)
In-Reply-To: <20261020001124.974063-1-xiyou.wangcong@gmail.com>
From: Cong Wang <cwang@multikernel.io>
The existing __NR_seccomp_* aliases name only the strict mode syscalls
(read, write, exit, sigreturn). Add aliases for the task creation
family, clone, clone3, fork and vfork, so that seccomp can recognise
those syscalls by number, natively and for compat tasks.
The native aliases get generic defaults from <asm/unistd.h>. A syscall
the arch does not have is named -1, which never matches a valid syscall
number.
The compat aliases have no generic default, because a wrong compat
number cannot be told from a right one. An arch provides them when it
wants compat tasks covered; x86 does so for ia32. x32 needs nothing:
its syscall numbers carry __X32_SYSCALL_BIT and match none of the
native aliases.
Signed-off-by: Cong Wang <cwang@multikernel.io>
---
arch/Kconfig | 6 ++++++
arch/x86/include/asm/seccomp.h | 4 ++++
include/asm-generic/seccomp.h | 26 ++++++++++++++++++++++++++
3 files changed, 36 insertions(+)
diff --git a/arch/Kconfig b/arch/Kconfig
index 45c657772362..61040529a7da 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -641,6 +641,12 @@ config HAVE_ARCH_SECCOMP
- __NR_seccomp_write_32
- __NR_seccomp_exit_32
- __NR_seccomp_sigreturn_32
+ and, optionally, the compat fork family, for features that need to
+ recognise it (there is no generic default for these):
+ - __NR_seccomp_clone_32
+ - __NR_seccomp_clone3_32
+ - __NR_seccomp_fork_32
+ - __NR_seccomp_vfork_32
config HAVE_ARCH_SECCOMP_FILTER
bool
diff --git a/arch/x86/include/asm/seccomp.h b/arch/x86/include/asm/seccomp.h
index 42bcd42d70d1..767d047050a1 100644
--- a/arch/x86/include/asm/seccomp.h
+++ b/arch/x86/include/asm/seccomp.h
@@ -14,6 +14,10 @@
#define __NR_seccomp_write_32 __NR_ia32_write
#define __NR_seccomp_exit_32 __NR_ia32_exit
#define __NR_seccomp_sigreturn_32 __NR_ia32_sigreturn
+#define __NR_seccomp_clone_32 __NR_ia32_clone
+#define __NR_seccomp_clone3_32 __NR_ia32_clone3
+#define __NR_seccomp_fork_32 __NR_ia32_fork
+#define __NR_seccomp_vfork_32 __NR_ia32_vfork
#endif
#ifdef CONFIG_X86_64
diff --git a/include/asm-generic/seccomp.h b/include/asm-generic/seccomp.h
index 6b6f42bc58f9..5acdeb62c56c 100644
--- a/include/asm-generic/seccomp.h
+++ b/include/asm-generic/seccomp.h
@@ -26,6 +26,32 @@
#define __NR_seccomp_sigreturn __NR_rt_sigreturn
#endif
+/* The fork family; -1 names a syscall the arch does not have. */
+#ifndef __NR_seccomp_clone
+#define __NR_seccomp_clone __NR_clone
+#endif
+#ifndef __NR_seccomp_clone3
+#ifdef __NR_clone3
+#define __NR_seccomp_clone3 __NR_clone3
+#else
+#define __NR_seccomp_clone3 (-1)
+#endif
+#endif
+#ifndef __NR_seccomp_fork
+#ifdef __NR_fork
+#define __NR_seccomp_fork __NR_fork
+#else
+#define __NR_seccomp_fork (-1)
+#endif
+#endif
+#ifndef __NR_seccomp_vfork
+#ifdef __NR_vfork
+#define __NR_seccomp_vfork __NR_vfork
+#else
+#define __NR_seccomp_vfork (-1)
+#endif
+#endif
+
#ifdef CONFIG_COMPAT
#ifndef get_compat_mode1_syscalls
static inline const int *get_compat_mode1_syscalls(void)
--
2.43.0
next prev parent reply other threads:[~2026-10-20 0:11 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-20 0:11 [RFC PATCH 0/9] seccomp: report the result of continued system calls Cong Wang
2026-10-20 0:11 ` [RFC PATCH 1/9] seccomp: add result records to the notification listener Cong Wang
2026-10-20 0:11 ` Cong Wang [this message]
2026-10-20 0:11 ` [RFC PATCH 3/9] seccomp: report the result of a continued system call Cong Wang
2026-10-20 0:11 ` [RFC PATCH 4/9] seccomp: report the result of a continued fork Cong Wang
2026-10-20 0:11 ` [RFC PATCH 5/9] seccomp: factor out the user notification queue and wait Cong Wang
2026-10-20 0:11 ` [RFC PATCH 6/9] seccomp: add SECCOMP_USER_NOTIF_FLAG_HOLD Cong Wang
2026-10-20 0:11 ` [RFC PATCH 7/9] selftests/seccomp: test fork result records Cong Wang
2026-10-20 0:11 ` [RFC PATCH 8/9] selftests/seccomp: test held fork results Cong Wang
2026-10-20 0:11 ` [RFC PATCH 9/9] Documentation: seccomp: describe system call result records Cong Wang
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=20261020001124.974063-3-xiyou.wangcong@gmail.com \
--to=xiyou.wangcong@gmail.com \
--cc=brauner@kernel.org \
--cc=kees@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=wad@chromium.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
all inboxes | Powered by JetHome®