Re: [PATCH] x86/boot/compressed: Disable jump tables for clang

From: Nathan Chancellor

Date: Wed Jun 24 2026 - 18:20:12 EST


On Wed, Jun 24, 2026 at 11:55:10AM +0200, Ingo Molnar wrote:
>
> * Ingo Molnar <mingo@xxxxxxxxxx> wrote:
>
>
> > > I'm sitting on a patch to unconditionally disable jump-tables for
> > > x86_64:
> > >
> > > https://web.git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git/log/?h=x86/syscall
> >
> > In particular:
> >
> > https://web.git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git/commit/?h=x86/syscall&id=76612388fe7aa41a8eb88f890d451bc17255eda0
>
> Side note: since arch/x86/boot/compressed/Makefile constructs
> its own KBUILD_CFLAGS, so a change to that Makefile will still
> be required to universally apply -fno-jump-tables and work
> around this Clang optimization in the decompression code.

Right. I had intentionally kept my change scoped to clang to be less
controversial but in the face of Peter's series, it makes sense to do it
for all compilers like Ingo suggested. I have no preference for how we
proceed here. I don't mind sending a v2 with something like

diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile
index 07e0e64b9a98..06934f9691d6 100644
--- a/arch/x86/boot/compressed/Makefile
+++ b/arch/x86/boot/compressed/Makefile
@@ -27,6 +27,7 @@ targets := vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma \
KBUILD_CFLAGS := -m$(BITS) -O2 $(CLANG_FLAGS)
KBUILD_CFLAGS += $(CC_FLAGS_DIALECT)
KBUILD_CFLAGS += -fno-strict-aliasing -fPIE
+KBUILD_CFLAGS += -fno-jump-tables
KBUILD_CFLAGS += -Wundef
KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING
cflags-$(CONFIG_X86_32) := -march=i386
--

Another option would be Peter folding that diff into his series then
once it lands, I could send this patch to the stable team with most of
this patch's justification intact with a note that the equivalent change
has been applied to mainline under a different justification. Just let
me know what you all would prefer.

--
Cheers,
Nathan