ANDROID: add support for Clang's Control Flow Integrity (CFI)
This change adds the CONFIG_CFI_CLANG option, CFI error handling, and a faster look-up table for cross module CFI checks. Bug: 145210207 Change-Id: I68d620ca548a911e2f49ba801bc0531406e679a3 Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
This commit is contained in:

committed by
Alistair Delva

parent
3d04fb2c95
commit
2c351bb70a
@@ -26,6 +26,7 @@
|
||||
#include <linux/tracepoint-defs.h>
|
||||
#include <linux/srcu.h>
|
||||
#include <linux/static_call_types.h>
|
||||
#include <linux/cfi.h>
|
||||
|
||||
#include <linux/percpu.h>
|
||||
#include <asm/module.h>
|
||||
@@ -131,13 +132,17 @@ extern void cleanup_module(void);
|
||||
#define module_init(initfn) \
|
||||
static inline initcall_t __maybe_unused __inittest(void) \
|
||||
{ return initfn; } \
|
||||
int init_module(void) __copy(initfn) __attribute__((alias(#initfn)));
|
||||
int init_module(void) __copy(initfn) \
|
||||
__attribute__((alias(#initfn))); \
|
||||
__CFI_ADDRESSABLE(init_module)
|
||||
|
||||
/* This is only required if you want to be unloadable. */
|
||||
#define module_exit(exitfn) \
|
||||
static inline exitcall_t __maybe_unused __exittest(void) \
|
||||
{ return exitfn; } \
|
||||
void cleanup_module(void) __copy(exitfn) __attribute__((alias(#exitfn)));
|
||||
void cleanup_module(void) __copy(exitfn) \
|
||||
__attribute__((alias(#exitfn))); \
|
||||
__CFI_ADDRESSABLE(cleanup_module)
|
||||
|
||||
#endif
|
||||
|
||||
@@ -379,6 +384,10 @@ struct module {
|
||||
const s32 *crcs;
|
||||
unsigned int num_syms;
|
||||
|
||||
#ifdef CONFIG_CFI_CLANG
|
||||
cfi_check_fn cfi_check;
|
||||
#endif
|
||||
|
||||
/* Kernel parameters. */
|
||||
#ifdef CONFIG_SYSFS
|
||||
struct mutex param_lock;
|
||||
|
Reference in New Issue
Block a user