diff options
| author | Mark Rutland <[email protected]> | 2021-06-02 16:37:01 +0100 |
|---|---|---|
| committer | Kees Cook <[email protected]> | 2021-06-14 09:12:09 -0700 |
| commit | 590e8a082a5772071d7bcfea2b8e5a2453cecad2 (patch) | |
| tree | abbe1d22c6fd26af71471ca6495d2f9a3ace9f80 /include/linux/compiler.h | |
| parent | 3f1639f8f96c4c60ccf737b02c61eb7c59355a5b (diff) | |
CFI: Move function_nocfi() into compiler.h
Currently the common definition of function_nocfi() is provided by
<linux/mm.h>, and architectures are expected to provide a definition in
<asm/memory.h>. Due to header dependencies, this can make it hard to use
function_nocfi() in low-level headers.
As function_nocfi() has no dependency on any mm code, nor on any memory
definitions, it doesn't need to live in <linux/mm.h> or <asm/memory.h>.
Generally, it would make more sense for it to live in
<linux/compiler.h>, where an architecture can override it in
<asm/compiler.h>.
Move the definitions accordingly.
Signed-off-by: Mark Rutland <[email protected]>
Cc: Catalin Marinas <[email protected]>
Cc: Kees Cook <[email protected]>
Cc: Nathan Chancellor <[email protected]>
Cc: Sami Tolvanen <[email protected]>
Cc: Will Deacon <[email protected]>
Signed-off-by: Kees Cook <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Diffstat (limited to 'include/linux/compiler.h')
| -rw-r--r-- | include/linux/compiler.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/linux/compiler.h b/include/linux/compiler.h index df5b405e6305..099e529a5d25 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h @@ -213,6 +213,16 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val, __v; \ }) +/* + * With CONFIG_CFI_CLANG, the compiler replaces function addresses in + * instrumented C code with jump table addresses. Architectures that + * support CFI can define this macro to return the actual function address + * when needed. + */ +#ifndef function_nocfi +#define function_nocfi(x) (x) +#endif + #endif /* __KERNEL__ */ /* |
