Skip to contentSkip to conversation

x86/ibt: use noinstr for is_endbr()

PATCH New Menglong Dong 1 participant 1 message Oct 10, 2025 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/ibt: use noinstr for is_endbr()

Make is_endbr() invisible to tracing, which has security benefits, as we discussed in [1].

---
 arch/x86/include/asm/ibt.h    | 2 +-
 arch/x86/kernel/alternative.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
arch/x86/include/asm/ibt.h +1 -1
index 5e45d6424722..54937a527042 100644
@@ -65,7 +65,7 @@ static __always_inline __attribute_const__ u32 gen_endbr_poison(void)
 	return 0xd6401f0f; /* nopl -42(%rax) */
 }
 
-static inline bool __is_endbr(u32 val)
+static __always_inline bool __is_endbr(u32 val)
 {
 	if (val == gen_endbr_poison())
 		return true;
arch/x86/kernel/alternative.c +1 -1
index 8ee5ff547357..9d07dcbd9b1d 100644
@@ -1108,7 +1108,7 @@ void __init_or_module noinline apply_returns(s32 *start, s32 *end) { }
 
 #ifdef CONFIG_X86_KERNEL_IBT
 
-__noendbr bool is_endbr(u32 *val)
+__noendbr noinstr bool is_endbr(u32 *val)
 {
 	u32 endbr;
 
Signature · 1 line
2.51.0