Re: [PATCH] x86/build/64: Prevent native builds from generating APX instructions

"Chang S. Bae" <[email protected]> Sun, 2 Aug 2026 14:32:32 -0700
Newsgroups org.kernel.vger.stable,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On 8/2/2026 2:08 AM, David Laight wrote:
> 
> Does that mean that this patch is completely unnecessary?
It is necessary. On APX systems running, e.g. Linux kernel v6.16+, with 
the OS enables XCR0.APX, the compiler may consider all 32 registers 
usable and the compiled kernel inadvertently emits APX instructions 
(unconditionally) clobbering those registers. So -mno apxf prevents such 
unintended in-kernel use.

Note that mainline currently supports only userspace APX, where user 
EGPR state is context-switched through the XSAVE mechanism. That alone 
is insufficient to support in-kernel uses. Like the legacy GPRs, EGPRs 
need to be handled on entry paths, and there are still many other things 
to consider before in-kernel usages.

Thanks,
Chang