* [LTP] [PATCH 1/2] generate_arch.sh: Fix syscall extraction bugs
2026-09-30 8:32 [LTP] [PATCH 0/2] Fix generate_arch.sh and update syscalls to v7.3-rc5 Andrea Cervesato
@ 2026-09-30 8:32 ` Andrea Cervesato
2026-09-30 15:02 ` [LTP] " linuxtestproject.agent
2026-09-30 15:28 ` [LTP] [PATCH 1/2] " Petr Vorel
2026-09-30 8:32 ` [LTP] [PATCH 2/2] syscalls: Update numbers to Linux v7.3-rc5 Andrea Cervesato
1 sibling, 2 replies; 8+ messages in thread
From: Andrea Cervesato @ 2026-09-30 8:32 UTC (permalink / raw)
To: Linux Test Project
From: Andrea Cervesato <andrea.cervesato@suse.com>
Do not filter out sys_ni_syscall from tables and seed syscall names
from generic headers and existing tables so legacy syscalls like
_sysctl and timerfd are preserved.
Check s390 header macros to detect 31-bit ABI availability instead of
overwriting s390.in with 64-bit definitions on newer kernels.
Fail immediately when compilation fails for a supported architecture
rather than silently continuing.
Fixes: 1694fd203cf1 ("Add script to generate arch(s) dependant syscalls")
Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
---
include/lapi/syscalls/generate_arch.sh | 99 +++++++++++++++++-----------------
1 file changed, 49 insertions(+), 50 deletions(-)
diff --git a/include/lapi/syscalls/generate_arch.sh b/include/lapi/syscalls/generate_arch.sh
index 5d731794d..969c1b6da 100755
--- a/include/lapi/syscalls/generate_arch.sh
+++ b/include/lapi/syscalls/generate_arch.sh
@@ -33,6 +33,7 @@ if [ ! -e "${KERNELSRC}/Makefile" ]; then
fi
TEMP="$(mktemp -d)"
+trap 'rm -rf "${TEMP}"' EXIT
KVER="$(make -C ${KERNELSRC} kernelversion -s)"
SCRIPT_DIR="$(realpath $(dirname "$0"))"
@@ -41,18 +42,16 @@ LINUX_HEADERS="${TEMP}/headers"
grab_syscall_names_from_tables() {
for tbl_file in $(find ${KERNELSRC}/arch -name syscall*.tbl); do
- grep -E -v "(^#|^$|sys_ni_syscall)" $tbl_file |
+ grep -E -v "^(#|$)" "$tbl_file" |
awk '{ print $3 }' >>${TEMP}/syscall-names.tosort
done
- drop_bad_entries
-}
-
-grab_syscall_names_from_unistd_h() {
grep -E -h "^#define __NR_" \
- ${LINUX_HEADERS}/usr/include/asm/unistd*.h \
- ${LINUX_HEADERS}/usr/include/asm-generic/unistd.h \
- >${TEMP}/syscall-names.tosort
+ ${KERNELSRC}/include/uapi/asm-generic/unistd.h \
+ ${KERNELSRC}/arch/*/include/uapi/asm/unistd*.h \
+ >>${TEMP}/syscall-names.tosort 2>/dev/null || true
+
+ awk '{ print $1 }' ${SCRIPT_DIR}/*.in >>${TEMP}/syscall-names.tosort
drop_bad_entries
}
@@ -60,6 +59,7 @@ grab_syscall_names_from_unistd_h() {
drop_bad_entries() {
grep -E -v "(unistd.h|NR3264|__NR_syscall|__SC_COMP|__NR_.*Linux|__NR_FAST)" \
${TEMP}/syscall-names.tosort |
+ grep -E -vi "(not implemented|available|unused|reserved|spill|xtensa)" |
grep -E -v "(__SYSCALL|SYSCALL_BASE|SYSCALL_MASK)" |
sed -e "s/#define\s*__NR_//g" -e "s/\s.*//g" |
sort -u >${TEMP}/syscall-names.txt
@@ -68,51 +68,43 @@ drop_bad_entries() {
generate_table() {
echo "- $arch"
+ local flags="${extraflags:-}"
if [ "$bits" -eq "32" ]; then
- extraflags="${extraflags} -D__BITS_PER_LONG=32"
+ flags="${flags} -D__BITS_PER_LONG=32"
fi
local uppercase_arch=$(echo "$arch" | tr '[:lower:]' '[:upper:]')
- # ignore any error generated by gcc. We want to obtain all the
- # available architecture syscalls for the current platform and to handle
- # only supported architectures later on
- gcc ${TEMP}/list-syscalls.c -U__LP64__ -U__ILP32__ -U__i386__ \
+ rm -f "${TEMP}/list-syscalls"
+ gcc "${TEMP}/list-syscalls.c" -U__LP64__ -U__ILP32__ -U__i386__ \
-D${uppercase_arch} \
- -D__${arch}__ ${extraflags} \
- -I ${LINUX_HEADERS}/usr/include/ \
- -o ${TEMP}/list-syscalls || true
+ -D__${arch}__ ${flags} \
+ -I "${LINUX_HEADERS}/usr/include/" \
+ -o "${TEMP}/list-syscalls" || {
+ echo "Failed to compile list-syscalls for $arch" >&2
+ if grep -Fxq "$arch" "${SUPPORTED_ARCH}"; then
+ return 1
+ fi
+ return 0
+ }
- ${TEMP}/list-syscalls >"${TEMP}/${arch}.in.tosort"
+ "${TEMP}/list-syscalls" >"${TEMP}/${arch}.in.tosort"
sort -k2,2n "${TEMP}/${arch}.in.tosort" >"${TEMP}/${arch}.in"
}
generate_list_syscalls_c() {
- (
- printf "
- #include <stdio.h>
- #include <asm/unistd.h>
-
- int main(void)
- {
- "
- for syscall in $(cat ${TEMP}/syscall-names.txt); do
- printf "
- #ifdef __NR_$syscall
- printf(\"$syscall %%d"
- # i know the following print is ugly, but dash and bash
- # treat double quoted strings in a different way and we
- # really need to inject '\n' character in the C code
- # rather than carriage return
- printf '\\n'
- printf "\", __NR_$syscall);
- #endif
- "
- done
- printf " return 0;
- }"
- ) >${TEMP}/list-syscalls.c
+ {
+ echo "#include <stdio.h>"
+ echo "#include <asm/unistd.h>"
+ echo
+ echo "int main(void)"
+ echo "{"
+ awk '{ printf "#ifdef __NR_%s\n\tprintf(\"%s %%d\\n\", __NR_%s);\n#endif\n", $1, $1, $1 }' \
+ "${TEMP}/syscall-names.txt"
+ echo " return 0;"
+ echo "}"
+ } >"${TEMP}/list-syscalls.c"
}
export_headers() {
@@ -128,16 +120,16 @@ do_all_tables() {
extraflags=
case ${arch} in
- Kconfig)
- continue
- ;;
- um)
+ Kconfig|um)
continue
;;
esac
+ if [ ! -f "${archdir}/Makefile" ] && [ ! -f "${archdir}/Kconfig" ]; then
+ continue
+ fi
+
export_headers
- grab_syscall_names_from_unistd_h
case ${arch} in
arm)
@@ -156,8 +148,8 @@ do_all_tables() {
arch=mips64n32 extraflags=-D_MIPS_SIM=_MIPS_SIM_NABI32 generate_table
;;
powerpc)
- generate_table
- arch=powerpc64 generate_table
+ bits=32 generate_table
+ bits=64 arch=powerpc64 generate_table
;;
riscv)
arch=riscv64 extraflags=-D__LP64__ generate_table
@@ -165,8 +157,15 @@ do_all_tables() {
arch=riscv32 extraflags=-D__SIZEOF_POINTER__=4 generate_table
;;
s390)
- bits=32
- generate_table
+ # Older kernels define both ABIs directly in unistd.h.
+ gcc -E -dM -x c -D__s390__ -U__s390x__ \
+ -I "${LINUX_HEADERS}/usr/include/" \
+ -include asm/unistd.h /dev/null >"${TEMP}/s390-macros"
+ if grep -q '^#define __NR_getuid32 ' "${TEMP}/s390-macros"; then
+ bits=32 generate_table
+ else
+ echo "- s390 (31-bit ABI not available, skipping)"
+ fi
bits=64
arch=s390x generate_table
;;
--
2.51.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 8+ messages in thread* [LTP] [PATCH 2/2] syscalls: Update numbers to Linux v7.3-rc5
2026-09-30 8:32 [LTP] [PATCH 0/2] Fix generate_arch.sh and update syscalls to v7.3-rc5 Andrea Cervesato
2026-09-30 8:32 ` [LTP] [PATCH 1/2] generate_arch.sh: Fix syscall extraction bugs Andrea Cervesato
@ 2026-09-30 8:32 ` Andrea Cervesato
2026-09-30 14:41 ` Petr Vorel
1 sibling, 1 reply; 8+ messages in thread
From: Andrea Cervesato @ 2026-09-30 8:32 UTC (permalink / raw)
To: Linux Test Project
From: Andrea Cervesato <andrea.cervesato@suse.com>
Update architecture syscall tables up to Linux v7.3-rc5 using the
updated generate_arch.sh script. This adds clone3 on sparc/sparc64,
uprobe on x86_64, and new generic syscalls (listns, rseq_slice_yield,
fchroot), while preserving legacy syscall numbers.
Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
---
include/lapi/syscalls/arc.in | 3 +++
include/lapi/syscalls/arm.in | 4 ++++
include/lapi/syscalls/arm64.in | 3 +++
include/lapi/syscalls/i386.in | 6 ++++++
include/lapi/syscalls/loongarch64.in | 3 +++
include/lapi/syscalls/mips64.in | 3 +++
include/lapi/syscalls/mips64n32.in | 3 +++
include/lapi/syscalls/mipso32.in | 7 +++++--
include/lapi/syscalls/parisc.in | 4 ++++
include/lapi/syscalls/powerpc.in | 7 +++++++
include/lapi/syscalls/powerpc64.in | 7 +++++++
include/lapi/syscalls/s390x.in | 4 ++++
include/lapi/syscalls/sh.in | 4 ++++
include/lapi/syscalls/sparc.in | 5 +++++
include/lapi/syscalls/sparc64.in | 5 +++++
include/lapi/syscalls/x86_64.in | 4 ++++
16 files changed, 70 insertions(+), 2 deletions(-)
diff --git a/include/lapi/syscalls/arc.in b/include/lapi/syscalls/arc.in
index 0f0fbef6b..96b14c1b9 100644
--- a/include/lapi/syscalls/arc.in
+++ b/include/lapi/syscalls/arc.in
@@ -347,3 +347,6 @@ removexattrat 466
open_tree_attr 467
file_getattr 468
file_setattr 469
+listns 470
+rseq_slice_yield 471
+fchroot 472
diff --git a/include/lapi/syscalls/arm.in b/include/lapi/syscalls/arm.in
index d0238dec5..5b6047bd2 100644
--- a/include/lapi/syscalls/arm.in
+++ b/include/lapi/syscalls/arm.in
@@ -96,6 +96,7 @@ delete_module 129
quotactl 131
getpgid 132
fchdir 133
+bdflush 134
sysfs 135
personality 136
setfsuid 138
@@ -420,3 +421,6 @@ removexattrat 466
open_tree_attr 467
file_getattr 468
file_setattr 469
+listns 470
+rseq_slice_yield 471
+fchroot 472
diff --git a/include/lapi/syscalls/arm64.in b/include/lapi/syscalls/arm64.in
index c76930e20..26a61e830 100644
--- a/include/lapi/syscalls/arm64.in
+++ b/include/lapi/syscalls/arm64.in
@@ -323,3 +323,6 @@ removexattrat 466
open_tree_attr 467
file_getattr 468
file_setattr 469
+listns 470
+rseq_slice_yield 471
+fchroot 472
diff --git a/include/lapi/syscalls/i386.in b/include/lapi/syscalls/i386.in
index 38ea71fb2..b13d3f056 100644
--- a/include/lapi/syscalls/i386.in
+++ b/include/lapi/syscalls/i386.in
@@ -111,6 +111,7 @@ olduname 109
iopl 110
vhangup 111
idle 112
+vm86old 113
wait4 114
swapoff 115
sysinfo 116
@@ -131,6 +132,7 @@ get_kernel_syms 130
quotactl 131
getpgid 132
fchdir 133
+bdflush 134
sysfs 135
personality 136
afs_syscall 137
@@ -162,6 +164,7 @@ nanosleep 162
mremap 163
setresuid 164
getresuid 165
+vm86 166
query_module 167
poll 168
nfsservctl 169
@@ -454,3 +457,6 @@ removexattrat 466
open_tree_attr 467
file_getattr 468
file_setattr 469
+listns 470
+rseq_slice_yield 471
+fchroot 472
diff --git a/include/lapi/syscalls/loongarch64.in b/include/lapi/syscalls/loongarch64.in
index a1dfce79e..88e77ef8a 100644
--- a/include/lapi/syscalls/loongarch64.in
+++ b/include/lapi/syscalls/loongarch64.in
@@ -320,3 +320,6 @@ removexattrat 466
open_tree_attr 467
file_getattr 468
file_setattr 469
+listns 470
+rseq_slice_yield 471
+fchroot 472
diff --git a/include/lapi/syscalls/mips64.in b/include/lapi/syscalls/mips64.in
index 436d5c681..3c19066b8 100644
--- a/include/lapi/syscalls/mips64.in
+++ b/include/lapi/syscalls/mips64.in
@@ -369,3 +369,6 @@ removexattrat 5466
open_tree_attr 5467
file_getattr 5468
file_setattr 5469
+listns 5470
+rseq_slice_yield 5471
+fchroot 5472
diff --git a/include/lapi/syscalls/mips64n32.in b/include/lapi/syscalls/mips64n32.in
index 860a19c8b..0c539bd62 100644
--- a/include/lapi/syscalls/mips64n32.in
+++ b/include/lapi/syscalls/mips64n32.in
@@ -393,3 +393,6 @@ removexattrat 6466
open_tree_attr 6467
file_getattr 6468
file_setattr 6469
+listns 6470
+rseq_slice_yield 6471
+fchroot 6472
diff --git a/include/lapi/syscalls/mipso32.in b/include/lapi/syscalls/mipso32.in
index 5e53e46ce..5284389b8 100644
--- a/include/lapi/syscalls/mipso32.in
+++ b/include/lapi/syscalls/mipso32.in
@@ -55,7 +55,6 @@ fcntl 4055
mpx 4056
setpgid 4057
ulimit 4058
-unused59 4059
umask 4060
chroot 4061
ustat 4062
@@ -103,10 +102,10 @@ getitimer 4105
stat 4106
lstat 4107
fstat 4108
-unused109 4109
iopl 4110
vhangup 4111
idle 4112
+vm86 4113
wait4 4114
swapoff 4115
sysinfo 4116
@@ -127,6 +126,7 @@ get_kernel_syms 4130
quotactl 4131
getpgid 4132
fchdir 4133
+bdflush 4134
sysfs 4135
personality 4136
afs_syscall 4137
@@ -433,3 +433,6 @@ removexattrat 4466
open_tree_attr 4467
file_getattr 4468
file_setattr 4469
+listns 4470
+rseq_slice_yield 4471
+fchroot 4472
diff --git a/include/lapi/syscalls/parisc.in b/include/lapi/syscalls/parisc.in
index 238756694..5ba23a2b6 100644
--- a/include/lapi/syscalls/parisc.in
+++ b/include/lapi/syscalls/parisc.in
@@ -129,6 +129,7 @@ delete_module 129
quotactl 131
getpgid 132
fchdir 133
+bdflush 134
sysfs 135
personality 136
setfsuid 138
@@ -402,3 +403,6 @@ removexattrat 466
open_tree_attr 467
file_getattr 468
file_setattr 469
+listns 470
+rseq_slice_yield 471
+fchroot 472
diff --git a/include/lapi/syscalls/powerpc.in b/include/lapi/syscalls/powerpc.in
index 6911f9af9..20d803efc 100644
--- a/include/lapi/syscalls/powerpc.in
+++ b/include/lapi/syscalls/powerpc.in
@@ -111,6 +111,7 @@ olduname 109
iopl 110
vhangup 111
idle 112
+vm86 113
wait4 114
swapoff 115
sysinfo 116
@@ -131,6 +132,7 @@ get_kernel_syms 130
quotactl 131
getpgid 132
fchdir 133
+bdflush 134
sysfs 135
personality 136
afs_syscall 137
@@ -197,6 +199,7 @@ fstat64 197
pciconfig_read 198
pciconfig_write 199
pciconfig_iobase 200
+multiplexer 201
getdents64 202
pivot_root 203
fcntl64 204
@@ -250,6 +253,7 @@ statfs64 252
fstatfs64 253
fadvise64_64 254
rtas 255
+sys_debug_setcontext 256
migrate_pages 258
mbind 259
get_mempolicy 260
@@ -444,3 +448,6 @@ removexattrat 466
open_tree_attr 467
file_getattr 468
file_setattr 469
+listns 470
+rseq_slice_yield 471
+fchroot 472
diff --git a/include/lapi/syscalls/powerpc64.in b/include/lapi/syscalls/powerpc64.in
index 98190ba26..125b86b17 100644
--- a/include/lapi/syscalls/powerpc64.in
+++ b/include/lapi/syscalls/powerpc64.in
@@ -111,6 +111,7 @@ olduname 109
iopl 110
vhangup 111
idle 112
+vm86 113
wait4 114
swapoff 115
sysinfo 116
@@ -131,6 +132,7 @@ get_kernel_syms 130
quotactl 131
getpgid 132
fchdir 133
+bdflush 134
sysfs 135
personality 136
afs_syscall 137
@@ -191,6 +193,7 @@ readahead 191
pciconfig_read 198
pciconfig_write 199
pciconfig_iobase 200
+multiplexer 201
getdents64 202
pivot_root 203
madvise 205
@@ -241,6 +244,7 @@ utimes 251
statfs64 252
fstatfs64 253
rtas 255
+sys_debug_setcontext 256
migrate_pages 258
mbind 259
get_mempolicy 260
@@ -416,3 +420,6 @@ removexattrat 466
open_tree_attr 467
file_getattr 468
file_setattr 469
+listns 470
+rseq_slice_yield 471
+fchroot 472
diff --git a/include/lapi/syscalls/s390x.in b/include/lapi/syscalls/s390x.in
index 31f3ec553..b5ae79c75 100644
--- a/include/lapi/syscalls/s390x.in
+++ b/include/lapi/syscalls/s390x.in
@@ -96,6 +96,7 @@ get_kernel_syms 130
quotactl 131
getpgid 132
fchdir 133
+bdflush 134
sysfs 135
personality 136
afs_syscall 137
@@ -385,3 +386,6 @@ removexattrat 466
open_tree_attr 467
file_getattr 468
file_setattr 469
+listns 470
+rseq_slice_yield 471
+fchroot 472
diff --git a/include/lapi/syscalls/sh.in b/include/lapi/syscalls/sh.in
index ac281acf8..f4071df0c 100644
--- a/include/lapi/syscalls/sh.in
+++ b/include/lapi/syscalls/sh.in
@@ -115,6 +115,7 @@ delete_module 129
quotactl 131
getpgid 132
fchdir 133
+bdflush 134
sysfs 135
personality 136
setfsuid 138
@@ -431,3 +432,6 @@ removexattrat 466
open_tree_attr 467
file_getattr 468
file_setattr 469
+listns 470
+rseq_slice_yield 471
+fchroot 472
diff --git a/include/lapi/syscalls/sparc.in b/include/lapi/syscalls/sparc.in
index ffc0d9f7a..64143daaa 100644
--- a/include/lapi/syscalls/sparc.in
+++ b/include/lapi/syscalls/sparc.in
@@ -221,6 +221,7 @@ create_module 221
delete_module 222
get_kernel_syms 223
getpgid 224
+bdflush 225
sysfs 226
afs_syscall 227
setfsuid 228
@@ -402,6 +403,7 @@ fsconfig 431
fsmount 432
fspick 433
pidfd_open 434
+clone3 435
close_range 436
openat2 437
pidfd_getfd 438
@@ -435,3 +437,6 @@ removexattrat 466
open_tree_attr 467
file_getattr 468
file_setattr 469
+listns 470
+rseq_slice_yield 471
+fchroot 472
diff --git a/include/lapi/syscalls/sparc64.in b/include/lapi/syscalls/sparc64.in
index 992bd307d..631034c97 100644
--- a/include/lapi/syscalls/sparc64.in
+++ b/include/lapi/syscalls/sparc64.in
@@ -204,6 +204,7 @@ create_module 221
delete_module 222
get_kernel_syms 223
getpgid 224
+bdflush 225
sysfs 226
afs_syscall 227
setfsuid 228
@@ -365,6 +366,7 @@ fsconfig 431
fsmount 432
fspick 433
pidfd_open 434
+clone3 435
close_range 436
openat2 437
pidfd_getfd 438
@@ -398,3 +400,6 @@ removexattrat 466
open_tree_attr 467
file_getattr 468
file_setattr 469
+listns 470
+rseq_slice_yield 471
+fchroot 472
diff --git a/include/lapi/syscalls/x86_64.in b/include/lapi/syscalls/x86_64.in
index e9c0d0599..fd381114f 100644
--- a/include/lapi/syscalls/x86_64.in
+++ b/include/lapi/syscalls/x86_64.in
@@ -334,6 +334,7 @@ statx 332
io_pgetevents 333
rseq 334
uretprobe 335
+uprobe 336
pidfd_send_signal 424
io_uring_setup 425
io_uring_enter 426
@@ -380,3 +381,6 @@ removexattrat 466
open_tree_attr 467
file_getattr 468
file_setattr 469
+listns 470
+rseq_slice_yield 471
+fchroot 472
--
2.51.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 8+ messages in thread