Re: [PATCH RFC] x86/syscall: Dispatch via sys_call_table when Spectre v2 and BHI are off

From: Breno Leitao

Date: Mon Nov 02 2026 - 14:14:27 EST


Hello Linus,

On Fri, Oct 30, 2026 at 08:56:12AM -1000, Linus Torvalds wrote:
> On Thu, 29 Oct 2026 at 02:30, Breno Leitao <leitao@xxxxxxxxxx> wrote:
>
> We could have a single static jump that picks between this one and the
> "conditional branch tree" version, as in your patch at the beginning
> of the thread.

I am looking at this on top of Peter's "x86: Harden syscall dispatch"
series [1], and before spending more time on it, I would like to
clarify how you see this suggestion fitting with Peter's series.

Peter's patch 1 makes -fno-jump-tables unconditional on x86_64 and
drops array_index_nospec() from the dispatch. Patch 4 then marks every
syscall __noendbr, since dispatch is only direct calls.

The computed jump you suggested is somehow a jump table, just without
the load: the syscall number picks the target of an indirect JMP. So I
suspect we don't need array_index_nospec() back on that path, given
the user explictly set mitigations=off (?).

Is that what you had in mind:

a) the switch tree by default
b) table as a fast path only for kernels booted with mitigations
disabled

Thanks,
--breno

[1] https://lore.kernel.org/all/20261102112549.714541309@xxxxxxxxxxxxx/