Add the randstruct gcc plugin
Subsystems (4)
PATCH 1/1 Add the randstruct gcc plugin
This plugin randomizes the layout of certain structures at compile time. This introduces two defines __randomize_layout and __no_randomize_layout. Which, in turn, tell the compiler to either try to randomize or not to randomize the struct in question.
This feature is ported over from grsecurity. The implementation is nearly identical to the original code written by the PaX Team and Spender. To make integration simpler, this version only supports explicit marking of structures. However, it retains the __no_randomize_layout support for the future. The UAPI checks are retained as well. Structures that are to be randomized are required to use the C99 designated initializer form.
--- Documentation/dontdiff | 2 + arch/Kconfig | 36 ++ include/linux/compiler-gcc.h | 5 + include/linux/compiler.h | 8 + include/linux/vermagic.h | 9 +- kernel/module.c | 27 + scripts/Makefile.gcc-plugins | 14 +- scripts/gcc-plugins/.gitignore | 1 + scripts/gcc-plugins/Makefile | 8 + scripts/gcc-plugins/gen-random-seed.sh | 8 + scripts/gcc-plugins/randomize_layout_plugin.c | 837 ++++++++++++++++++++++++++ 11 files changed, 952 insertions(+), 3 deletions(-) create mode 100644 scripts/gcc-plugins/.gitignore create mode 100755 scripts/gcc-plugins/gen-random-seed.sh create mode 100644 scripts/gcc-plugins/randomize_layout_plugin.c
Documentation/dontdiff +2 -0
@@ -206,6 +206,8 @@ r200_reg_safe.h r300_reg_safe.h r420_reg_safe.h r600_reg_safe.h +randomize_layout_hash.h +randomize_layout_seed.h recordmcount relocs rlim_names.h
arch/Kconfig +36 -0
@@ -383,6 +383,42 @@ config GCC_PLUGIN_SANCOV gcc-4.5 on). It is based on the commit "Add fuzzing coverage support" by Dmitry Vyukov <[email protected]>. +config GCC_PLUGIN_RANDSTRUCT + bool "Randomize layout of sensitive kernel structures" + depends on GCC_PLUGINS + select MODVERSIONS if MODULES + help + If you say Y here, the layouts of structures explicitly + marked by __randomize_layout will be randomized at + compile-time. This can introduce the requirement of an + additional infoleak vulnerability for exploits targeting + these structure types. + + Enabling this feature will introduce some performance impact, slightly + increase memory usage, and prevent the use of forensic tools like + Volatility against the system (unless the kernel source tree isn't + cleaned after kernel installation). + + The seed used for compilation is located at + scripts/gcc-plgins/randomize_layout_seed.h. It remains + after a make clean to allow for external modules to be + compiled with the existing seed and will be removed by a + make mrproper or make distclean. + + Note that the implementation requires gcc 4.6.4. or newer. You may need + to install the supporting headers explicitly in addition to the normal + gcc package. + +config GCC_PLUGIN_RANDSTRUCT_PERFORMANCE + bool "Use cacheline-aware structure randomization" + depends on GCC_PLUGIN_RANDSTRUCT + depends on GCC_PLUGINS + help + If you say Y here, the RANDSTRUCT randomization will make a best effort + at restricting randomization to cacheline-sized groups of elements. It + will further not randomize bitfields in structures. This reduces the + performance hit of RANDSTRUCT at the cost of weakened randomization. + config HAVE_CC_STACKPROTECTOR bool help
include/linux/compiler-gcc.h +5 -0
@@ -202,6 +202,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
include/linux/compiler.h +8 -0
@@ -388,6 +388,14 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s#endif /* __KERNEL__ */ +#ifndef __randomize_layout +# define __randomize_layout +#endif + +#ifndef __no_randomize_layout +# define __no_randomize_layout +#endif +/* * From the GCC manual: *
include/linux/vermagic.h +8 -1
@@ -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
kernel/module.c +27 -0
@@ -1299,12 +1299,31 @@ static int check_version(Elf_Shdr *sechdrs, goto bad_version; } +#ifdef CONFIG_GCC_PLUGIN_RANDSTRUCT +/* +* avoid potentially printing jibberish on attempted load +* of a module randomized with a different seed +*/ +pr_warn ("no symbol version for %s\n" , symname); +#else +pr_warn ("%s: no symbol version for %s\n" , mod->name, symname); +#endif +pr_warn ("%s: no symbol version for %s\n" , mod->name, symname);return 0 ; bad_version: +#ifdef CONFIG_GCC_PLUGIN_RANDSTRUCT +/* +* avoid potentially printing jibberish on attempted load +* of a module randomized with a different seed +*/ +pr_warn ("attempted module disagrees about version of symbol %s\n" , + symname); +#else pr_warn ("%s: disagrees about version of symbol %s\n" , mod->name, symname); +#endif return 0 ; }
@@ -2924,7 +2943,15 @@ static struct module *setup_load_info(struct load_info *info, int flags) mod = (void *)info->sechdrs[info->index.mod].sh_addr;if (info->index.sym ==0 ) { +#ifdef CONFIG_GCC_PLUGIN_RANDSTRUCT +/* +* avoid potentially printing jibberish on attempted load +* of a module randomized with a different seed +*/ +pr_warn ("module has no symbols (stripped?)\n" ); +#else pr_warn ("%s: module has no symbols (stripped?)\n" , mod->name); +#endif return ERR_PTR (-ENOEXEC ); }
scripts/Makefile.gcc-plugins +12 -2
@@ -19,9 +19,19 @@ ifdef CONFIG_GCC_PLUGINS endif endif - GCC_PLUGINS_CFLAGS := $(strip $(addprefix -fplugin=$(objtree)/scripts/gcc-plugins/, $(gcc-plugin-y)) $(gcc-plugin-cflags-y)) + RANDSTRUCT_PLUGIN := -fplugin=$(objtree)/scripts/gcc-plugins/randomize_layout_plugin.so + ifdef CONFIG_GCC_PLUGIN_RANDSTRUCT + gcc-plugin-$(CONFIG_GCC_PLUGIN_RANDSTRUCT) += randomize_layout_plugin.so - export PLUGINCC GCC_PLUGINS_CFLAGS GCC_PLUGIN GCC_PLUGIN_SUBDIR SANCOV_PLUGIN + GCC_PLUGIN_RANDSTRUCT_CFLAGS := -fplugin=$(objtree)/scripts/gcc-plugins/randomize_layout_plugin.so -DRANDSTRUCT_PLUGIN + ifdef CONFIG_GCC_PLUGIN_RANDSTRUCT_PERFORMANCE + GCC_PLUGIN_RANDSTRUCT_CFLAGS = -fplugin-arg-randomize_layout_plugin-performance-mode + endif + endif + + GCC_PLUGINS_CFLAGS := $(strip $(addprefix -fplugin=$(objtree)/scripts/gcc-plugins/, $(gcc-plugin-y)) $(gcc-plugin-cflags-y)) $(GCC_PLUGIN_RANDSTRUCT_CFLAGS) + + export PLUGINCC GCC_PLUGINS_CFLAGS GCC_PLUGIN GCC_PLUGIN_SUBDIR SANCOV_PLUGIN RANDSTRUCT_PLUGIN ifneq ($(PLUGINCC),) # SANCOV_PLUGIN can be only in CFLAGS_KCOV because avoid duplication.
scripts/gcc-plugins/.gitignore new file +1 -0
@@ -0,0 +1 @@ +randomize_layout_seed.h
scripts/gcc-plugins/Makefile +8 -0
@@ -18,6 +18,14 @@ endif export HOSTLIBS +$(obj)/randomize_layout_plugin.o: $(objtree)/$(obj)/randomize_layout_seed.h +quiet_cmd_create_randomize_layout_seed = GENSEED $@ +cmd_create_randomize_layout_seed = \ + $(CONFIG_SHELL) $(srctree)/$(src)/gen-random-seed.sh $@ $(objtree)/include/generated/randomize_layout_hash.h +$(objtree)/$(obj)/randomize_layout_seed.h: FORCE + $(call if_changed,create_randomize_layout_seed) +targets = randomize_layout_seed.h randomize_layout_hash.h + $(HOSTLIBS)-y := $(foreach p,$(GCC_PLUGIN),$(if $(findstring /,$(p)),,$(p))) always := $($(HOSTLIBS)-y)
scripts/gcc-plugins/gen-random-seed.sh new file +8 -0
@@ -0,0 +1,8 @@ +#!/bin/sh + +if [ ! -f "$1" ]; then + SEED=`od -A n -t x8 -N 32 /dev/urandom | tr -d ' \n'` + echo "const char *randstruct_seed = \"$SEED\";" > "$1" + HASH=`echo -n "$SEED" | sha256sum | cut -d" " -f1 | tr -d ' \n'` + echo "#define RANDSTRUCT_HASHED_SEED \"$HASH\"" > "$2" +fi
scripts/gcc-plugins/randomize_layout_plugin.c new file +837 -0
837 lines not on this page · raw message
Signature · 1 line
1.9.1
Quoted 1 line · Michael Leibowitz
This plugin randomizes the layout of certain structures at compile
"allows for the randomization of"... :)
Quoted 10 lines
time. This introduces two defines
__randomize_layoutand__no_randomize_layout. Which, in turn, tell the compiler to either try to randomize or not to randomize the struct in question.This feature is ported over from grsecurity. The implementation is nearly identical to the original code written by the PaX Team and Spender. To make integration simpler, this version only supports explicit marking of structures. However, it retains the
__no_randomize_layoutsupport for the future.
Quoted 5 lines
The UAPI checks are
retained as well. Structures that are to be randomized are required to use the C99 designated initializer form.Signed-off-by Michael Leibowitz <[email protected]>
In the earlier thread, I suggested a series that looked like this:
- plugin itself (minus all-function-pointers)
- opt-in markings
- C99 changes
- out-out markings
- all-function-pointers plugin logic
It sounds like this is the first step of that idea -- what was changed to remove the auto-marking logic?
(Also, this needs extensive 80-char wrapping done... see how close you can get it to be scripts/checkpatch.pl clean...)
Thanks for the update!
-Kees
Signature · 2 lines
Kees Cook Nexus Security
Quoted 4 lines · Michael Leibowitz
This plugin randomizes the layout of certain structures at compile time. This introduces two defines
__randomize_layoutand__no_randomize_layout. Which, in turn, tell the compiler to either try to randomize or not to randomize the struct in question.
How are you testing this, btw? I manually marked struct cred with __randomize_layout, and "pahole vmlinux" shows it is not randomized...
-Kees
Signature · 2 lines
Kees Cook Nexus Security
Quoted 9 lines · Kees Cook
Quoted 4 lines · Michael Leibowitz
This plugin randomizes the layout of certain structures at compile time. This introduces two defines
__randomize_layoutand__no_randomize_layout. Which, in turn, tell the compiler to either try to randomize or not to randomize the struct in question.How are you testing this, btw? I manually marked struct cred with
__randomize_layout, and "pahole vmlinux" shows it is not randomized...
I made a module that defined several fields and printed their layout in memory. It was out of order with it marked. I haven't tried it on the cred struct. I will do so.
Cheers
Quoted 6 lines
-Kees
--
Kees Cook
Nexus Security
Signature · 1 line
Michael Leibowitz
Quoted 22 lines · Michael Leibowitz
This plugin randomizes the layout of certain structures at compile time. This introduces two defines
__randomize_layoutand__no_randomize_layout. Which, in turn, tell the compiler to either try to randomize or not to randomize the struct in question.This feature is ported over from grsecurity. The implementation is nearly identical to the original code written by the PaX Team and Spender. To make integration simpler, this version only supports explicit marking of structures. However, it retains the
__no_randomize_layoutsupport for the future. The UAPI checks are retained as well. Structures that are to be randomized are required to use the C99 designated initializer form.Signed-off-by Michael Leibowitz <[email protected]>[...]scripts/Makefile.gcc-plugins +0
-0@@ -19,9 +19,19 @@ ifdef CONFIG_GCC_PLUGINS endif endif
scripts/Makefile.gcc-plugins ifdef CONFIG_GCC_PLUGINS · line 28
Quoted 10 lines
scripts/Makefile.gcc-plugins +6
-2- GCC_PLUGINS_CFLAGS := $(strip $(addprefix -fplugin=$(objtree)/scripts/gcc-plugins/, $(gcc-plugin-y)) $(gcc-plugin-cflags-y)) + RANDSTRUCT_PLUGIN := -fplugin=$(objtree)/scripts/gcc-plugins/randomize_layout_plugin.so + ifdef CONFIG_GCC_PLUGIN_RANDSTRUCT + gcc-plugin-$(CONFIG_GCC_PLUGIN_RANDSTRUCT) += randomize_layout_plugin.so - export PLUGINCC GCC_PLUGINS_CFLAGS GCC_PLUGIN GCC_PLUGIN_SUBDIR SANCOV_PLUGIN + GCC_PLUGIN_RANDSTRUCT_CFLAGS := -fplugin=$(objtree)/scripts/gcc-plugins/randomize_layout_plugin.so -DRANDSTRUCT_PLUGIN + ifdef CONFIG_GCC_PLUGIN_RANDSTRUCT_PERFORMANCE + GCC_PLUGIN_RANDSTRUCT_CFLAGS = -fplugin-arg-randomize_layout_plugin-performance-mode
Found it: this "=" should be "+=", though really the whole section should just be updated to the new style of plugin handling:
gcc-plugin-$(CONFIG_GCC_PLUGIN_RANDSTRUCT) += randomize_layout_plugin.so
gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_RANDSTRUCT) += -DRANDSTRUCT_PLUGIN
gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_RANDSTRUCT_PERFORMANCE) +=
-fplugin-arg-randomize_layout_plugin-performance-mode
and the export of RANDSTRUCT_PLUGIN
-Kees
Signature · 2 lines
Kees Cook Nexus Security
Quoted 38 lines · Kees Cook
Quoted 22 lines · Michael Leibowitz
This plugin randomizes the layout of certain structures at compile time. This introduces two defines
__randomize_layoutand__no_randomize_layout. Which, in turn, tell the compiler to either try to randomize or not to randomize the struct in question.This feature is ported over from grsecurity. The implementation is nearly identical to the original code written by the PaX Team and Spender. To make integration simpler, this version only supports explicit marking of structures. However, it retains the
__no_randomize_layoutsupport for the future. The UAPI checks are retained as well. Structures that are to be randomized are required to use the C99 designated initializer form.Signed-off-by Michael Leibowitz <[email protected]>[...]scripts/Makefile.gcc-plugins +0
-0@@ -19,9 +19,19 @@ ifdef CONFIG_GCC_PLUGINS endif endifscripts/Makefile.gcc-plugins ifdef CONFIG_GCC_PLUGINS · line 28
Quoted 10 lines
scripts/Makefile.gcc-plugins +6
-2- GCC_PLUGINS_CFLAGS := $(strip $(addprefix -fplugin=$(objtree)/scripts/gcc-plugins/, $(gcc-plugin-y)) $(gcc-plugin-cflags-y)) + RANDSTRUCT_PLUGIN := -fplugin=$(objtree)/scripts/gcc-plugins/randomize_layout_plugin.so + ifdef CONFIG_GCC_PLUGIN_RANDSTRUCT + gcc-plugin-$(CONFIG_GCC_PLUGIN_RANDSTRUCT) += randomize_layout_plugin.so - export PLUGINCC GCC_PLUGINS_CFLAGS GCC_PLUGIN GCC_PLUGIN_SUBDIR SANCOV_PLUGIN + GCC_PLUGIN_RANDSTRUCT_CFLAGS := -fplugin=$(objtree)/scripts/gcc-plugins/randomize_layout_plugin.so -DRANDSTRUCT_PLUGIN + ifdef CONFIG_GCC_PLUGIN_RANDSTRUCT_PERFORMANCE + GCC_PLUGIN_RANDSTRUCT_CFLAGS = -fplugin-arg-randomize_layout_plugin-performance-modeFound it: this "=" should be "+=", though really the whole section should just be updated to the new style of plugin handling:
Quoted 6 lines
gcc-plugin-$(CONFIG_GCC_PLUGIN_RANDSTRUCT) += randomize_layout_plugin.so
gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_RANDSTRUCT) += -DRANDSTRUCT_PLUGIN
gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_RANDSTRUCT_PERFORMANCE) +=
-fplugin-arg-randomize_layout_plugin-performance-modeand the export of
RANDSTRUCT_PLUGIN
Also, it looks like "pahole" (or the DWARF record) is lying. :P Printing out offsetof()s shows things clearly randomized.
For the next version: can you update to the latest version of this plugin? What you sent seems out of date compared to current grsecurity. Disabling is_pure_ops_struct() with a "return 0" looks to be sufficient to stop the automatic randomization.
-Kees
Signature · 2 lines
Kees Cook Nexus Security
Quoted 46 lines · Kees Cook
Quoted 38 lines · Kees Cook
Quoted 22 lines · Michael Leibowitz
This plugin randomizes the layout of certain structures at compile time. This introduces two defines
__randomize_layoutand__no_randomize_layout. Which, in turn, tell the compiler to either try to randomize or not to randomize the struct in question.This feature is ported over from grsecurity. The implementation is nearly identical to the original code written by the PaX Team and Spender. To make integration simpler, this version only supports explicit marking of structures. However, it retains the
__no_randomize_layoutsupport for the future. The UAPI checks are retained as well. Structures that are to be randomized are required to use the C99 designated initializer form.Signed-off-by Michael Leibowitz <[email protected]>[...]scripts/Makefile.gcc-plugins +0
-0@@ -19,9 +19,19 @@ ifdef CONFIG_GCC_PLUGINS endif endifscripts/Makefile.gcc-plugins ifdef CONFIG_GCC_PLUGINS · line 28
Quoted 10 lines
scripts/Makefile.gcc-plugins +6
-2- GCC_PLUGINS_CFLAGS := $(strip $(addprefix -fplugin=$(objtree)/scripts/gcc-plugins/, $(gcc-plugin-y)) $(gcc-plugin-cflags-y)) + RANDSTRUCT_PLUGIN := -fplugin=$(objtree)/scripts/gcc-plugins/randomize_layout_plugin.so + ifdef CONFIG_GCC_PLUGIN_RANDSTRUCT + gcc-plugin-$(CONFIG_GCC_PLUGIN_RANDSTRUCT) += randomize_layout_plugin.so - export PLUGINCC GCC_PLUGINS_CFLAGS GCC_PLUGIN GCC_PLUGIN_SUBDIR SANCOV_PLUGIN + GCC_PLUGIN_RANDSTRUCT_CFLAGS := -fplugin=$(objtree)/scripts/gcc-plugins/randomize_layout_plugin.so -DRANDSTRUCT_PLUGIN + ifdef CONFIG_GCC_PLUGIN_RANDSTRUCT_PERFORMANCE + GCC_PLUGIN_RANDSTRUCT_CFLAGS = -fplugin-arg-randomize_layout_plugin-performance-modeFound it: this "=" should be "+=", though really the whole section should just be updated to the new style of plugin handling:
Quoted 6 lines
gcc-plugin-$(CONFIG_GCC_PLUGIN_RANDSTRUCT) += randomize_layout_plugin.so
gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_RANDSTRUCT) += -DRANDSTRUCT_PLUGIN
gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_RANDSTRUCT_PERFORMANCE) +=
-fplugin-arg-randomize_layout_plugin-performance-modeand the export of
RANDSTRUCT_PLUGIN
Quoted 7 lines
Also, it looks like "pahole" (or the DWARF record) is lying. :P Printing out offsetof()s shows things clearly randomized.
For the next version: can you update to the latest version of this plugin? What you sent seems out of date compared to current grsecurity. Disabling
is_pure_ops_struct()with a "return 0" looks to be sufficient to stop the automatic randomization.
I've built out a more complete series here:
http://git.kernel.org/cgit/linux/kernel/git/kees/linux.git/log/?h=kspp/gcc-plugin/randstruct
This includes all the initializer fixes and opt-in/opt-out markings, an updated plugin, etc.
It still needs improved comments, changelogs, and some better understanding as to why the DWARF information appears broken. If you can work from this tree, that'd be great!
-Kees
Signature · 2 lines
Kees Cook Nexus Security
Just curious:
"These were found using allyesconfig on x86, arm, and arm64."
Who found them, and whose code is all that?
Who decided on these, whose code is it?
Ditto -- did you spend the hours to figure the ARM hunk out? I only see your name there.
Show the world you can do something more than plagiarize code. This is the third time I'm having to warn you guys collectively about this. How hard is it to not plagiarize?
-Brad
Quoted 70 lines · Kees Cook
Quoted 46 lines · Kees Cook
Quoted 38 lines · Kees Cook
Quoted 22 lines · Michael Leibowitz
This plugin randomizes the layout of certain structures at compile time. This introduces two defines
__randomize_layoutand__no_randomize_layout. Which, in turn, tell the compiler to either try to randomize or not to randomize the struct in question.This feature is ported over from grsecurity. The implementation is nearly identical to the original code written by the PaX Team and Spender. To make integration simpler, this version only supports explicit marking of structures. However, it retains the
__no_randomize_layoutsupport for the future. The UAPI checks are retained as well. Structures that are to be randomized are required to use the C99 designated initializer form.Signed-off-by Michael Leibowitz <[email protected]>[...]scripts/Makefile.gcc-plugins +0
-0@@ -19,9 +19,19 @@ ifdef CONFIG_GCC_PLUGINS endif endifscripts/Makefile.gcc-plugins ifdef CONFIG_GCC_PLUGINS · line 28
Quoted 10 lines
scripts/Makefile.gcc-plugins +6
-2- GCC_PLUGINS_CFLAGS := $(strip $(addprefix -fplugin=$(objtree)/scripts/gcc-plugins/, $(gcc-plugin-y)) $(gcc-plugin-cflags-y)) + RANDSTRUCT_PLUGIN := -fplugin=$(objtree)/scripts/gcc-plugins/randomize_layout_plugin.so + ifdef CONFIG_GCC_PLUGIN_RANDSTRUCT + gcc-plugin-$(CONFIG_GCC_PLUGIN_RANDSTRUCT) += randomize_layout_plugin.so - export PLUGINCC GCC_PLUGINS_CFLAGS GCC_PLUGIN GCC_PLUGIN_SUBDIR SANCOV_PLUGIN + GCC_PLUGIN_RANDSTRUCT_CFLAGS := -fplugin=$(objtree)/scripts/gcc-plugins/randomize_layout_plugin.so -DRANDSTRUCT_PLUGIN + ifdef CONFIG_GCC_PLUGIN_RANDSTRUCT_PERFORMANCE + GCC_PLUGIN_RANDSTRUCT_CFLAGS = -fplugin-arg-randomize_layout_plugin-performance-modeFound it: this "=" should be "+=", though really the whole section should just be updated to the new style of plugin handling:
Quoted 6 lines
gcc-plugin-$(CONFIG_GCC_PLUGIN_RANDSTRUCT) += randomize_layout_plugin.so
gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_RANDSTRUCT) += -DRANDSTRUCT_PLUGIN
gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_RANDSTRUCT_PERFORMANCE) +=
-fplugin-arg-randomize_layout_plugin-performance-modeand the export of
RANDSTRUCT_PLUGINQuoted 7 lines
Also, it looks like "pahole" (or the DWARF record) is lying. :P Printing out offsetof()s shows things clearly randomized.
For the next version: can you update to the latest version of this plugin? What you sent seems out of date compared to current grsecurity. Disabling
is_pure_ops_struct()with a "return 0" looks to be sufficient to stop the automatic randomization.I've built out a more complete series here:
http://git.kernel.org/cgit/linux/kernel/git/kees/linux.git/log/?h=kspp/gcc-plugin/randstructThis includes all the initializer fixes and opt-in/opt-out markings, an updated plugin, etc.
It still needs improved comments, changelogs, and some better understanding as to why the DWARF information appears broken. If you can work from this tree, that'd be great!
-Kees
Signature · 2 lines
Kees Cook Nexus Security
Quoted 12 lines · Brad Spengler
Just curious:
"These were found using allyesconfig on x86, arm, and arm64."
Who found them, and whose code is all that?
Who decided on these, whose code is it?
Quoted 8 lines
Ditto -- did you spend the hours to figure the ARM hunk out? I only see your name there.
Show the world you can do something more than plagiarize code. This is the third time I'm having to warn you guys collectively about this. How hard is it to not plagiarize?
I already said the commit logs needed work. I think I have a reasonable track record giving you and PaX Team credit for things -- this isn't the final version by a long shot. I wanted to give Michael something to work from before the weekend got here.
-Kees
Signature · 2 lines
Kees Cook Nexus Security