Skip to content

Commit

Permalink
x86/ibt: Ensure module init/exit points have references
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Peter Zijlstra committed Mar 15, 2022
1 parent 2b6ff7d commit cb9010f
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion include/linux/cfi.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

0 comments on commit cb9010f

Please sign in to comment.