ANDROID: Disable CFI on restricted vendor hooks
CFI has additional overhead on indirect branches to modules as the target is not known at kernel compile-time. This has been demonstrated to cause problematic performance regressions on benchmarks using GKI together with modularized scheduler callbacks attached to restricted vendor hooks. To restore some of the performance back, let's disable CFI around the restricted hook call sites and issue a raw indirect call in fast paths. We should be able to drop this patch when/if the arm64 static_call port lands upstream [1] as this would make tracepoints circumvent some of the CFI checks using text patching, but that still remain to be proven. [1] https://lore.kernel.org/linux-arm-kernel/20201028184114.6834-1-ardb@kernel.org/ Bug: 168521642 Change-Id: I7cd59f582b12fed15be64059f08122f96786e650 Signed-off-by: Quentin Perret <qperret@google.com>
This commit is contained in:
@@ -70,7 +70,7 @@
|
|||||||
extern int __traceiter_##name(data_proto); \
|
extern int __traceiter_##name(data_proto); \
|
||||||
DECLARE_STATIC_CALL(tp_func_##name, __traceiter_##name); \
|
DECLARE_STATIC_CALL(tp_func_##name, __traceiter_##name); \
|
||||||
extern struct tracepoint __tracepoint_##name; \
|
extern struct tracepoint __tracepoint_##name; \
|
||||||
static inline void trace_##name(proto) \
|
static inline void __nocfi trace_##name(proto) \
|
||||||
{ \
|
{ \
|
||||||
if (static_key_false(&__tracepoint_##name.key)) \
|
if (static_key_false(&__tracepoint_##name.key)) \
|
||||||
DO_HOOK(name, \
|
DO_HOOK(name, \
|
||||||
|
Reference in New Issue
Block a user