On 5/7/26 17:58, Eva Kurchatova wrote:
BPF programs include arch-specific headers, like x86/ibt
dot


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

dot


Fix this by only using nocf_check attribute when CET is enabled

dot


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

Please also let's go with the "mainstream first" approach here.
_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to