From: Andrew Cooper <andrew.cooper3@citrix.com>
To: torvalds@linux-foundation.org
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
bp@alien8.de, dave.hansen@linux.intel.com, hpa@zytor.com,
jpoimboe@kernel.org, justinstitt@google.com,
kernel-team@meta.com, leitao@debian.org,
linux-kernel@vger.kernel.org, llvm@lists.linux.dev,
luto@kernel.org, mingo@redhat.com, morbo@google.com,
nathan@kernel.org, ndesaulniers@google.com,
pawan.kumar.gupta@linux.intel.com, peterz@infradead.org,
tglx@kernel.org, x86@kernel.org
Subject: Re: [PATCH RFC] x86/syscall: Dispatch via sys_call_table when Spectre v2 and BHI are off
Date: Mon, 2 Nov 2026 20:06:02 +0000 [thread overview]
Message-ID: <86f2f603-c1a7-4715-ad43-ac9c90f6a837@citrix.com> (raw)
In-Reply-To: <CAHk-=wjg-mre6diNHCTYUtc=X26462GGxgJMw8cE20Wh1-5qBQ@mail.gmail.com>
> I do wonder if we could do computed jumps. It would be lovely if we
> could basically do something like
>
> # syscall number in %rax
> leaq table(%rax,%rax,4),%rax
> jmp *%rax
> table:
> jmp syscall0
> jmp syscall1
> jmp syscall2
> ....
>
> and avoid any indirect memory lookup or indirect branches (outside of
> the one computed one). And no extra call/ret frame.
You would need ENDBR64's too, when building for CET-IBT.
> It's possible that the branch prediction hardware hates those kinds of
> very dense jmp patterns, though. I don't know.
This doesn't buy you anything, except a larger code footprint and more
branch predictor pressure.
The moment you've got any indirect branch reasonable from the syscall
entrypoint, you're open to all the Spectre v2 attacks.
That's fine if the user wants to go fast, but then just use a real jump
table pointing to the real system calls. This is a Not-Inveted-Here
halfway house which is just extra bytes to decode and an extra jump to
perform.
~Andrew
next prev parent reply other threads:[~2026-11-02 20:08 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-29 10:27 Breno Leitao
2026-10-29 10:49 ` Peter Zijlstra
2026-10-29 12:30 ` Breno Leitao
2026-10-29 12:39 ` Peter Zijlstra
2026-10-30 5:38 ` Borislav Petkov
2026-10-30 12:11 ` Breno Leitao
2026-10-30 18:34 ` Borislav Petkov
2026-10-30 18:56 ` Linus Torvalds
2026-10-30 19:03 ` H. Peter Anvin
2026-11-02 18:49 ` Breno Leitao
2026-11-02 20:02 ` Linus Torvalds
2026-11-02 20:06 ` Andrew Cooper [this message]
2026-11-02 20:11 ` Linus Torvalds
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=86f2f603-c1a7-4715-ad43-ac9c90f6a837@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=jpoimboe@kernel.org \
--cc=justinstitt@google.com \
--cc=kernel-team@meta.com \
--cc=leitao@debian.org \
--cc=linux-kernel@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=luto@kernel.org \
--cc=mingo@redhat.com \
--cc=morbo@google.com \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=pawan.kumar.gupta@linux.intel.com \
--cc=peterz@infradead.org \
--cc=tglx@kernel.org \
--cc=torvalds@linux-foundation.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®