Re: [PATCH RFC 1/4] syscalls: Create unified partial table for all archs

André Almeida <[email protected]> Fri, 24 Jul 2026 17:18:48 -0300
Newsgroups org.kernel.vger.linux-kbuild,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
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 <[email protected]>
> 
> 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