[clang] [Clang][attr] Add 'kcfi_salt' attribute (PR #141846)

Sami Tolvanen via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 17 16:48:59 PDT 2025


================
@@ -0,0 +1,190 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm -fsanitize=kcfi -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm -fsanitize=kcfi -x c++ -o - %s | FileCheck %s --check-prefixes=CHECK,MEMBER
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm -fsanitize=kcfi -fpatchable-function-entry-offset=3 -o - %s | FileCheck %s --check-prefixes=CHECK,OFFSET
+
+// Note that the interleving of functions, which normally would be in sequence,
+// is due to the fact that Clang outputs them in a non-sequential order.
+
+#if !__has_feature(kcfi)
----------------
samitolvanen wrote:

> Can you work out what a few of those are? The attribute only helps if we can actually partition them.

I updated the previous comment to include the most popular types. The first two we should be able to partition better. I'm less sure about trace functions, sysfs callbacks, or syscall stubs though. Note that I only looked at the available call targets, it's possible that there are no actual indirect call sites for some types.

https://github.com/llvm/llvm-project/pull/141846


More information about the cfe-commits mailing list