[PATCH 0/6] x86: Harden syscall dispatch

From: Peter Zijlstra

Date: Mon Nov 02 2026 - 06:41:52 EST


Hi!

These few patches harden the syscall dispatch by making -fno-jump-table
unconditional for x86_64 and then having all SYSCALL*() macros mark the actual
syscall entry points with __noendbr.

Notably, we already have -fno-jump-table for KERNEL_IBT || RETPOLINE, which
means effectively everybody already has this. However, making this
unconditional has the nice side effect that the compilers must never generate
array accesses and it is safe to remove array_index_nospec().

Additionally, since dispatch is now forced to be a binary decision tree with
direct (tail) calls, there are no valid indirect calls to any of the syscall
functions and they can be marked __noendbr.

This means anything trying to use the sys_call_table[] will fail (on hardware
sporting IBT).

All this makes the normal system call hijack a lot more difficult.

Patches also at:

git://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git x86/syscall

---
arch/x86/Kconfig | 4 +---
arch/x86/Makefile | 27 +++++++---------------
arch/x86/entry/calling.h | 1 -
arch/x86/entry/common.c | 2 +-
arch/x86/entry/entry_64.S | 2 +-
arch/x86/entry/entry_64_compat.S | 6 ++---
arch/x86/entry/entry_fred.c | 6 ++---
arch/x86/entry/syscall_32.c | 20 ++++++++++-------
arch/x86/entry/syscall_64.c | 24 +++++++++++++-------
arch/x86/include/asm/entry-common.h | 2 +-
arch/x86/include/asm/fred.h | 6 ++---
arch/x86/include/asm/syscall.h | 10 ++++-----
arch/x86/include/asm/syscall_wrapper.h | 23 ++++++++++---------
arch/x86/lib/clear_page_64.S | 1 -
arch/x86/lib/copy_user_64.S | 1 -
arch/x86/lib/copy_user_uncached_64.S | 1 -
arch/x86/lib/getuser.S | 4 ----
arch/x86/lib/hweight.S | 3 ---
arch/x86/lib/putuser.S | 4 ----
include/linux/annotate.h | 1 +
include/linux/instrumentation.h | 17 ++++++++++++++
include/linux/objtool_types.h | 1 +
tools/include/linux/objtool_types.h | 1 +
tools/objtool/check.c | 41 ++++++++++++++++++++++++++--------
24 files changed, 118 insertions(+), 90 deletions(-)