[Devel] [PATCH vz10 2/2] x86/ibt: fix -Wignored-attributes in BPF programs

Eva Kurchatova eva.kurchatova at virtuozzo.com
Thu May 7 18:58:03 MSK 2026


BPF programs include arch-specific headers, like x86/ibt

Clang warns when compiling BPF kernel programs because kernel headers
use the nocf_check attribute (__noendbr macro) which requires
-fcf-protection, but this flag is meaningless for the BPF target

Fix this by only using nocf_check attribute when CET is enabled

https://virtuozzo.atlassian.net/browse/VSTOR-127585
feature: fix kselftests

Signed-off-by: Eva Kurchatova <eva.kurchatova at virtuozzo.com>
---
 arch/x86/include/asm/ibt.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/x86/include/asm/ibt.h b/arch/x86/include/asm/ibt.h
index 6c53ece42dea..0f12b375c7e9 100644
--- a/arch/x86/include/asm/ibt.h
+++ b/arch/x86/include/asm/ibt.h
@@ -29,7 +29,11 @@
 #define ASM_ENDBR	"endbr32\n\t"
 #endif
 
+#ifdef __CET__
 #define __noendbr	__attribute__((nocf_check))
+#else
+#define __noendbr      __attribute__(())
+#endif
 
 /*
  * Create a dummy function pointer reference to prevent objtool from marking
-- 
2.54.0



More information about the Devel mailing list