[patch 16/18] x86/entry: Get rid of the sys_ni_syscall() indirection

Thomas Gleixner tglx at kernel.org
Thu Oct 22 12:15:59 PDT 2026


On Thu, Oct 22 2026 at 16:24, Sebastian Andrzej Siewior wrote:
> On 2026-07-07 21:07:01 [+0200], Thomas Gleixner wrote:
>> Invoking sys_ni_syscall() from a code path, which already knows that the
>> syscall number is invalid just to assign -ENOSYS to regs->ax is a pointless
>> exercise. It's even redundant as the low level entry code already has set
>> regs->ax to -ENOSYS on entry.
>> 
>> Remove the extra conditionals and the function calls.
>
> Since this patch, tools/testing/selftests/x86/syscall_numbering_64
> throws in this:
> |[RUN]   Running tests under ptrace: modifying the default return
> |[RUN]       Checking system calls with msb = 0 (0x0)
> |[RUN]           Checking some common syscalls as 64 bit
> |[OK]                x64 syscall 0:0 returned 0 as expected
> |[OK]                x64 syscall 0:1 returned 0 as expected
> |[RUN]           Checking some 64-bit only syscalls as 64 bit
> |[OK]                x64 syscall 0:19 returned 0 as expected
> |[OK]                x64 syscall 0:20 returned 0 as expected
> |[RUN]           Checking out of range system calls
> |[FAIL]                  x32 syscall 0:-64 returned -9999, but it should have returned -ENOSYS
> …
> |[FAIL]                  x32 syscall 0:-2 returned -9999, but it should have returned -ENOSYS
> |[FAIL]              x32 syscalls 0:-64..-2 had 63 failure
> |[OK]                x32 syscall 0:-1 returned MODIFIED_BY_PTRACE as expected
> |[FAIL]                  x64 syscall 0:1073741760 returned -9999, but it should have returned -ENOSYS
> …
> |[FAIL]                  x64 syscall 0:1073741823 returned -9999, but it should have returned -ENOSYS
> |[FAIL]              x64 syscalls 0:1073741760..1073741823 had 64 failure
> |[FAIL]                  x64 syscall 0:-64 returned -9999, but it should have returned -ENOSYS
> …
> |[FAIL]                  x64 syscall 0:547 returned -9999, but it should have returned -ENOSYS
> |[FAIL]              x64 syscalls 0:512..547 had 36 failure
> |[RUN]           Checking some common syscalls as x32
> |[OK]                x32 syscall 0:0 returned 0 as expected
> …
> |[RUN]           Checking out of range system calls
> |[FAIL]                  x32 syscall 1:-64 returned -9999, but it should have returned -ENOSYS
> |[FAIL]              x32 syscalls 1:-64..-2 had 63 failure
> |[OK]                x32 syscall 1:-1 returned MODIFIED_BY_PTRACE as expected
> |[FAIL]                  x64 syscall 1:1073741760 returned -9999, but it should have returned -ENOSYS
> …
>
> and so on… The test has
>
> | #define MODIFIED_BY_PTRACE      -9999
>
> and the ptracer modifies the return code. However not always. Not sure
> if this was indeed a pointless exercise or not.

Hrmm. That's weird. Let me have a look.



More information about the linux-riscv mailing list