Re: [PATCH] x86/kexec: Type relocate_kernel() to drop __nocfi

From: Ben Cressey

Date: Mon Nov 23 2026 - 13:28:28 EST


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.