Re: [PATCH] static_call: use CFI-compliant return0 stubs
From: Peter Zijlstra
Date: Wed Mar 11 2026 - 19:15:55 EST
On Wed, Mar 11, 2026 at 10:57:40PM +0000, Carlos Llamas wrote:
> Architectures with !HAVE_STATIC_CALL (such as arm64) rely on the generic
> static_call implementation via indirect calls. In particular, users of
> DEFINE_STATIC_CALL_RET0, default to the generic __static_call_return0
> stub to optimize the unset path.
>
> However, __static_call_return0 has a fixed signature of "long (*)(void)"
> which may not match the expected prototype at callsites. This triggers
> CFI failures when CONFIG_CFI is enabled. A trivial linux-perf command
> does it:
*sigh*...
And ARM64 can't really do the inline thing because its immediate range
is too small and it all turns into a mess constructing the address in a
register and doing an indirect call anyway, right?
I'll stare at it in more detail tomorrow.