|
|
Subscribe / Log in / New account

Avoiding retpolines with static calls

Avoiding retpolines with static calls

Posted Mar 29, 2020 0:39 UTC (Sun) by ndesaulniers (subscriber, #110768)
In reply to: Avoiding retpolines with static calls by alison
Parent article: Avoiding retpolines with static calls

Consider the difference between having a collection of different objects, and calling a similarly identified method on each of them, vs having a function pointer that once assigned to never changes. In the latter case, it would be nice to provide some form of optimization for these write once semantics (or even write-infrequently semantics, as is the current use of static keys). In this case, it's possible to replace indirect calls with direct calls, and change them only when needed, which is both infrequent and relatively expensive compared to the cost of an indirect call. You have to be careful about leaving enough space to patch in a jmp to an offset within an encode-able range, and be careful about concurrent modifications, but it's possible, and the kernel does so today, via static keys.


to post comments


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds