Skip to content

Commit 2d21889

Browse files
jpbruckerwilldeacon
authored andcommitted
arm64: Don't insert a BTI instruction at inner labels
Some ftrace features are broken since commit 714a8d0 ("arm64: asm: Override SYM_FUNC_START when building the kernel with BTI"). For example the function_graph tracer: $ echo function_graph > /sys/kernel/debug/tracing/current_tracer [ 36.107016] WARNING: CPU: 0 PID: 115 at kernel/trace/ftrace.c:2691 ftrace_modify_all_code+0xc8/0x14c When ftrace_modify_graph_caller() attempts to write a branch at ftrace_graph_call, it finds the "BTI J" instruction inserted by SYM_INNER_LABEL() instead of a NOP, and aborts. It turns out we don't currently need the BTI landing pads inserted by SYM_INNER_LABEL: * ftrace_call and ftrace_graph_call are only used for runtime patching of the active tracer. The patched code is not reached from a branch. * install_el2_stub is reached from a CBZ instruction, which doesn't change PSTATE.BTYPE. * __guest_exit is reached from B instructions in the hyp-entry vectors, which aren't subject to BTI checks either. Remove the BTI annotation from SYM_INNER_LABEL. Fixes: 714a8d0 ("arm64: asm: Override SYM_FUNC_START when building the kernel with BTI") Signed-off-by: Jean-Philippe Brucker <[email protected]> Reviewed-by: Mark Brown <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent e56404e commit 2d21889

File tree

1 file changed

+0
-6
lines changed

1 file changed

+0
-6
lines changed

arch/arm64/include/asm/linkage.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
* instead.
1313
*/
1414
#define BTI_C hint 34 ;
15-
#define BTI_J hint 36 ;
1615

1716
/*
1817
* When using in-kernel BTI we need to ensure that PCS-conformant assembly
@@ -43,11 +42,6 @@
4342
SYM_START(name, SYM_L_WEAK, SYM_A_NONE) \
4443
BTI_C
4544

46-
#define SYM_INNER_LABEL(name, linkage) \
47-
.type name SYM_T_NONE ASM_NL \
48-
SYM_ENTRY(name, linkage, SYM_A_NONE) \
49-
BTI_J
50-
5145
#endif
5246

5347
/*

0 commit comments

Comments
 (0)