diff options
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/compiler-gcc.h | 5 | ||||
-rw-r--r-- | include/linux/compiler.h | 8 | ||||
-rw-r--r-- | include/linux/vermagic.h | 9 |
3 files changed, 21 insertions, 1 deletions
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h index 386caf6771ed..7deaae3dc87d 100644 --- a/include/linux/compiler-gcc.h +++ b/include/linux/compiler-gcc.h @@ -223,6 +223,11 @@ /* Mark a function definition as prohibited from being cloned. */ #define __noclone __attribute__((__noclone__, __optimize__("no-tracer"))) +#ifdef RANDSTRUCT_PLUGIN +#define __randomize_layout __attribute__((randomize_layout)) +#define __no_randomize_layout __attribute__((no_randomize_layout)) +#endif + #endif /* GCC_VERSION >= 40500 */ #if GCC_VERSION >= 40600 diff --git a/include/linux/compiler.h b/include/linux/compiler.h index 80a1dea36cbe..55ee9ee814f8 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h @@ -448,6 +448,14 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s # define __latent_entropy #endif +#ifndef __randomize_layout +# define __randomize_layout __designated_init +#endif + +#ifndef __no_randomize_layout +# define __no_randomize_layout +#endif + /* * Tell gcc if a function is cold. The compiler will assume any path * directly leading to the call is unlikely. diff --git a/include/linux/vermagic.h b/include/linux/vermagic.h index 6f8fbcf10dfb..af6c03f7f986 100644 --- a/include/linux/vermagic.h +++ b/include/linux/vermagic.h @@ -24,10 +24,17 @@ #ifndef MODULE_ARCH_VERMAGIC #define MODULE_ARCH_VERMAGIC "" #endif +#ifdef RANDSTRUCT_PLUGIN +#include <generated/randomize_layout_hash.h> +#define MODULE_RANDSTRUCT_PLUGIN "RANDSTRUCT_PLUGIN_" RANDSTRUCT_HASHED_SEED +#else +#define MODULE_RANDSTRUCT_PLUGIN +#endif #define VERMAGIC_STRING \ UTS_RELEASE " " \ MODULE_VERMAGIC_SMP MODULE_VERMAGIC_PREEMPT \ MODULE_VERMAGIC_MODULE_UNLOAD MODULE_VERMAGIC_MODVERSIONS \ - MODULE_ARCH_VERMAGIC + MODULE_ARCH_VERMAGIC \ + MODULE_RANDSTRUCT_PLUGIN |