Fix generate_arch.sh and update syscalls to v7.3-rc5
v2 cover Fix generate_arch.sh and update syscalls to v7.3-rc5
This series addresses the regressions observed when regenerating syscall tables for Linux v7.3-rc5 [1].
The previous attempt to update syscall tables dropped legacy syscalls such as _sysctl and timerfd, and overwrote 31-bit s390 definitions with 64-bit s390x values due to kernel changes introduced in v6.19.
Patch 1 fixes generate_arch.sh:
- Includes table entries marked sys_ni_syscall and seeds names from generic headers and existing tables to retain legacy definitions like _sysctl and timerfd.
- Detects whether the 31-bit ABI is actually exposed by s390 headers instead of blindly overwriting s390.in with 64-bit definitions.
- Avoids compiler flag leaks across architectures.
- Fails immediately if compilation fails for any supported architecture.
Patch 2 updates the architecture input tables to Linux v7.3-rc5 using the fixed generator. This provides clone3 on SPARC (resolving tst_clone failures reported by Anders [2]), uprobe on x86_64, and new generic syscalls (listns, rseq_slice_yield, fchroot) while preserving existing legacy entries.
[1] https://lore.kernel.org/ltp/[email protected]/
[2] https://lore.kernel.org/ltp/[email protected]/
---
Changes in v2:
- fixed as per Petr suggestions
- Link to v1: https://lore.kernel.org/[email protected]
To: Linux Test Project <[email protected]>
---
Andrea Cervesato (2):
generate_arch.sh: Fix syscall extraction bugs
syscalls: Update numbers to Linux v7.3-rc5
include/lapi/syscalls/arc.in | 3 + include/lapi/syscalls/arm.in | 4 ++ include/lapi/syscalls/arm64.in | 3 + include/lapi/syscalls/generate_arch.sh | 103 +++++++++++++++++---------------- 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 ++ 17 files changed, 123 insertions(+), 52 deletions(-)
---
base-commit: 95c8cf4fcb90df48e8096cb8da02046ec2ebc49b
change-id: 20260930-fix_generate_syscalls-3692a6818a79
Best regards,
Signature · 5 lines
Andrea Cervesato <[email protected]> -- Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH v2 1/2 generate_arch.sh: Fix syscall extraction bugs
From: Andrea Cervesato <[email protected]>
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.
--- include/lapi/syscalls/generate_arch.sh | 103 +++++++++++++++++---------------- 1 file changed, 53 insertions(+), 50 deletions(-)
include/lapi/syscalls/generate_arch.sh +53 -50
@@ -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 + + 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,47 @@ 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 + local syscalls + + syscalls=$(awk '{ printf "#ifdef __NR_%s\n\tprintf(\"%s %%d\\n\", __NR_%s);\n#endif\n", $1, $1, $1 }' \ + "${TEMP}/syscall-names.txt") + + cat << EOF >"${TEMP}/list-syscalls.c" +#include <stdio.h> +#include <asm/unistd.h> + +int main(void) +{ +${syscalls} + return 0; +} +EOF } export_headers() {
@@ -128,16 +124,16 @@ do_all_tables() { extraflags= case ${arch} in - Kconfig) - continue - ;; - um) + Kconfig|um) continue ;; esac + if [ ! -f "${archdir}/Kconfig" ]; then + continue + fi + export_headers - grab_syscall_names_from_unistd_h case ${arch} in arm)
@@ -156,8 +152,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 +161,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 ;;
Signature · 5 lines
2.51.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH v2 2/2 syscalls: Update numbers to Linux v7.3-rc5
In reply to Andrea CervesatoFrom: Andrea Cervesato <[email protected]>
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.
--- 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(-)
include/lapi/syscalls/arc.in +3 -0
@@ -347,3 +347,6 @@ removexattrat 466 open_tree_attr 467 file_getattr 468 file_setattr 469 +listns 470 +rseq_slice_yield 471 +fchroot 472
include/lapi/syscalls/arm.in +4 -0
@@ -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
include/lapi/syscalls/arm64.in +3 -0
@@ -323,3 +323,6 @@ removexattrat 466 open_tree_attr 467 file_getattr 468 file_setattr 469 +listns 470 +rseq_slice_yield 471 +fchroot 472
include/lapi/syscalls/i386.in +6 -0
@@ -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
include/lapi/syscalls/loongarch64.in +3 -0
@@ -320,3 +320,6 @@ removexattrat 466 open_tree_attr 467 file_getattr 468 file_setattr 469 +listns 470 +rseq_slice_yield 471 +fchroot 472
include/lapi/syscalls/mips64.in +3 -0
@@ -369,3 +369,6 @@ removexattrat 5466 open_tree_attr 5467 file_getattr 5468 file_setattr 5469 +listns 5470 +rseq_slice_yield 5471 +fchroot 5472
include/lapi/syscalls/mips64n32.in +3 -0
@@ -393,3 +393,6 @@ removexattrat 6466 open_tree_attr 6467 file_getattr 6468 file_setattr 6469 +listns 6470 +rseq_slice_yield 6471 +fchroot 6472
include/lapi/syscalls/mipso32.in +5 -2
@@ -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
include/lapi/syscalls/parisc.in +4 -0
@@ -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
include/lapi/syscalls/powerpc.in +7 -0
@@ -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
include/lapi/syscalls/powerpc64.in +7 -0
@@ -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
include/lapi/syscalls/s390x.in +4 -0
@@ -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
include/lapi/syscalls/sh.in +4 -0
@@ -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
include/lapi/syscalls/sparc.in +5 -0
@@ -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
include/lapi/syscalls/sparc64.in +5 -0
@@ -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
include/lapi/syscalls/x86_64.in +4 -0
@@ -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
Signature · 5 lines
2.51.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Andrea Cervesato via ltp
AppliedRe: [LTP] [PATCH v2 2/2] syscalls: Update numbers to Linux v7.3-rc5
Merged, Thanks!
--
Andrea Cervesato
SUSE QE Automation Engineer Linux
[email protected]
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp