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 <[email protected]>
---
 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

_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to