From: Peter Zijlstra <peterz@infradead.org>
To: x86@kernel.org
Cc: linux-kernel@vger.kernel.org, peterz@infradead.org,
jpoimboe@kernel.org, leitao@debian.org, keescook@chromium.org,
hpa@zytor.com
Subject: [PATCH 0/6] x86: Harden syscall dispatch
Date: Mon, 02 Nov 2026 12:25:49 +0100 [thread overview]
Message-ID: <20261102112549.714541309@infradead.org> (raw)
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(-)
next reply other threads:[~2026-11-02 11:40 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-02 11:25 Peter Zijlstra [this message]
2026-11-02 11:25 ` [PATCH 1/6] x86_64/entry: Unconditionally use -fno-jump-table Peter Zijlstra
2026-11-02 14:28 ` Breno Leitao
2026-11-02 11:25 ` [PATCH 2/6] objtool: Add instrumentation_weak() Peter Zijlstra
2026-11-02 11:25 ` [PATCH 3/6] x86_64/entry: Make syscall dispatch noinstr Peter Zijlstra
2026-11-02 11:25 ` [PATCH 4/6] x86_64/entry: Mark all syscalls __noendbr Peter Zijlstra
2026-11-02 17:06 ` David Laight
2026-11-02 11:25 ` [PATCH 5/6] objtool: Allow EXPORT_SYMBOL() of __noendbr functions Peter Zijlstra
2026-11-02 11:25 ` [PATCH 6/6] x86_64/entry: Mark C noinstr __noendbr Peter Zijlstra
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261102112549.714541309@infradead.org \
--to=peterz@infradead.org \
--cc=hpa@zytor.com \
--cc=jpoimboe@kernel.org \
--cc=keescook@chromium.org \
--cc=leitao@debian.org \
--cc=linux-kernel@vger.kernel.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®