[PATCH] arm64: implement support for static call trampolines

Peter Zijlstra peterz at infradead.org
Mon Oct 19 13:05:50 EDT 2020


On Mon, Oct 19, 2020 at 04:12:47PM +0200, Ard Biesheuvel wrote:
> Implement arm64 support for the 'unoptimized' static call variety,
> which routes all calls through a single trampoline that is patched
> to perform a tail call to the selected function.
> 
> Since static call targets may be located in modules loaded out of
> direct branching range, we need to be able to fall back to issuing
> a ADRP/ADD pair to load the branch target into R16 and use a BR
> instruction. As this involves patching more than a single B or NOP
> instruction (for which the architecture makes special provisions
> in terms of the synchronization needed), we should take care to
> only use aarch64_insn_patch_text_nosync() if the subsequent
> instruction is still a 'RET' (which guarantees that the one being
> patched is a B or a NOP)

Aside of lacking objtool support (which is being worked on), is there
anything else in the way of also doing inline patching for ARM64?

That is; if the function is not reachable by the immediate you can
always leave (re-instate) the call to the trampoline after patching
that.

Anyway, nice to see ARM64 support, thanks!



More information about the linux-arm-kernel mailing list