aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/compiler.h
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2025-02-07 13:15:33 +0100
committerPeter Zijlstra <peterz@infradead.org>2025-02-14 10:32:05 +0100
commit582077c94052bd69a544b3f9d7619c9c6a67c34b (patch)
treedd33a2f40b5f832d0790ede0d047f5a327d69cc9 /include/linux/compiler.h
parentx86,kcfi: Fix EXPORT_SYMBOL vs kCFI (diff)
downloadlinux-rng-582077c94052bd69a544b3f9d7619c9c6a67c34b.tar.xz
linux-rng-582077c94052bd69a544b3f9d7619c9c6a67c34b.zip
x86/cfi: Clean up linkage
With the introduction of kCFI the addition of ENDBR to SYM_FUNC_START* no longer suffices to make the function indirectly callable. This now requires the use of SYM_TYPED_FUNC_START. As such, remove the implicit ENDBR from SYM_FUNC_START* and add some explicit annotations to fix things up again. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Reviewed-by: Sami Tolvanen <samitolvanen@google.com> Link: https://lore.kernel.org/r/20250207122546.409116003@infradead.org
Diffstat (limited to 'include/linux/compiler.h')
-rw-r--r--include/linux/compiler.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 200fd3c5bc70..aa7f0a9f6085 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -212,6 +212,16 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,
#endif /* __KERNEL__ */
+#if defined(CONFIG_CFI_CLANG) && !defined(__DISABLE_EXPORTS) && !defined(BUILD_VDSO)
+/*
+ * Force a reference to the external symbol so the compiler generates
+ * __kcfi_typid.
+ */
+#define KCFI_REFERENCE(sym) __ADDRESSABLE(sym)
+#else
+#define KCFI_REFERENCE(sym)
+#endif
+
/**
* offset_to_ptr - convert a relative memory offset to an absolute pointer
* @off: the address of the 32-bit offset value