From 384becf1643b7f5e4eea2ed46802a7377d44c6f0 Mon Sep 17 00:00:00 2001 From: Quentin Perret Date: Fri, 30 Oct 2020 12:13:32 +0000 Subject: [PATCH] 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 --- include/trace/hooks/vendor_hooks.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/trace/hooks/vendor_hooks.h b/include/trace/hooks/vendor_hooks.h index e6cabd366eeb..c483e0b9c0a8 100644 --- a/include/trace/hooks/vendor_hooks.h +++ b/include/trace/hooks/vendor_hooks.h @@ -70,7 +70,7 @@ extern int __traceiter_##name(data_proto); \ DECLARE_STATIC_CALL(tp_func_##name, __traceiter_##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)) \ DO_HOOK(name, \