Re: [PATCH bpf-next v9 4/5] bpf, x86: Emit ENDBR for indirect jump targets
From: Xu Kuohai
Date: Sat Mar 14 2026 - 02:48:57 EST
On 3/13/2026 6:15 PM, Leon Hwang wrote:
+#ifdef CONFIG_X86_KERNEL_IBTNIT: is this CONFIG check necessary?
+ if (bpf_insn_is_indirect_target(env, bpf_prog, i - 1))
+ EMIT_ENDBR();
+#endif
EMIT_ENDBR already checks it.
#ifdef CONFIG_X86_KERNEL_IBT
#define EMIT_ENDBR() EMIT(gen_endbr(), 4)
#define EMIT_ENDBR_POISON() EMIT(gen_endbr_poison(), 4)
#else
#define EMIT_ENDBR()
#define EMIT_ENDBR_POISON()
#endif
Well, the code was originally written exactly without the #ifdef, but it triggered
-Wempty-body warning: https://lore.kernel.org/bpf/202603051414.AAMjmOHv-lkp@xxxxxxxxx/.