db226f7ba8
This change adds the CONFIG_CFI_CLANG option, CFI error handling, and a faster look-up table for cross module CFI checks. Bug: 67506682 Change-Id: Ic009f0a629b552a0eb16e6d89808c7029e91447d Signed-off-by: Sami Tolvanen <samitolvanen@google.com> [AmitP: Rebased to newer kernels without clang LTO support] Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
38 lines
958 B
C
38 lines
958 B
C
#ifndef _LINUX_CFI_H
|
|
#define _LINUX_CFI_H
|
|
|
|
#include <linux/stringify.h>
|
|
|
|
#ifdef CONFIG_CFI_CLANG
|
|
#ifdef CONFIG_MODULES
|
|
|
|
typedef void (*cfi_check_fn)(uint64_t, void *, void *);
|
|
|
|
/* Compiler-generated function in each module, and the kernel */
|
|
#define CFI_CHECK_FN __cfi_check
|
|
#define CFI_CHECK_FN_NAME __stringify(CFI_CHECK_FN)
|
|
|
|
extern void CFI_CHECK_FN(uint64_t, void *, void *);
|
|
|
|
#ifdef CONFIG_CFI_CLANG_SHADOW
|
|
extern void cfi_module_add(struct module *mod, unsigned long min_addr,
|
|
unsigned long max_addr);
|
|
|
|
extern void cfi_module_remove(struct module *mod, unsigned long min_addr,
|
|
unsigned long max_addr);
|
|
#else
|
|
static inline void cfi_module_add(struct module *mod, unsigned long min_addr,
|
|
unsigned long max_addr)
|
|
{
|
|
}
|
|
|
|
static inline void cfi_module_remove(struct module *mod, unsigned long min_addr,
|
|
unsigned long max_addr)
|
|
{
|
|
}
|
|
#endif /* CONFIG_CFI_CLANG_SHADOW */
|
|
|
|
#endif /* CONFIG_MODULES */
|
|
#endif /* CONFIG_CFI_CLANG */
|
|
|
|
#endif /* _LINUX_CFI_H */
|