Linux 5.10 To See Static Calls For Helping Cases Where Retpolines Are Used

Written by Michael Larabel in Linux Security on 12 October 2020 at 01:07 PM EDT. 3 Comments
LINUX SECURITY
A new kernel feature sent in today for the Linux 5.10 merge window is static calls, which can be helpful in cases where Retpolines (return trampolines) are currently used as part of protections against speculative execution vulnerabilities like Spectre.

Worked on by Red Hat and others is static calls as a replacement to global function pointers in the kernel. Static calls rely on code patching to allow for direct calls to be used rather than indirect and yield better performance especially where Retpolines are otherwise used.

The pull for mainlining static calls in Linux 5.10 mentions, "This tree introduces static_call(), which is the idea of static_branch() applied to indirect function calls. Remove a data load (indirection) by modifying the text. They give the flexibility of function pointers, but with better performance...x86 is supported via text patching, otherwise basic indirect calls are used, with function pointers...The new APIs are utilized in the x86 perf code, a heavy user of function pointers, where static calls speed up the PMU handler by 4.2% (!)."

This patch outlines more of the technical details on the Linux kernel static calls implementation for those interested.
Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via MichaelLarabel.com.

Popular News This Week