Subject: Re: [PATCH v8] arm64: Use static call trampolines when kCFI is enabled

From: Catalin Marinas <[email-masked]>
Date: Wed, 1 Apr 2026 15:31:59 +0100

On Wed, Apr 01, 2026 at 02:03:22PM +0200, Ard Biesheuvel wrote:
> 
> On Wed, 1 Apr 2026, at 12:03, Will Deacon wrote:
> > On Tue, 31 Mar 2026 13:04:23 +0200, Ard Biesheuvel wrote:
> >> Implement arm64 support for the 'unoptimized' static call variety, which
> >> routes all calls through a trampoline that performs a tail call to the
> >> chosen function, and wire it up for use when kCFI is enabled. This works
> >> around an issue with kCFI and generic static calls, where the prototypes
> >> of default handlers such as __static_call_nop() and __static_call_ret0()
> >> don't match the expected prototype of the call site, resulting in kCFI
> >> false positives [0].
> >> 
> >> [...]
> >
> > Applied to arm64 (for-next/fixes), thanks!
> >
> > [1/1] arm64: Use static call trampolines when kCFI is enabled
> >       https://git.kernel.org/arm64/c/e70c2335f889
> >
> 
> Thanks,
> 
> I just spotted that the function name gets stringified twice inadvertently.
> 
> E.g., the assembler may see
> 
> .quad "__static_call_return0"
> 
> rather than the intended
> 
> .quad __static_call_return0
> 
> The assembler does not seem to care, and still emits an ABS64 relocation against the correct symbol, but it is definitely unintentional.
> 
> I can send a follow-up fix if you prefer, or you could just tweak the patch in place:
> 
> --- a/arch/arm64/include/asm/static_call.h
> +++ b/arch/arm64/include/asm/static_call.h
> @@ -16,7 +16,7 @@
>             "   .popsection                                     \n" \
>             "   .pushsection .rodata, \"a\"                     \n" \
>             "   .align  3                                       \n" \
> -           "1: .quad   " #target "                             \n" \
> +           "1: .quad   " target "                              \n" \
>             "   .popsection                                     \n")

Not sure Will is going to look at this until next week. I folded it into
the arm64 for-next/fixes branch and pushed out.

-- 
Catalin