Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
From: David Laight <david.laight.linux@gmail.com>
To: Nathan Chancellor <nathan@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@redhat.com>,
	Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	x86@kernel.org, Ard Biesheuvel <ardb@kernel.org>,
	Nick Desaulniers <nick.desaulniers+lkml@gmail.com>,
	Bill Wendling <morbo@google.com>,
	Justin Stitt <justinstitt@google.com>,
	linux-kernel@vger.kernel.org, llvm@lists.linux.dev,
	stable@vger.kernel.org
Subject: Re: [PATCH] x86/boot/compressed: Disable jump tables for clang
Date: Thu, 25 Jun 2026 09:06:17 +0100	[thread overview]
Message-ID: <20260625090617.4f3f68bf@pumpkin> (raw)
In-Reply-To: <20260624221739.GA7516@ax162>

On Wed, 24 Jun 2026 15:17:39 -0700
Nathan Chancellor <nathan@kernel.org> wrote:

> On Wed, Jun 24, 2026 at 11:55:10AM +0200, Ingo Molnar wrote:
> > 
> > * Ingo Molnar <mingo@kernel.org> 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

Isn't this solving a different problem?
Jump tables are disabled for the kernel build to avoid speculation of
mispredicted indirect jumps.
Here they are needed to stop the compiler output containing 'things' the
restricted environment can't support.

Someone building a kernel for a local machine may want to disable all of
the mitigations to avoid their associated costs and also enable jump
tables to avoid the cost of all the mispredicted branches in the comparison
tree.

	David

      reply	other threads:[~2026-06-25  8:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-23 21:47 [PATCH] x86/boot/compressed: Disable jump tables for clang Nathan Chancellor
2026-06-24  9:36 ` Ingo Molnar
2026-06-24  9:38   ` Peter Zijlstra
2026-06-24  9:51     ` Ingo Molnar
2026-06-24  9:55       ` Ingo Molnar
2026-06-24 22:17         ` Nathan Chancellor
2026-06-25  8:06           ` David Laight [this message]

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=20260625090617.4f3f68bf@pumpkin \
    --to=david.laight.linux@gmail.com \
    --cc=ardb@kernel.org \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=justinstitt@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=mingo@kernel.org \
    --cc=mingo@redhat.com \
    --cc=morbo@google.com \
    --cc=nathan@kernel.org \
    --cc=nick.desaulniers+lkml@gmail.com \
    --cc=peterz@infradead.org \
    --cc=stable@vger.kernel.org \
    --cc=tglx@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