diff options
author | Peter Zijlstra <peterz@infradead.org> | 2022-03-08 18:30:44 +0300 |
---|---|---|
committer | Peter Zijlstra <peterz@infradead.org> | 2022-03-15 12:32:42 +0300 |
commit | cb9010f87dcbcdbb51cc96b922c6260848cecbd1 (patch) | |
tree | 851cffc6519f0cdfbd0d91a0703a10b090a09c1a | |
parent | 2b6ff7dea670a4623fae1d2349806fc7f8e305d1 (diff) | |
download | linux-cb9010f87dcbcdbb51cc96b922c6260848cecbd1.tar.xz |
x86/ibt: Ensure module init/exit points have references
Since the references to the module init/exit points only have external
references, a module LTO run will consider them 'unused' and seal
them, leading to an immediate fail on module load.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Josh Poimboeuf <jpoimboe@redhat.com>
Link: https://lore.kernel.org/r/20220308154319.113767246@infradead.org
-rw-r--r-- | include/linux/cfi.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/include/linux/cfi.h b/include/linux/cfi.h index 879744aaa6e0..c6dfc1ed0626 100644 --- a/include/linux/cfi.h +++ b/include/linux/cfi.h @@ -34,8 +34,17 @@ static inline void cfi_module_remove(struct module *mod, unsigned long base_addr #else /* !CONFIG_CFI_CLANG */ -#define __CFI_ADDRESSABLE(fn, __attr) +#ifdef CONFIG_X86_KERNEL_IBT + +#define __CFI_ADDRESSABLE(fn, __attr) \ + const void *__cfi_jt_ ## fn __visible __attr = (void *)&fn + +#endif /* CONFIG_X86_KERNEL_IBT */ #endif /* CONFIG_CFI_CLANG */ +#ifndef __CFI_ADDRESSABLE +#define __CFI_ADDRESSABLE(fn, __attr) +#endif + #endif /* _LINUX_CFI_H */ |