Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
From: Ben Cressey <ben@cressey.dev>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@redhat.com>,
	Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	x86@kernel.org, linux-kernel@vger.kernel.org,
	Sami Tolvanen <samitolvanen@google.com>,
	Kees Cook <kees@kernel.org>,
	Nathan Chancellor <nathan@kernel.org>,
	llvm@lists.linux.dev, Josh Poimboeuf <jpoimboe@kernel.org>,
	kexec@lists.infradead.org, David Woodhouse <dwmw2@infradead.org>
Subject: Re: [PATCH] x86/kexec: Type relocate_kernel() to drop __nocfi
Date: Mon, 23 Nov 2026 10:27:57 -0800	[thread overview]
Message-ID: <20261123-re-947c87d493b9@cressey.dev> (raw)
In-Reply-To: <20261112080050.GZ2668804@noisy.programming.kicks-ass.net>

On 2026-11-12, Peter Zijlstra wrote:
> On Wed, Nov 11, 2026 at 03:26:59PM -0800, Ben Cressey wrote:
>> The check guards only the pointer, and not reliably under plain FineIBT,
>> which checks in the callee with IBT off. A failed check panics or hangs
>> with no CFI report, since load_segments() has reset GS.
>
> I don't understand this; what?

Sorry, that was hard to follow. The patch gives relocate_kernel() a kCFI
type. The call to it is then checked, and machine_kexec() no longer
needs __nocfi. It does not fix a known bug.

That paragraph was about the limits of the new check. Plain FineIBT
relies on IBT, which is off at the call, so it can miss a pointer to
code with no preamble. A failed check may panic or hang without a CFI
report because load_segments() has reset GS.

If you'd rather keep __nocfi, I'm happy to drop the patch. Otherwise
I'll send a v2 with simpler text.

      reply	other threads:[~2026-11-23 18:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-11 23:26 [PATCH] x86/kexec: Type relocate_kernel() to drop __nocfi Ben Cressey
2026-11-12  5:59 ` Josh Poimboeuf
2026-11-23 18:29   ` Ben Cressey
2026-11-12  8:00 ` Peter Zijlstra
2026-11-23 18:27   ` Ben Cressey [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=20261123-re-947c87d493b9@cressey.dev \
    --to=ben@cressey.dev \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=dwmw2@infradead.org \
    --cc=hpa@zytor.com \
    --cc=jpoimboe@kernel.org \
    --cc=kees@kernel.org \
    --cc=kexec@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=mingo@redhat.com \
    --cc=nathan@kernel.org \
    --cc=peterz@infradead.org \
    --cc=samitolvanen@google.com \
    --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