0001
0002
0003
0004
0005
0006
0007 #ifndef _LINUX_CFI_H
0008 #define _LINUX_CFI_H
0009
0010 #ifdef CONFIG_CFI_CLANG
0011 typedef void (*cfi_check_fn)(uint64_t id, void *ptr, void *diag);
0012
0013
0014 extern void __cfi_check(uint64_t id, void *ptr, void *diag);
0015
0016
0017
0018
0019
0020 #define __CFI_ADDRESSABLE(fn, __attr) \
0021 const void *__cfi_jt_ ## fn __visible __attr = (void *)&fn
0022
0023 #ifdef CONFIG_CFI_CLANG_SHADOW
0024
0025 extern void cfi_module_add(struct module *mod, unsigned long base_addr);
0026 extern void cfi_module_remove(struct module *mod, unsigned long base_addr);
0027
0028 #else
0029
0030 static inline void cfi_module_add(struct module *mod, unsigned long base_addr) {}
0031 static inline void cfi_module_remove(struct module *mod, unsigned long base_addr) {}
0032
0033 #endif
0034
0035 #else
0036
0037 #ifdef CONFIG_X86_KERNEL_IBT
0038
0039 #define __CFI_ADDRESSABLE(fn, __attr) \
0040 const void *__cfi_jt_ ## fn __visible __attr = (void *)&fn
0041
0042 #endif
0043
0044 #endif
0045
0046 #ifndef __CFI_ADDRESSABLE
0047 #define __CFI_ADDRESSABLE(fn, __attr)
0048 #endif
0049
0050 #endif