Skip to content

Commit be8a096

Browse files
author
Peter Zijlstra
committed
x86,bpf: Avoid IBT objtool warning
Clang can inline emit_indirect_jump() and then folds constants, which results in: | vmlinux.o: warning: objtool: emit_bpf_dispatcher()+0x6a4: relocation to !ENDBR: .text.__x86.indirect_thunk+0x40 | vmlinux.o: warning: objtool: emit_bpf_dispatcher()+0x67d: relocation to !ENDBR: .text.__x86.indirect_thunk+0x40 | vmlinux.o: warning: objtool: emit_bpf_tail_call_indirect()+0x386: relocation to !ENDBR: .text.__x86.indirect_thunk+0x20 | vmlinux.o: warning: objtool: emit_bpf_tail_call_indirect()+0x35d: relocation to !ENDBR: .text.__x86.indirect_thunk+0x20 Suppress the optimization such that it must emit a code reference to the __x86_indirect_thunk_array[] base. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Acked-by: Alexei Starovoitov <ast@kernel.org> Link: https://lkml.kernel.org/r/20220405075531.GB30877@worktop.programming.kicks-ass.net
1 parent 7a53f40 commit be8a096

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

arch/x86/net/bpf_jit_comp.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,7 @@ static void emit_indirect_jump(u8 **pprog, int reg, u8 *ip)
412412
EMIT_LFENCE();
413413
EMIT2(0xFF, 0xE0 + reg);
414414
} else if (cpu_feature_enabled(X86_FEATURE_RETPOLINE)) {
415+
OPTIMIZER_HIDE_VAR(reg);
415416
emit_jump(&prog, &__x86_indirect_thunk_array[reg], ip);
416417
} else
417418
#endif

0 commit comments

Comments
 (0)