[patch 0/4] entry: Rework syscall skip logic

Thomas Gleixner posted 4 patches 1 week, 6 days ago
Documentation/core-api/entry.rst |   45 +++++++++++++++++++++++-------
arch/loongarch/kernel/syscall.c  |   14 ++++-----
arch/powerpc/kernel/syscall.c    |    3 +-
arch/riscv/kernel/traps.c        |   11 +++----
arch/s390/kernel/syscall.c       |    7 +++-
arch/x86/entry/syscall_32.c      |   25 ++++++++--------
arch/x86/entry/syscall_64.c      |   12 ++++----
include/linux/entry-common.h     |   58 +++++++++++++++++----------------------
kernel/entry/syscall-common.c    |   19 ++++++++----
9 files changed, 110 insertions(+), 84 deletions(-)
[patch 0/4] entry: Rework syscall skip logic
Posted by Thomas Gleixner 1 week, 6 days ago
This are the reworked leftovers of the larger entry logic rework series,
which can be found here:

  https://lore.kernel.org/lkml/20260707181957.433213175@kernel.org

The undisputed part of the series has been merged into:

  git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git core/entry

After a fruitless discussion about the most resilent approach, I decided to
give up wasting my time and reworked the series so it caters to the desire
of powerpc and s390 to be special.

That results in almost identical behavior except for the case where
tracing/probe/BPF sets the syscall number to -1 (or any other out of range
value) and also sets the syscall return value to something different than
-ENOSYS.

PowerPC and S390 will overwrite that value with -ENOSYS.

Loongarch, RISC-V and x86 will not overwrite it because those architectures
preset the return value to -ENOSYS and skip out of range syscalls
completely. Loongarch and RISC-V always did the out of range skip. X86
gained that in the already applied rework, which means that the final patch
which splits the skip decision from the syscall number does not longer
change x86 behavior for the above case.

Documentation is also updated and describes the two implementation variants
and the subtle difference in the resulting behavior.

The series applies on top of:

  git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git core/entry

and is also available from git:

  git://git.kernel.org/pub/scm/linux/kernel/git/tglx/devel.git entry/rework

Thanks,

	tglx
---
 Documentation/core-api/entry.rst |   45 +++++++++++++++++++++++-------
 arch/loongarch/kernel/syscall.c  |   14 ++++-----
 arch/powerpc/kernel/syscall.c    |    3 +-
 arch/riscv/kernel/traps.c        |   11 +++----
 arch/s390/kernel/syscall.c       |    7 +++-
 arch/x86/entry/syscall_32.c      |   25 ++++++++--------
 arch/x86/entry/syscall_64.c      |   12 ++++----
 include/linux/entry-common.h     |   58 +++++++++++++++++----------------------
 kernel/entry/syscall-common.c    |   19 ++++++++----
 9 files changed, 110 insertions(+), 84 deletions(-)
Re: [patch 0/4] entry: Rework syscall skip logic
Posted by Michal Suchánek 1 week, 4 days ago
On Sun, Jul 12, 2026 at 11:25:12PM +0200, Thomas Gleixner wrote:
> This are the reworked leftovers of the larger entry logic rework series,
> which can be found here:
> 
>   https://lore.kernel.org/lkml/20260707181957.433213175@kernel.org
> 
> The undisputed part of the series has been merged into:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git core/entry
> 
> After a fruitless discussion about the most resilent approach, I decided to
> give up wasting my time and reworked the series so it caters to the desire
> of powerpc and s390 to be special.
> 
> That results in almost identical behavior except for the case where
> tracing/probe/BPF sets the syscall number to -1 (or any other out of range
> value) and also sets the syscall return value to something different than
> -ENOSYS.
> 
> PowerPC and S390 will overwrite that value with -ENOSYS.
> 
> Loongarch, RISC-V and x86 will not overwrite it because those architectures
> preset the return value to -ENOSYS and skip out of range syscalls
> completely. Loongarch and RISC-V always did the out of range skip. X86
> gained that in the already applied rework, which means that the final patch
> which splits the skip decision from the syscall number does not longer
> change x86 behavior for the above case.
> 
> Documentation is also updated and describes the two implementation variants
> and the subtle difference in the resulting behavior.
> 
> The series applies on top of:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git core/entry
> 
> and is also available from git:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/tglx/devel.git entry/rework

Hello,

applying this on top of 7.2~rc3 and running tests for the cases that
were reported as problematic I see results as expected.

This version of the patchset works for me.

Tested-by: Michal Suchánek <msuchanek@suse.de>

This is certainly not comprehensive, there are many corner cases not
tested. Some were broken to start with as well.

Thanks

Michal