blob: e27033d5dd53265066aef8ba4b3954db9c744c80 [file] [log] [blame]
Sami Tolvanen00a195e2017-05-11 15:03:36 -07001#ifndef _LINUX_CFI_H
2#define _LINUX_CFI_H
3
4#include <linux/stringify.h>
5
6#ifdef CONFIG_CFI_CLANG
7#ifdef CONFIG_MODULES
8
9typedef void (*cfi_check_fn)(uint64_t, void *, void *);
10
11/* Compiler-generated function in each module, and the kernel */
12#define CFI_CHECK_FN __cfi_check
13#define CFI_CHECK_FN_NAME __stringify(CFI_CHECK_FN)
14
15extern void CFI_CHECK_FN(uint64_t, void *, void *);
16
17#ifdef CONFIG_CFI_CLANG_SHADOW
18extern void cfi_module_add(struct module *mod, unsigned long min_addr,
19 unsigned long max_addr);
20
21extern void cfi_module_remove(struct module *mod, unsigned long min_addr,
22 unsigned long max_addr);
23#else
24static inline void cfi_module_add(struct module *mod, unsigned long min_addr,
25 unsigned long max_addr)
26{
27}
28
29static inline void cfi_module_remove(struct module *mod, unsigned long min_addr,
30 unsigned long max_addr)
31{
32}
33#endif /* CONFIG_CFI_CLANG_SHADOW */
34
35#endif /* CONFIG_MODULES */
36#endif /* CONFIG_CFI_CLANG */
37
38#endif /* _LINUX_CFI_H */