* [PATCH RFC 1/4] syscalls: Create unified partial table for all archs
2026-07-24 20:00 [PATCH RFC 0/4] syscalls: Add a shared table for all archs André Almeida
@ 2026-07-24 20:00 ` André Almeida
2026-07-24 20:09 ` Arnd Bergmann
2026-07-24 20:00 ` [PATCH RFC 2/4] syscalls: Add support for x86_x32 for the common syscall table André Almeida
` (2 subsequent siblings)
3 siblings, 1 reply; 11+ messages in thread
From: André Almeida @ 2026-07-24 20:00 UTC (permalink / raw)
To: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen,
H. Peter Anvin, Nathan Chancellor, Arnd Bergmann
Cc: linux-kernel, linux-kbuild, kernel-dev, André Almeida
To take advantage of the subset of syscall numbers that are guaranteed to
be shared, create a new table and adapt generation scripts to use it. In
that way, every new syscall can be added to a single file.
Signed-off-by: André Almeida <andrealmeid@igalia.com>
---
scripts/syscall_common.tbl | 34 ++++++++++++++++++++++++++++
scripts/syscallhdr.sh | 55 +++++++++++++++++++++++++++++++++++-----------
scripts/syscalltbl.sh | 26 +++++++++++++++++-----
3 files changed, 97 insertions(+), 18 deletions(-)
diff --git a/scripts/syscall_common.tbl b/scripts/syscall_common.tbl
new file mode 100644
index 000000000000..97ea46ea8d56
--- /dev/null
+++ b/scripts/syscall_common.tbl
@@ -0,0 +1,34 @@
+# SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note
+#
+# syscall numbers shared by architectures
+
+442 common mount_setattr sys_mount_setattr
+443 common quotactl_fd sys_quotactl_fd
+444 common landlock_create_ruleset sys_landlock_create_ruleset
+445 common landlock_add_rule sys_landlock_add_rule
+446 common landlock_restrict_self sys_landlock_restrict_self
+447 memfd_secret memfd_secret sys_memfd_secret
+448 common process_mrelease sys_process_mrelease
+449 common futex_waitv sys_futex_waitv
+450 common set_mempolicy_home_node sys_set_mempolicy_home_node
+451 common cachestat sys_cachestat
+452 common fchmodat2 sys_fchmodat2
+453 common map_shadow_stack sys_map_shadow_stack
+454 common futex_wake sys_futex_wake
+455 common futex_wait sys_futex_wait
+456 common futex_requeue sys_futex_requeue
+457 common statmount sys_statmount
+458 common listmount sys_listmount
+459 common lsm_get_self_attr sys_lsm_get_self_attr
+460 common lsm_set_self_attr sys_lsm_set_self_attr
+461 common lsm_list_modules sys_lsm_list_modules
+462 common mseal sys_mseal
+463 common setxattrat sys_setxattrat
+464 common getxattrat sys_getxattrat
+465 common listxattrat sys_listxattrat
+466 common removexattrat sys_removexattrat
+467 common open_tree_attr sys_open_tree_attr
+468 common file_getattr sys_file_getattr
+469 common file_setattr sys_file_setattr
+470 common listns sys_listns
+471 common rseq_slice_yield sys_rseq_slice_yield
diff --git a/scripts/syscallhdr.sh b/scripts/syscallhdr.sh
index 22e34cd46b9b..77934a2d0f51 100755
--- a/scripts/syscallhdr.sh
+++ b/scripts/syscallhdr.sh
@@ -26,6 +26,7 @@ usage() {
echo >&2 " --emit-nr Emit the macro of the number of syscalls (__NR_syscalls)"
echo >&2 " --offset OFFSET The offset of syscall numbers"
echo >&2 " --prefix PREFIX The prefix to the macro like __NR_<PREFIX><NAME>"
+ echo >&2 " --common-tbl Use the common number table"
exit 1
}
@@ -34,6 +35,9 @@ abis=
emit_nr=
offset=
prefix=
+common_tbl=
+max=0
+COMMON_TBL_PATH="../scripts/syscall_common.tbl"
while [ $# -gt 0 ]
do
@@ -50,6 +54,9 @@ do
--prefix)
prefix=$2
shift 2;;
+ --common-tbl)
+ common_tbl=1
+ shift 1;;
-*)
echo "$1: unknown option" >&2
usage;;
@@ -69,13 +76,32 @@ guard=_UAPI_ASM_$(basename "$outfile" |
sed -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \
-e 's/[^A-Z0-9_]/_/g' -e 's/__/_/g')
-grep -E "^[0-9A-Fa-fXx]+[[:space:]]+$abis" "$infile" | {
+emit_start_guard() {
echo "#ifndef $guard"
echo "#define $guard"
echo
+}
+
+# emit_nr(prefix, nr)
+emit_nr() {
+ local nr=$1
+ local prefix=$2
+ echo
+ echo "#ifdef __KERNEL__"
+ echo "#define __NR_${prefix}syscalls $nr"
+ echo "#endif"
+}
+
+emit_end_guard() {
+ echo
+ echo "#endif /* $guard */"
+}
- max=0
- while read nr abi name native compat ; do
+# gen_hdr(infile)
+gen_hdr() {
+ input=$1
+
+ while read nr abi name native compat; do
max=$nr
@@ -84,15 +110,18 @@ grep -E "^[0-9A-Fa-fXx]+[[:space:]]+$abis" "$infile" | {
fi
echo "#define __NR_$prefix$name $nr"
- done
- if [ -n "$emit_nr" ]; then
- echo
- echo "#ifdef __KERNEL__"
- echo "#define __NR_${prefix}syscalls $(($max + 1))"
- echo "#endif"
- fi
+ done < <(grep -E "^[0-9A-Fa-fXx]+[[:space:]]+$abis" "$input")
+}
- echo
- echo "#endif /* $guard */"
-} > "$outfile"
+emit_start_guard > $outfile
+
+gen_hdr $infile >> $outfile
+
+if [ -n "$common_tbl" ]; then
+ gen_hdr $COMMON_TBL_PATH >> "$outfile"
+fi
+
+emit_nr $(($max + 1)) $prefix >> $outfile
+
+emit_end_guard >> $outfile
diff --git a/scripts/syscalltbl.sh b/scripts/syscalltbl.sh
index 6a903b87a7c2..30441cf88ead 100755
--- a/scripts/syscalltbl.sh
+++ b/scripts/syscalltbl.sh
@@ -23,11 +23,14 @@ usage() {
echo >&2
echo >&2 "options:"
echo >&2 " --abis ABIS ABI(s) to handle (By default, all lines are handled)"
+ echo >&2 " --common-tbl Use the common syscall number table"
exit 1
}
# default unless specified by options
abis=
+common_tbl=
+COMMON_TBL_PATH="../scripts/syscall_common.tbl"
while [ $# -gt 0 ]
do
@@ -35,6 +38,9 @@ do
--abis)
abis=$(echo "($2)" | tr ',' '|')
shift 2;;
+ --common-tbl)
+ common_tbl=1
+ shift 1;;
-*)
echo "$1: unknown option" >&2
usage;;
@@ -52,12 +58,14 @@ outfile="$2"
nxt=0
-grep -E "^[0-9]+[[:space:]]+$abis" "$infile" | {
+# gen_tbl(infile)
+gen_tbl() {
+ input=$1
while read nr abi name native compat noreturn; do
if [ $nxt -gt $nr ]; then
- echo "error: $infile: syscall table is not sorted or duplicates the same syscall number" >&2
+ echo "error: $input: syscall table is not sorted or duplicates the same syscall number" >&2
exit 1
fi
@@ -72,7 +80,7 @@ grep -E "^[0-9]+[[:space:]]+$abis" "$infile" | {
if [ -n "$noreturn" ]; then
if [ "$noreturn" != "noreturn" ]; then
- echo "error: $infile: invalid string \"$noreturn\" in 'noreturn' column"
+ echo "error: $input: invalid string \"$noreturn\" in 'noreturn' column"
exit 1
fi
if [ -n "$compat" ]; then
@@ -88,5 +96,13 @@ grep -E "^[0-9]+[[:space:]]+$abis" "$infile" | {
echo "__SYSCALL($nr, sys_ni_syscall)"
fi
nxt=$((nr + 1))
- done
-} > "$outfile"
+
+ done < <(grep -E "^[0-9]+[[:space:]]+$abis" "$input")
+
+}
+
+gen_tbl $infile > "$outfile"
+
+if [ -n "$common_tbl" ]; then
+ gen_tbl $COMMON_TBL_PATH >> "$outfile"
+fi
--
2.55.0
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [PATCH RFC 1/4] syscalls: Create unified partial table for all archs
2026-07-24 20:00 ` [PATCH RFC 1/4] syscalls: Create unified partial " André Almeida
@ 2026-07-24 20:09 ` Arnd Bergmann
2026-07-24 20:18 ` André Almeida
0 siblings, 1 reply; 11+ messages in thread
From: Arnd Bergmann @ 2026-07-24 20:09 UTC (permalink / raw)
To: André Almeida, Thomas Gleixner, Ingo Molnar,
Borislav Petkov, Dave Hansen, H. Peter Anvin, Nathan Chancellor
Cc: linux-kernel, linux-kbuild, kernel-dev
On Fri, Jul 24, 2026, at 22:00, André Almeida wrote:
> To take advantage of the subset of syscall numbers that are guaranteed to
> be shared, create a new table and adapt generation scripts to use it. In
> that way, every new syscall can be added to a single file.
>
> Signed-off-by: André Almeida <andrealmeid@igalia.com>
Thanks a lot for working on this, I had planned to do this myself
for a while but had never quite gotten around to finish it.
> +#
> +# syscall numbers shared by architectures
> +
> +442 common mount_setattr sys_mount_setattr
> +443 common quotactl_fd sys_quotactl_fd
> +444 common landlock_create_ruleset sys_landlock_create_ruleset
> +445 common landlock_add_rule sys_landlock_add_rule
It should really be anything starting at 403, not just 442 and higher.
There are some trivial differences that have crept in over time,
but we should be able to work around those.
> index 22e34cd46b9b..77934a2d0f51 100755
> --- a/scripts/syscallhdr.sh
> +++ b/scripts/syscallhdr.sh
> @@ -26,6 +26,7 @@ usage() {
> echo >&2 " --emit-nr Emit the macro of the number of
> syscalls (__NR_syscalls)"
> echo >&2 " --offset OFFSET The offset of syscall numbers"
> echo >&2 " --prefix PREFIX The prefix to the macro like
> __NR_<PREFIX><NAME>"
> + echo >&2 " --common-tbl Use the common number table"
> exit 1
Ideally we shouldn't even need this bit either, though it may
help for the transition phase.
Arnd
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [PATCH RFC 1/4] syscalls: Create unified partial table for all archs
2026-07-24 20:09 ` Arnd Bergmann
@ 2026-07-24 20:18 ` André Almeida
2026-07-24 20:25 ` Arnd Bergmann
0 siblings, 1 reply; 11+ messages in thread
From: André Almeida @ 2026-07-24 20:18 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Dave Hansen, Borislav Petkov, linux-kernel, linux-kbuild,
H. Peter Anvin, kernel-dev, Thomas Gleixner, Nathan Chancellor,
Ingo Molnar
Em 24/07/2026 17:09, Arnd Bergmann escreveu:
> On Fri, Jul 24, 2026, at 22:00, André Almeida wrote:
>> To take advantage of the subset of syscall numbers that are guaranteed to
>> be shared, create a new table and adapt generation scripts to use it. In
>> that way, every new syscall can be added to a single file.
>>
>> Signed-off-by: André Almeida <andrealmeid@igalia.com>
>
> Thanks a lot for working on this, I had planned to do this myself
> for a while but had never quite gotten around to finish it.
>
>> +#
>> +# syscall numbers shared by architectures
>> +
>> +442 common mount_setattr sys_mount_setattr
>> +443 common quotactl_fd sys_quotactl_fd
>> +444 common landlock_create_ruleset sys_landlock_create_ruleset
>> +445 common landlock_add_rule sys_landlock_add_rule
>
> It should really be anything starting at 403, not just 442 and higher.
>
> There are some trivial differences that have crept in over time,
> but we should be able to work around those.
>
The thing that prevent me starting before 442 was how to deal with
compat. If I add to the table
441 common epoll_pwait2 sys_epoll_pwait2 compat_sys_epoll_pwait2
It will wrongly add
__SYSCALL_WITH_COMPAT(441, sys_epoll_pwait2, compat_sys_epoll_pwait2)
to arch/x86/include/generated/asm/syscalls_64.h.
Maybe I could add a --ignore-compat to scripts/syscalltbl.sh, and add
this flag for 64 builds. What do you think?
>> index 22e34cd46b9b..77934a2d0f51 100755
>> --- a/scripts/syscallhdr.sh
>> +++ b/scripts/syscallhdr.sh
>> @@ -26,6 +26,7 @@ usage() {
>> echo >&2 " --emit-nr Emit the macro of the number of
>> syscalls (__NR_syscalls)"
>> echo >&2 " --offset OFFSET The offset of syscall numbers"
>> echo >&2 " --prefix PREFIX The prefix to the macro like
>> __NR_<PREFIX><NAME>"
>> + echo >&2 " --common-tbl Use the common number table"
>> exit 1
>
> Ideally we shouldn't even need this bit either, though it may
> help for the transition phase.
>
> Arnd
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [PATCH RFC 1/4] syscalls: Create unified partial table for all archs
2026-07-24 20:18 ` André Almeida
@ 2026-07-24 20:25 ` Arnd Bergmann
2026-07-24 21:22 ` H. Peter Anvin
0 siblings, 1 reply; 11+ messages in thread
From: Arnd Bergmann @ 2026-07-24 20:25 UTC (permalink / raw)
To: André Almeida
Cc: Dave Hansen, Borislav Petkov, linux-kernel, linux-kbuild,
H. Peter Anvin, kernel-dev, Thomas Gleixner, Nathan Chancellor,
Ingo Molnar
On Fri, Jul 24, 2026, at 22:18, André Almeida wrote:
> Em 24/07/2026 17:09, Arnd Bergmann escreveu:
>> On Fri, Jul 24, 2026, at 22:00, André Almeida wrote:
>> It should really be anything starting at 403, not just 442 and higher.
>>
>> There are some trivial differences that have crept in over time,
>> but we should be able to work around those.
>>
>
> The thing that prevent me starting before 442 was how to deal with
> compat. If I add to the table
>
> 441 common epoll_pwait2 sys_epoll_pwait2 compat_sys_epoll_pwait2
>
> It will wrongly add
>
> __SYSCALL_WITH_COMPAT(441, sys_epoll_pwait2, compat_sys_epoll_pwait2)
>
> to arch/x86/include/generated/asm/syscalls_64.h.
>
> Maybe I could add a --ignore-compat to scripts/syscalltbl.sh, and add
> this flag for 64 builds. What do you think?
IIRC, we can just use compat_sys_epoll_pwait2 for both i386
and x32, because compat_sigset_t is compatible with sigset_t --
they are only really different on big-endian targets, which
count the bits in a u64 different from two u32.
This problem also goes away once x32 is gone.
Arnd
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [PATCH RFC 1/4] syscalls: Create unified partial table for all archs
2026-07-24 20:25 ` Arnd Bergmann
@ 2026-07-24 21:22 ` H. Peter Anvin
2026-07-25 8:25 ` Arnd Bergmann
0 siblings, 1 reply; 11+ messages in thread
From: H. Peter Anvin @ 2026-07-24 21:22 UTC (permalink / raw)
To: Arnd Bergmann, André Almeida
Cc: Dave Hansen, Borislav Petkov, linux-kernel, linux-kbuild,
kernel-dev, Thomas Gleixner, Nathan Chancellor, Ingo Molnar
On July 24, 2026 1:25:05 PM PDT, Arnd Bergmann <arnd@arndb.de> wrote:
>On Fri, Jul 24, 2026, at 22:18, André Almeida wrote:
>> Em 24/07/2026 17:09, Arnd Bergmann escreveu:
>>> On Fri, Jul 24, 2026, at 22:00, André Almeida wrote:
>>> It should really be anything starting at 403, not just 442 and higher.
>>>
>>> There are some trivial differences that have crept in over time,
>>> but we should be able to work around those.
>>>
>>
>> The thing that prevent me starting before 442 was how to deal with
>> compat. If I add to the table
>>
>> 441 common epoll_pwait2 sys_epoll_pwait2 compat_sys_epoll_pwait2
>>
>> It will wrongly add
>>
>> __SYSCALL_WITH_COMPAT(441, sys_epoll_pwait2, compat_sys_epoll_pwait2)
>>
>> to arch/x86/include/generated/asm/syscalls_64.h.
>>
>> Maybe I could add a --ignore-compat to scripts/syscalltbl.sh, and add
>> this flag for 64 builds. What do you think?
>
>IIRC, we can just use compat_sys_epoll_pwait2 for both i386
>and x32, because compat_sigset_t is compatible with sigset_t --
>they are only really different on big-endian targets, which
>count the bits in a u64 different from two u32.
>
>This problem also goes away once x32 is gone.
>
> Arnd
>
No reason to introduce another entry point if there's no difference.
x86, after all, is littleendian and alignment-tolerant.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH RFC 1/4] syscalls: Create unified partial table for all archs
2026-07-24 21:22 ` H. Peter Anvin
@ 2026-07-25 8:25 ` Arnd Bergmann
0 siblings, 0 replies; 11+ messages in thread
From: Arnd Bergmann @ 2026-07-25 8:25 UTC (permalink / raw)
To: H. Peter Anvin, André Almeida
Cc: Dave Hansen, Borislav Petkov, linux-kernel, linux-kbuild,
kernel-dev, Thomas Gleixner, Nathan Chancellor, Ingo Molnar
On Fri, Jul 24, 2026, at 23:22, H. Peter Anvin wrote:
> On July 24, 2026 1:25:05 PM PDT, Arnd Bergmann <arnd@arndb.de> wrote:
>>> It will wrongly add
>>>
>>> __SYSCALL_WITH_COMPAT(441, sys_epoll_pwait2, compat_sys_epoll_pwait2)
>>>
>>> to arch/x86/include/generated/asm/syscalls_64.h.
>>>
>>> Maybe I could add a --ignore-compat to scripts/syscalltbl.sh, and add
>>> this flag for 64 builds. What do you think?
>>
>>IIRC, we can just use compat_sys_epoll_pwait2 for both i386
>>and x32, because compat_sigset_t is compatible with sigset_t --
>>they are only really different on big-endian targets, which
>>count the bits in a u64 different from two u32.
>>
>>This problem also goes away once x32 is gone.
>
> No reason to introduce another entry point if there's no difference.
>
> x86, after all, is littleendian and alignment-tolerant.
What I meant was the reverse: if the common table has the
compat_sys_epoll_pwait2 entry for compat targets and x32 is
the only outlier, we don't need a special case for that
to force it to use the sys_epoll_pwait2 variant since they
are identical on x86.
Looking again at the x86 table, I see that x32 is not even
described as a compat target and just takes the second (native
64-bit) argument of __SYSCALL_WITH_COMPAT() instead of third
anyway, so there wouldn't even be a problem if native
and compat were different.
Arnd
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH RFC 2/4] syscalls: Add support for x86_x32 for the common syscall table
2026-07-24 20:00 [PATCH RFC 0/4] syscalls: Add a shared table for all archs André Almeida
2026-07-24 20:00 ` [PATCH RFC 1/4] syscalls: Create unified partial " André Almeida
@ 2026-07-24 20:00 ` André Almeida
2026-07-24 20:16 ` Arnd Bergmann
2026-07-24 20:00 ` [PATCH RFC 3/4] x86: Use " André Almeida
2026-07-24 20:00 ` [PATCH RFC 4/4] scripts/syscall.tbl: Use the common table André Almeida
3 siblings, 1 reply; 11+ messages in thread
From: André Almeida @ 2026-07-24 20:00 UTC (permalink / raw)
To: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen,
H. Peter Anvin, Nathan Chancellor, Arnd Bergmann
Cc: linux-kernel, linux-kbuild, kernel-dev, André Almeida
x86_x32 has a peculiar ordering: first, goes the x86 syscalls. Then, the
shared syscall numbers from the common table, and finally the x86_x32
syscall numbers. Adapt syscallhdr.sh script to take this into account.
Let's hope that x32 is deprecated before the syscall table reaches syscall
512, to avoid making the shared table more confusing.
Signed-off-by: André Almeida <andrealmeid@igalia.com>
---
scripts/syscallhdr.sh | 34 +++++++++++++++++++++++++++++++---
1 file changed, 31 insertions(+), 3 deletions(-)
diff --git a/scripts/syscallhdr.sh b/scripts/syscallhdr.sh
index 77934a2d0f51..b68492946d6f 100755
--- a/scripts/syscallhdr.sh
+++ b/scripts/syscallhdr.sh
@@ -72,6 +72,12 @@ fi
infile="$1"
outfile="$2"
+is_x32=
+
+if [[ "$abis" == *"x32"* ]]; then
+ is_x32=1
+fi
+
guard=_UAPI_ASM_$(basename "$outfile" |
sed -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \
-e 's/[^A-Z0-9_]/_/g' -e 's/__/_/g')
@@ -116,10 +122,32 @@ gen_hdr() {
emit_start_guard > $outfile
-gen_hdr $infile >> $outfile
+# x32 has a special ordering. We need to get first the common numbers from x86
+# table, then the common numbers from scripts/syscall_common.tbl and finally the
+# x32 numbers
+if [ -n "$is_x32" ]; then
+
+ abis="${abis//x32|/}"
+ abis="${abis//|x32/}"
+ abis="${abis//x32/}"
+
+ if [[ $abis != "()" ]]; then
+ gen_hdr $infile >> $outfile
+
+ if [ -n "$common_tbl" ]; then
+ gen_hdr $COMMON_TBL_PATH >> "$outfile"
+ fi
+ fi
+
+ abis="(x32)"
+
+ gen_hdr $infile >> "$outfile"
+else
+ gen_hdr $infile >> $outfile
-if [ -n "$common_tbl" ]; then
- gen_hdr $COMMON_TBL_PATH >> "$outfile"
+ if [ -n "$common_tbl" ]; then
+ gen_hdr $COMMON_TBL_PATH >> "$outfile"
+ fi
fi
emit_nr $(($max + 1)) $prefix >> $outfile
--
2.55.0
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [PATCH RFC 2/4] syscalls: Add support for x86_x32 for the common syscall table
2026-07-24 20:00 ` [PATCH RFC 2/4] syscalls: Add support for x86_x32 for the common syscall table André Almeida
@ 2026-07-24 20:16 ` Arnd Bergmann
0 siblings, 0 replies; 11+ messages in thread
From: Arnd Bergmann @ 2026-07-24 20:16 UTC (permalink / raw)
To: André Almeida, Thomas Gleixner, Ingo Molnar,
Borislav Petkov, Dave Hansen, H. Peter Anvin, Nathan Chancellor
Cc: linux-kernel, linux-kbuild, kernel-dev
On Fri, Jul 24, 2026, at 22:00, André Almeida wrote:
> x86_x32 has a peculiar ordering: first, goes the x86 syscalls. Then, the
> shared syscall numbers from the common table, and finally the x86_x32
> syscall numbers. Adapt syscallhdr.sh script to take this into account.
>
> Let's hope that x32 is deprecated before the syscall table reaches syscall
> 512, to avoid making the shared table more confusing.
>
> Signed-off-by: André Almeida <andrealmeid@igalia.com>
The suggestion at the moment is to remove x32 in linux-7.4, and
I don't think your patches will hit 7.3 at this point, so hopefully
we don't need this bit either.
As we discussed recently [1], we likely still need to stay away from
the x32 range to avoid having conflicting numbers on x86-64 between
future number assignments and old kernels (< linux-5.4) that fail
to return -ENOSYS for x32 special syscalls. The only way we could
arguably consider reusing them is if glibc increases the minimum
kernel version from 3.2 to 5.4 before we get to that number, but
that is still slightly fragile because glibc is not the only
runtime to consider here.
Arnd
[1] https://lore.kernel.org/lkml/29bdbdc4-caef-4486-8816-84422c23bc20@app.fastmail.com/
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH RFC 3/4] x86: Use common syscall table
2026-07-24 20:00 [PATCH RFC 0/4] syscalls: Add a shared table for all archs André Almeida
2026-07-24 20:00 ` [PATCH RFC 1/4] syscalls: Create unified partial " André Almeida
2026-07-24 20:00 ` [PATCH RFC 2/4] syscalls: Add support for x86_x32 for the common syscall table André Almeida
@ 2026-07-24 20:00 ` André Almeida
2026-07-24 20:00 ` [PATCH RFC 4/4] scripts/syscall.tbl: Use the common table André Almeida
3 siblings, 0 replies; 11+ messages in thread
From: André Almeida @ 2026-07-24 20:00 UTC (permalink / raw)
To: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen,
H. Peter Anvin, Nathan Chancellor, Arnd Bergmann
Cc: linux-kernel, linux-kbuild, kernel-dev, André Almeida
Use common syscall table and drop the shared numbers from the x86 tables.
Signed-off-by: André Almeida <andrealmeid@igalia.com>
---
arch/x86/entry/syscalls/Makefile | 15 ++++++++-------
arch/x86/entry/syscalls/syscall_32.tbl | 30 ------------------------------
arch/x86/entry/syscalls/syscall_64.tbl | 30 ------------------------------
3 files changed, 8 insertions(+), 67 deletions(-)
diff --git a/arch/x86/entry/syscalls/Makefile b/arch/x86/entry/syscalls/Makefile
index eca5d6eff132..f4bdad7fea13 100644
--- a/arch/x86/entry/syscalls/Makefile
+++ b/arch/x86/entry/syscalls/Makefile
@@ -15,30 +15,31 @@ prefix :=
quiet_cmd_syshdr = SYSHDR $@
cmd_syshdr = $(CONFIG_SHELL) $(syshdr) --abis $(abis) --emit-nr \
+ --common-tbl \
$(if $(offset),--offset $(offset)) \
$(if $(prefix),--prefix $(prefix)) \
$< $@
quiet_cmd_systbl = SYSTBL $@
- cmd_systbl = $(CONFIG_SHELL) $(systbl) --abis $(abis) $< $@
+ cmd_systbl = $(CONFIG_SHELL) $(systbl) --abis $(abis) --common-tbl $< $@
quiet_cmd_hypercalls = HYPERCALLS $@
cmd_hypercalls = $(CONFIG_SHELL) '$<' $@ $(filter-out $<, $(real-prereqs))
-$(uapi)/unistd_32.h: abis := i386
+$(uapi)/unistd_32.h: abis := common,i386,memfd_secret
$(uapi)/unistd_32.h: $(syscall32) $(syshdr) FORCE
$(call if_changed,syshdr)
-$(out)/unistd_32_ia32.h: abis := i386
+$(out)/unistd_32_ia32.h: abis := common,i386,memfd_secret
$(out)/unistd_32_ia32.h: prefix := ia32_
$(out)/unistd_32_ia32.h: $(syscall32) $(syshdr) FORCE
$(call if_changed,syshdr)
-$(uapi)/unistd_x32.h: abis := common,x32
+$(uapi)/unistd_x32.h: abis := common,x32,memfd_secret
$(uapi)/unistd_x32.h: offset := __X32_SYSCALL_BIT
$(uapi)/unistd_x32.h: $(syscall64) $(syshdr) FORCE
$(call if_changed,syshdr)
-$(uapi)/unistd_64.h: abis := common,64
+$(uapi)/unistd_64.h: abis := common,64,memfd_secret
$(uapi)/unistd_64.h: $(syscall64) $(syshdr) FORCE
$(call if_changed,syshdr)
@@ -47,10 +48,10 @@ $(out)/unistd_64_x32.h: prefix := x32_
$(out)/unistd_64_x32.h: $(syscall64) $(syshdr) FORCE
$(call if_changed,syshdr)
-$(out)/syscalls_32.h: abis := i386
+$(out)/syscalls_32.h: abis := common,i386,memfd_secret
$(out)/syscalls_32.h: $(syscall32) $(systbl) FORCE
$(call if_changed,systbl)
-$(out)/syscalls_64.h: abis := common,64
+$(out)/syscalls_64.h: abis := common,64,memfd_secret
$(out)/syscalls_64.h: $(syscall64) $(systbl) FORCE
$(call if_changed,systbl)
$(out)/syscalls_x32.h: abis := common,x32
diff --git a/arch/x86/entry/syscalls/syscall_32.tbl b/arch/x86/entry/syscalls/syscall_32.tbl
index f832ebd2d79b..77678941163d 100644
--- a/arch/x86/entry/syscalls/syscall_32.tbl
+++ b/arch/x86/entry/syscalls/syscall_32.tbl
@@ -447,33 +447,3 @@
439 i386 faccessat2 sys_faccessat2
440 i386 process_madvise sys_process_madvise
441 i386 epoll_pwait2 sys_epoll_pwait2 compat_sys_epoll_pwait2
-442 i386 mount_setattr sys_mount_setattr
-443 i386 quotactl_fd sys_quotactl_fd
-444 i386 landlock_create_ruleset sys_landlock_create_ruleset
-445 i386 landlock_add_rule sys_landlock_add_rule
-446 i386 landlock_restrict_self sys_landlock_restrict_self
-447 i386 memfd_secret sys_memfd_secret
-448 i386 process_mrelease sys_process_mrelease
-449 i386 futex_waitv sys_futex_waitv
-450 i386 set_mempolicy_home_node sys_set_mempolicy_home_node
-451 i386 cachestat sys_cachestat
-452 i386 fchmodat2 sys_fchmodat2
-453 i386 map_shadow_stack sys_map_shadow_stack
-454 i386 futex_wake sys_futex_wake
-455 i386 futex_wait sys_futex_wait
-456 i386 futex_requeue sys_futex_requeue
-457 i386 statmount sys_statmount
-458 i386 listmount sys_listmount
-459 i386 lsm_get_self_attr sys_lsm_get_self_attr
-460 i386 lsm_set_self_attr sys_lsm_set_self_attr
-461 i386 lsm_list_modules sys_lsm_list_modules
-462 i386 mseal sys_mseal
-463 i386 setxattrat sys_setxattrat
-464 i386 getxattrat sys_getxattrat
-465 i386 listxattrat sys_listxattrat
-466 i386 removexattrat sys_removexattrat
-467 i386 open_tree_attr sys_open_tree_attr
-468 i386 file_getattr sys_file_getattr
-469 i386 file_setattr sys_file_setattr
-470 i386 listns sys_listns
-471 i386 rseq_slice_yield sys_rseq_slice_yield
diff --git a/arch/x86/entry/syscalls/syscall_64.tbl b/arch/x86/entry/syscalls/syscall_64.tbl
index 524155d655da..915aa5a78132 100644
--- a/arch/x86/entry/syscalls/syscall_64.tbl
+++ b/arch/x86/entry/syscalls/syscall_64.tbl
@@ -366,36 +366,6 @@
439 common faccessat2 sys_faccessat2
440 common process_madvise sys_process_madvise
441 common epoll_pwait2 sys_epoll_pwait2
-442 common mount_setattr sys_mount_setattr
-443 common quotactl_fd sys_quotactl_fd
-444 common landlock_create_ruleset sys_landlock_create_ruleset
-445 common landlock_add_rule sys_landlock_add_rule
-446 common landlock_restrict_self sys_landlock_restrict_self
-447 common memfd_secret sys_memfd_secret
-448 common process_mrelease sys_process_mrelease
-449 common futex_waitv sys_futex_waitv
-450 common set_mempolicy_home_node sys_set_mempolicy_home_node
-451 common cachestat sys_cachestat
-452 common fchmodat2 sys_fchmodat2
-453 common map_shadow_stack sys_map_shadow_stack
-454 common futex_wake sys_futex_wake
-455 common futex_wait sys_futex_wait
-456 common futex_requeue sys_futex_requeue
-457 common statmount sys_statmount
-458 common listmount sys_listmount
-459 common lsm_get_self_attr sys_lsm_get_self_attr
-460 common lsm_set_self_attr sys_lsm_set_self_attr
-461 common lsm_list_modules sys_lsm_list_modules
-462 common mseal sys_mseal
-463 common setxattrat sys_setxattrat
-464 common getxattrat sys_getxattrat
-465 common listxattrat sys_listxattrat
-466 common removexattrat sys_removexattrat
-467 common open_tree_attr sys_open_tree_attr
-468 common file_getattr sys_file_getattr
-469 common file_setattr sys_file_setattr
-470 common listns sys_listns
-471 common rseq_slice_yield sys_rseq_slice_yield
#
# Due to a historical design error, certain syscalls are numbered differently
--
2.55.0
^ permalink raw reply [flat|nested] 11+ messages in thread* [PATCH RFC 4/4] scripts/syscall.tbl: Use the common table
2026-07-24 20:00 [PATCH RFC 0/4] syscalls: Add a shared table for all archs André Almeida
` (2 preceding siblings ...)
2026-07-24 20:00 ` [PATCH RFC 3/4] x86: Use " André Almeida
@ 2026-07-24 20:00 ` André Almeida
3 siblings, 0 replies; 11+ messages in thread
From: André Almeida @ 2026-07-24 20:00 UTC (permalink / raw)
To: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen,
H. Peter Anvin, Nathan Chancellor, Arnd Bergmann
Cc: linux-kernel, linux-kbuild, kernel-dev, André Almeida
Use the common syscall number table and drop the shared numbers from the
table.
Signed-off-by: André Almeida <andrealmeid@igalia.com>
---
arch/arm64/tools/syscall_32.tbl | 30 ------------------------------
| 4 ++--
scripts/syscall.tbl | 30 ------------------------------
3 files changed, 2 insertions(+), 62 deletions(-)
diff --git a/arch/arm64/tools/syscall_32.tbl b/arch/arm64/tools/syscall_32.tbl
index 62d93d88e0fe..98315dee6d0b 100644
--- a/arch/arm64/tools/syscall_32.tbl
+++ b/arch/arm64/tools/syscall_32.tbl
@@ -453,33 +453,3 @@
439 common faccessat2 sys_faccessat2
440 common process_madvise sys_process_madvise
441 common epoll_pwait2 sys_epoll_pwait2 compat_sys_epoll_pwait2
-442 common mount_setattr sys_mount_setattr
-443 common quotactl_fd sys_quotactl_fd
-444 common landlock_create_ruleset sys_landlock_create_ruleset
-445 common landlock_add_rule sys_landlock_add_rule
-446 common landlock_restrict_self sys_landlock_restrict_self
-# 447 reserved for memfd_secret
-448 common process_mrelease sys_process_mrelease
-449 common futex_waitv sys_futex_waitv
-450 common set_mempolicy_home_node sys_set_mempolicy_home_node
-451 common cachestat sys_cachestat
-452 common fchmodat2 sys_fchmodat2
-453 common map_shadow_stack sys_map_shadow_stack
-454 common futex_wake sys_futex_wake
-455 common futex_wait sys_futex_wait
-456 common futex_requeue sys_futex_requeue
-457 common statmount sys_statmount
-458 common listmount sys_listmount
-459 common lsm_get_self_attr sys_lsm_get_self_attr
-460 common lsm_set_self_attr sys_lsm_set_self_attr
-461 common lsm_list_modules sys_lsm_list_modules
-462 common mseal sys_mseal
-463 common setxattrat sys_setxattrat
-464 common getxattrat sys_getxattrat
-465 common listxattrat sys_listxattrat
-466 common removexattrat sys_removexattrat
-467 common open_tree_attr sys_open_tree_attr
-468 common file_getattr sys_file_getattr
-469 common file_setattr sys_file_setattr
-470 common listns sys_listns
-471 common rseq_slice_yield sys_rseq_slice_yield
--git a/scripts/Makefile.asm-headers b/scripts/Makefile.asm-headers
index 8a4856e74180..995171dab2ca 100644
--- a/scripts/Makefile.asm-headers
+++ b/scripts/Makefile.asm-headers
@@ -58,14 +58,14 @@ quiet_cmd_remove = REMOVE $(unwanted)
cmd_remove = rm -f $(unwanted)
quiet_cmd_syshdr = SYSHDR $@
- cmd_syshdr = $(CONFIG_SHELL) $(syshdr) \
+ cmd_syshdr = $(CONFIG_SHELL) $(syshdr) --common-tbl \
$(if $(syshdr-args-$*),$(syshdr-args-$*),$(syshdr-args)) \
$(if $(syscall_compat),--prefix "compat$*_") \
--abis $(subst $(space),$(comma),$(strip $(syscall_abis_$*))) \
$< $@
quiet_cmd_systbl = SYSTBL $@
- cmd_systbl = $(CONFIG_SHELL) $(systbl) \
+ cmd_systbl = $(CONFIG_SHELL) $(systbl) --common-tbl \
$(if $(systbl-args-$*),$(systbl-args-$*),$(systbl-args)) \
--abis $(subst $(space),$(comma),$(strip $(syscall_abis_$*))) \
$< $@
diff --git a/scripts/syscall.tbl b/scripts/syscall.tbl
index 7a42b32b6577..8f0c4a1678d7 100644
--- a/scripts/syscall.tbl
+++ b/scripts/syscall.tbl
@@ -382,33 +382,3 @@
439 common faccessat2 sys_faccessat2
440 common process_madvise sys_process_madvise
441 common epoll_pwait2 sys_epoll_pwait2 compat_sys_epoll_pwait2
-442 common mount_setattr sys_mount_setattr
-443 common quotactl_fd sys_quotactl_fd
-444 common landlock_create_ruleset sys_landlock_create_ruleset
-445 common landlock_add_rule sys_landlock_add_rule
-446 common landlock_restrict_self sys_landlock_restrict_self
-447 memfd_secret memfd_secret sys_memfd_secret
-448 common process_mrelease sys_process_mrelease
-449 common futex_waitv sys_futex_waitv
-450 common set_mempolicy_home_node sys_set_mempolicy_home_node
-451 common cachestat sys_cachestat
-452 common fchmodat2 sys_fchmodat2
-453 common map_shadow_stack sys_map_shadow_stack
-454 common futex_wake sys_futex_wake
-455 common futex_wait sys_futex_wait
-456 common futex_requeue sys_futex_requeue
-457 common statmount sys_statmount
-458 common listmount sys_listmount
-459 common lsm_get_self_attr sys_lsm_get_self_attr
-460 common lsm_set_self_attr sys_lsm_set_self_attr
-461 common lsm_list_modules sys_lsm_list_modules
-462 common mseal sys_mseal
-463 common setxattrat sys_setxattrat
-464 common getxattrat sys_getxattrat
-465 common listxattrat sys_listxattrat
-466 common removexattrat sys_removexattrat
-467 common open_tree_attr sys_open_tree_attr
-468 common file_getattr sys_file_getattr
-469 common file_setattr sys_file_setattr
-470 common listns sys_listns
-471 common rseq_slice_yield sys_rseq_slice_yield
--
2.55.0
^ permalink raw reply [flat|nested] 11+ messages in thread