diff options
author | Anthony G. Basile <blueness@gentoo.org> | 2014-02-11 07:51:42 -0500 |
---|---|---|
committer | Anthony G. Basile <blueness@gentoo.org> | 2014-02-11 07:51:42 -0500 |
commit | eb86a5e709200f411aa6d78217a9705e6794af4e (patch) | |
tree | 3121553d66b8336e47c9f1fe2c4c884753625421 | |
parent | Grsec/PaX: 3.0-{3.2.54,3.13.2}-201402090002 (diff) | |
download | hardened-patchset-eb86a5e709200f411aa6d78217a9705e6794af4e.tar.gz hardened-patchset-eb86a5e709200f411aa6d78217a9705e6794af4e.tar.bz2 hardened-patchset-eb86a5e709200f411aa6d78217a9705e6794af4e.zip |
Grsec/PaX: 3.0-{3.2.54,3.13.2}-20140209113420140209b
-rw-r--r-- | 3.13.2/0000_README | 2 | ||||
-rw-r--r-- | 3.13.2/4420_grsecurity-3.0-3.13.2-201402091134.patch (renamed from 3.13.2/4420_grsecurity-3.0-3.13.2-201402090002.patch) | 68 | ||||
-rw-r--r-- | 3.2.54/0000_README | 2 | ||||
-rw-r--r-- | 3.2.54/4420_grsecurity-3.0-3.2.54-201402091132.patch (renamed from 3.2.54/4420_grsecurity-3.0-3.2.54-201402090000.patch) | 68 |
4 files changed, 68 insertions, 72 deletions
diff --git a/3.13.2/0000_README b/3.13.2/0000_README index a01567b..cb647cd 100644 --- a/3.13.2/0000_README +++ b/3.13.2/0000_README @@ -2,7 +2,7 @@ README ----------------------------------------------------------------------------- Individual Patch Descriptions: ----------------------------------------------------------------------------- -Patch: 4420_grsecurity-3.0-3.13.2-201402090002.patch +Patch: 4420_grsecurity-3.0-3.13.2-201402091134.patch From: http://www.grsecurity.net Desc: hardened-sources base patch from upstream grsecurity diff --git a/3.13.2/4420_grsecurity-3.0-3.13.2-201402090002.patch b/3.13.2/4420_grsecurity-3.0-3.13.2-201402091134.patch index 76aaa29..df6cd99 100644 --- a/3.13.2/4420_grsecurity-3.0-3.13.2-201402090002.patch +++ b/3.13.2/4420_grsecurity-3.0-3.13.2-201402091134.patch @@ -1,5 +1,5 @@ diff --git a/Documentation/dontdiff b/Documentation/dontdiff -index b89a739..9aa2627 100644 +index b89a739..e289b9b 100644 --- a/Documentation/dontdiff +++ b/Documentation/dontdiff @@ -2,9 +2,11 @@ @@ -173,7 +173,7 @@ index b89a739..9aa2627 100644 r300_reg_safe.h r420_reg_safe.h r600_reg_safe.h -+randomize_layout_hash.data ++randomize_layout_hash.h +randomize_layout_seed.h +realmode.lds +realmode.relocs @@ -287,7 +287,7 @@ index b9e9bd8..bf49b92 100644 pcd. [PARIDE] diff --git a/Makefile b/Makefile -index a7fd5d9..84ed0df 100644 +index a7fd5d9..dc8e4db 100644 --- a/Makefile +++ b/Makefile @@ -244,8 +244,9 @@ CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \ @@ -329,7 +329,7 @@ index a7fd5d9..84ed0df 100644 $(Q)$(MAKE) $(build)=scripts/basic $(Q)rm -f .tmp_quiet_recordmcount -@@ -579,6 +586,74 @@ else +@@ -579,6 +586,72 @@ else KBUILD_CFLAGS += -O2 endif @@ -357,8 +357,6 @@ index a7fd5d9..84ed0df 100644 +endif +ifdef CONFIG_GRKERNSEC_RANDSTRUCT +RANDSTRUCT_PLUGIN_CFLAGS := -fplugin=$(objtree)/tools/gcc/randomize_layout_plugin.so -DRANDSTRUCT_PLUGIN -+RANDSTRUCT_HASHED_SEED := $(shell cat "$(objtree)/tools/gcc/randomize_layout_hash.data") -+RANDSTRUCT_PLUGIN_CFLAGS += -DRANDSTRUCT_HASHED_SEED="\"$(RANDSTRUCT_HASHED_SEED)\"" +ifdef CONFIG_GRKERNSEC_RANDSTRUCT_PERFORMANCE +RANDSTRUCT_PLUGIN_CFLAGS += -fplugin-arg-randomize_layout_plugin-performance-mode +endif @@ -404,7 +402,7 @@ index a7fd5d9..84ed0df 100644 include $(srctree)/arch/$(SRCARCH)/Makefile ifdef CONFIG_READABLE_ASM -@@ -619,7 +694,7 @@ endif +@@ -619,7 +692,7 @@ endif ifdef CONFIG_DEBUG_INFO KBUILD_CFLAGS += -g @@ -413,7 +411,7 @@ index a7fd5d9..84ed0df 100644 endif ifdef CONFIG_DEBUG_INFO_REDUCED -@@ -754,7 +829,7 @@ export mod_sign_cmd +@@ -754,7 +827,7 @@ export mod_sign_cmd ifeq ($(KBUILD_EXTMOD),) @@ -422,7 +420,7 @@ index a7fd5d9..84ed0df 100644 vmlinux-dirs := $(patsubst %/,%,$(filter %/, $(init-y) $(init-m) \ $(core-y) $(core-m) $(drivers-y) $(drivers-m) \ -@@ -803,6 +878,8 @@ endif +@@ -803,6 +876,8 @@ endif # The actual objects are generated when descending, # make sure no implicit rule kicks in @@ -431,7 +429,7 @@ index a7fd5d9..84ed0df 100644 $(sort $(vmlinux-deps)): $(vmlinux-dirs) ; # Handle descending into subdirectories listed in $(vmlinux-dirs) -@@ -812,7 +889,7 @@ $(sort $(vmlinux-deps)): $(vmlinux-dirs) ; +@@ -812,7 +887,7 @@ $(sort $(vmlinux-deps)): $(vmlinux-dirs) ; # Error messages still appears in the original language PHONY += $(vmlinux-dirs) @@ -440,7 +438,7 @@ index a7fd5d9..84ed0df 100644 $(Q)$(MAKE) $(build)=$@ define filechk_kernel.release -@@ -855,10 +932,13 @@ prepare1: prepare2 $(version_h) include/generated/utsrelease.h \ +@@ -855,10 +930,13 @@ prepare1: prepare2 $(version_h) include/generated/utsrelease.h \ archprepare: archheaders archscripts prepare1 scripts_basic @@ -454,7 +452,7 @@ index a7fd5d9..84ed0df 100644 prepare: prepare0 # Generate some files -@@ -966,6 +1046,8 @@ all: modules +@@ -966,6 +1044,8 @@ all: modules # using awk while concatenating to the final file. PHONY += modules @@ -463,7 +461,7 @@ index a7fd5d9..84ed0df 100644 modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux) modules.builtin $(Q)$(AWK) '!x[$$0]++' $(vmlinux-dirs:%=$(objtree)/%/modules.order) > $(objtree)/modules.order @$(kecho) ' Building modules, stage 2.'; -@@ -981,7 +1063,7 @@ modules.builtin: $(vmlinux-dirs:%=%/modules.builtin) +@@ -981,7 +1061,7 @@ modules.builtin: $(vmlinux-dirs:%=%/modules.builtin) # Target to prepare building external modules PHONY += modules_prepare @@ -472,17 +470,17 @@ index a7fd5d9..84ed0df 100644 # Target to install modules PHONY += modules_install -@@ -1047,7 +1129,8 @@ MRPROPER_FILES += .config .config.old .version .old_version $(version_h) \ +@@ -1047,7 +1127,8 @@ MRPROPER_FILES += .config .config.old .version .old_version $(version_h) \ Module.symvers tags TAGS cscope* GPATH GTAGS GRTAGS GSYMS \ signing_key.priv signing_key.x509 x509.genkey \ extra_certificates signing_key.x509.keyid \ - signing_key.x509.signer + signing_key.x509.signer tools/gcc/size_overflow_hash.h \ -+ tools/gcc/randomize_layout_seed.h tools/gcc/randomize_layout_hash.data ++ tools/gcc/randomize_layout_seed.h # clean - Delete most, but leave enough to build external modules # -@@ -1087,6 +1170,7 @@ distclean: mrproper +@@ -1087,6 +1168,7 @@ distclean: mrproper \( -name '*.orig' -o -name '*.rej' -o -name '*~' \ -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \ -o -name '.*.rej' \ @@ -490,7 +488,7 @@ index a7fd5d9..84ed0df 100644 -o -name '*%' -o -name '.*.cmd' -o -name 'core' \) \ -type f -print | xargs rm -f -@@ -1248,6 +1332,8 @@ PHONY += $(module-dirs) modules +@@ -1248,6 +1330,8 @@ PHONY += $(module-dirs) modules $(module-dirs): crmodverdir $(objtree)/Module.symvers $(Q)$(MAKE) $(build)=$(patsubst _module_%,%,$@) @@ -499,7 +497,7 @@ index a7fd5d9..84ed0df 100644 modules: $(module-dirs) @$(kecho) ' Building modules, stage 2.'; $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost -@@ -1387,17 +1473,21 @@ else +@@ -1387,17 +1471,21 @@ else target-dir = $(if $(KBUILD_EXTMOD),$(dir $<),$(dir $@)) endif @@ -525,7 +523,7 @@ index a7fd5d9..84ed0df 100644 $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) %.symtypes: %.c prepare scripts FORCE $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) -@@ -1407,11 +1497,15 @@ endif +@@ -1407,11 +1495,15 @@ endif $(cmd_crmodverdir) $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \ $(build)=$(build-dir) @@ -81343,10 +81341,10 @@ index 239e277..22a5cf5 100644 #ifdef CONFIG_UTS_NS diff --git a/include/linux/vermagic.h b/include/linux/vermagic.h -index 6f8fbcf..e2a0e61 100644 +index 6f8fbcf..4efc177 100644 --- a/include/linux/vermagic.h +++ b/include/linux/vermagic.h -@@ -25,9 +25,41 @@ +@@ -25,9 +25,42 @@ #define MODULE_ARCH_VERMAGIC "" #endif @@ -81369,6 +81367,7 @@ index 6f8fbcf..e2a0e61 100644 +#endif + +#ifdef RANDSTRUCT_PLUGIN ++#include <generated/randomize_layout_hash.h> +#define MODULE_RANDSTRUCT_PLUGIN "RANDSTRUCT_PLUGIN_" RANDSTRUCT_HASHED_SEED +#else +#define MODULE_RANDSTRUCT_PLUGIN @@ -103826,19 +103825,18 @@ index 7778b8e..3d619fc 100644 diff --git a/tools/gcc/.gitignore b/tools/gcc/.gitignore new file mode 100644 -index 0000000..54052c3 +index 0000000..4c2c45c --- /dev/null +++ b/tools/gcc/.gitignore -@@ -0,0 +1,3 @@ -+size_overflow_hash.h +@@ -0,0 +1,2 @@ +randomize_layout_seed.h -+randomize_layout_hash.data ++size_overflow_hash.h diff --git a/tools/gcc/Makefile b/tools/gcc/Makefile new file mode 100644 -index 0000000..51a2ba2 +index 0000000..0d1d9d3 --- /dev/null +++ b/tools/gcc/Makefile -@@ -0,0 +1,55 @@ +@@ -0,0 +1,54 @@ +#CC := gcc +#PLUGIN_SOURCE_FILES := pax_plugin.c +#PLUGIN_OBJECT_FILES := $(patsubst %.c,%.o,$(PLUGIN_SOURCE_FILES)) @@ -103878,8 +103876,7 @@ index 0000000..51a2ba2 +randomize_layout_plugin-objs := randomize_layout_plugin.o + +$(obj)/size_overflow_plugin.o: $(objtree)/$(obj)/size_overflow_hash.h -+$(obj)/randomize_layout_plugin.o: $(objtree)/$(obj)/randomize_layout_seed.h \ -+ $(objtree)/$(obj)/randomize_layout_hash.data ++$(obj)/randomize_layout_plugin.o: $(objtree)/$(obj)/randomize_layout_seed.h + +quiet_cmd_build_size_overflow_hash = GENHASH $@ + cmd_build_size_overflow_hash = \ @@ -103889,11 +103886,11 @@ index 0000000..51a2ba2 + +quiet_cmd_create_randomize_layout_seed = GENSEED $@ + cmd_create_randomize_layout_seed = \ -+ $(CONFIG_SHELL) $(srctree)/$(src)/gen-random-seed.sh $@ $(objtree)/$(obj)/randomize_layout_hash.data -+$(objtree)/$(obj)/randomize_layout_seed.h $(objtree)/$(obj)/randomize_layout_hash.data: FORCE ++ $(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 += size_overflow_hash.h randomize_layout_seed.h randomize_layout_hash.data ++targets += size_overflow_hash.h randomize_layout_seed.h randomize_layout_hash.h diff --git a/tools/gcc/checker_plugin.c b/tools/gcc/checker_plugin.c new file mode 100644 index 0000000..5452feea @@ -105059,16 +105056,17 @@ index 0000000..312d3b6 +#endif diff --git a/tools/gcc/gen-random-seed.sh b/tools/gcc/gen-random-seed.sh new file mode 100644 -index 0000000..8030e6e +index 0000000..7514850 --- /dev/null +++ b/tools/gcc/gen-random-seed.sh -@@ -0,0 +1,7 @@ +@@ -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" -+ echo -n "$SEED" | sha256sum | cut -d" " -f1 | tr -d "\n" > "$2" ++ HASH=`echo -n "$SEED" | sha256sum | cut -d" " -f1 | tr -d ' \n'` ++ echo "#define RANDSTRUCT_HASHED_SEED \"$HASH\"" > "$2" +fi diff --git a/tools/gcc/generate_size_overflow_hash.sh b/tools/gcc/generate_size_overflow_hash.sh new file mode 100644 diff --git a/3.2.54/0000_README b/3.2.54/0000_README index 2e1f77c..36ebbf6 100644 --- a/3.2.54/0000_README +++ b/3.2.54/0000_README @@ -134,7 +134,7 @@ Patch: 1053_linux-3.2.54.patch From: http://www.kernel.org Desc: Linux 3.2.54 -Patch: 4420_grsecurity-3.0-3.2.54-201402090000.patch +Patch: 4420_grsecurity-3.0-3.2.54-201402091132.patch From: http://www.grsecurity.net Desc: hardened-sources base patch from upstream grsecurity diff --git a/3.2.54/4420_grsecurity-3.0-3.2.54-201402090000.patch b/3.2.54/4420_grsecurity-3.0-3.2.54-201402091132.patch index f378eea..c8d6e90 100644 --- a/3.2.54/4420_grsecurity-3.0-3.2.54-201402090000.patch +++ b/3.2.54/4420_grsecurity-3.0-3.2.54-201402091132.patch @@ -1,5 +1,5 @@ diff --git a/Documentation/dontdiff b/Documentation/dontdiff -index dfa6fc6..58798e8 100644 +index dfa6fc6..ccbfbf3 100644 --- a/Documentation/dontdiff +++ b/Documentation/dontdiff @@ -2,9 +2,11 @@ @@ -153,7 +153,7 @@ index dfa6fc6..58798e8 100644 r300_reg_safe.h r420_reg_safe.h r600_reg_safe.h -+randomize_layout_hash.data ++randomize_layout_hash.h +randomize_layout_seed.h recordmcount +regdb.c @@ -273,7 +273,7 @@ index 88fd7f5..b318a78 100644 ============================================================== diff --git a/Makefile b/Makefile -index 848be26..a460525 100644 +index 848be26..296b92f 100644 --- a/Makefile +++ b/Makefile @@ -245,8 +245,9 @@ CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \ @@ -315,7 +315,7 @@ index 848be26..a460525 100644 $(Q)$(MAKE) $(build)=scripts/basic $(Q)rm -f .tmp_quiet_recordmcount -@@ -564,6 +571,74 @@ else +@@ -564,6 +571,72 @@ else KBUILD_CFLAGS += -O2 endif @@ -343,8 +343,6 @@ index 848be26..a460525 100644 +endif +ifdef CONFIG_GRKERNSEC_RANDSTRUCT +RANDSTRUCT_PLUGIN_CFLAGS := -fplugin=$(objtree)/tools/gcc/randomize_layout_plugin.so -DRANDSTRUCT_PLUGIN -+RANDSTRUCT_HASHED_SEED := $(shell cat "$(objtree)/tools/gcc/randomize_layout_hash.data") -+RANDSTRUCT_PLUGIN_CFLAGS += -DRANDSTRUCT_HASHED_SEED="\"$(RANDSTRUCT_HASHED_SEED)\"" +ifdef CONFIG_GRKERNSEC_RANDSTRUCT_PERFORMANCE +RANDSTRUCT_PLUGIN_CFLAGS += -fplugin-arg-randomize_layout_plugin-performance-mode +endif @@ -390,7 +388,7 @@ index 848be26..a460525 100644 include $(srctree)/arch/$(SRCARCH)/Makefile ifneq ($(CONFIG_FRAME_WARN),0) -@@ -594,7 +669,7 @@ endif +@@ -594,7 +667,7 @@ endif ifdef CONFIG_DEBUG_INFO KBUILD_CFLAGS += -g @@ -399,7 +397,7 @@ index 848be26..a460525 100644 endif ifdef CONFIG_DEBUG_INFO_REDUCED -@@ -708,7 +783,7 @@ export mod_strip_cmd +@@ -708,7 +781,7 @@ export mod_strip_cmd ifeq ($(KBUILD_EXTMOD),) @@ -408,7 +406,7 @@ index 848be26..a460525 100644 vmlinux-dirs := $(patsubst %/,%,$(filter %/, $(init-y) $(init-m) \ $(core-y) $(core-m) $(drivers-y) $(drivers-m) \ -@@ -932,6 +1007,8 @@ vmlinux.o: $(modpost-init) $(vmlinux-main) FORCE +@@ -932,6 +1005,8 @@ vmlinux.o: $(modpost-init) $(vmlinux-main) FORCE # The actual objects are generated when descending, # make sure no implicit rule kicks in @@ -417,7 +415,7 @@ index 848be26..a460525 100644 $(sort $(vmlinux-init) $(vmlinux-main)) $(vmlinux-lds): $(vmlinux-dirs) ; # Handle descending into subdirectories listed in $(vmlinux-dirs) -@@ -941,7 +1018,7 @@ $(sort $(vmlinux-init) $(vmlinux-main)) $(vmlinux-lds): $(vmlinux-dirs) ; +@@ -941,7 +1016,7 @@ $(sort $(vmlinux-init) $(vmlinux-main)) $(vmlinux-lds): $(vmlinux-dirs) ; # Error messages still appears in the original language PHONY += $(vmlinux-dirs) @@ -426,7 +424,7 @@ index 848be26..a460525 100644 $(Q)$(MAKE) $(build)=$@ # Store (new) KERNELRELASE string in include/config/kernel.release -@@ -981,10 +1058,13 @@ prepare1: prepare2 include/linux/version.h include/generated/utsrelease.h \ +@@ -981,10 +1056,13 @@ prepare1: prepare2 include/linux/version.h include/generated/utsrelease.h \ archprepare: archscripts prepare1 scripts_basic @@ -440,7 +438,7 @@ index 848be26..a460525 100644 prepare: prepare0 # Generate some files -@@ -1089,6 +1169,8 @@ all: modules +@@ -1089,6 +1167,8 @@ all: modules # using awk while concatenating to the final file. PHONY += modules @@ -449,7 +447,7 @@ index 848be26..a460525 100644 modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux) modules.builtin $(Q)$(AWK) '!x[$$0]++' $(vmlinux-dirs:%=$(objtree)/%/modules.order) > $(objtree)/modules.order @$(kecho) ' Building modules, stage 2.'; -@@ -1104,7 +1186,7 @@ modules.builtin: $(vmlinux-dirs:%=%/modules.builtin) +@@ -1104,7 +1184,7 @@ modules.builtin: $(vmlinux-dirs:%=%/modules.builtin) # Target to prepare building external modules PHONY += modules_prepare @@ -458,7 +456,7 @@ index 848be26..a460525 100644 # Target to install modules PHONY += modules_install -@@ -1163,8 +1245,9 @@ CLEAN_FILES += vmlinux System.map \ +@@ -1163,8 +1243,9 @@ CLEAN_FILES += vmlinux System.map \ MRPROPER_DIRS += include/config usr/include include/generated \ arch/*/include/generated MRPROPER_FILES += .config .config.old .version .old_version \ @@ -466,11 +464,11 @@ index 848be26..a460525 100644 - Module.symvers tags TAGS cscope* GPATH GTAGS GRTAGS GSYMS + include/linux/version.h tools/gcc/size_overflow_hash.h\ + Module.symvers tags TAGS cscope* GPATH GTAGS GRTAGS GSYMS \ -+ tools/gcc/randomize_layout_seed.h tools/gcc/randomize_layout_hash.data ++ tools/gcc/randomize_layout_seed.h # clean - Delete most, but leave enough to build external modules # -@@ -1201,6 +1284,7 @@ distclean: mrproper +@@ -1201,6 +1282,7 @@ distclean: mrproper \( -name '*.orig' -o -name '*.rej' -o -name '*~' \ -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \ -o -name '.*.rej' \ @@ -478,7 +476,7 @@ index 848be26..a460525 100644 -o -name '*%' -o -name '.*.cmd' -o -name 'core' \) \ -type f -print | xargs rm -f -@@ -1361,6 +1445,8 @@ PHONY += $(module-dirs) modules +@@ -1361,6 +1443,8 @@ PHONY += $(module-dirs) modules $(module-dirs): crmodverdir $(objtree)/Module.symvers $(Q)$(MAKE) $(build)=$(patsubst _module_%,%,$@) @@ -487,7 +485,7 @@ index 848be26..a460525 100644 modules: $(module-dirs) @$(kecho) ' Building modules, stage 2.'; $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost -@@ -1487,17 +1573,21 @@ else +@@ -1487,17 +1571,21 @@ else target-dir = $(if $(KBUILD_EXTMOD),$(dir $<),$(dir $@)) endif @@ -513,7 +511,7 @@ index 848be26..a460525 100644 $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) %.symtypes: %.c prepare scripts FORCE $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) -@@ -1507,11 +1597,15 @@ endif +@@ -1507,11 +1595,15 @@ endif $(cmd_crmodverdir) $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \ $(build)=$(build-dir) @@ -80703,10 +80701,10 @@ index c714ed7..fb6d16c 100644 #ifdef CONFIG_UTS_NS diff --git a/include/linux/vermagic.h b/include/linux/vermagic.h -index 6f8fbcf..e2a0e61 100644 +index 6f8fbcf..4efc177 100644 --- a/include/linux/vermagic.h +++ b/include/linux/vermagic.h -@@ -25,9 +25,41 @@ +@@ -25,9 +25,42 @@ #define MODULE_ARCH_VERMAGIC "" #endif @@ -80729,6 +80727,7 @@ index 6f8fbcf..e2a0e61 100644 +#endif + +#ifdef RANDSTRUCT_PLUGIN ++#include <generated/randomize_layout_hash.h> +#define MODULE_RANDSTRUCT_PLUGIN "RANDSTRUCT_PLUGIN_" RANDSTRUCT_HASHED_SEED +#else +#define MODULE_RANDSTRUCT_PLUGIN @@ -107041,19 +107040,18 @@ index 0a7ca6c..f4b948c 100644 }; diff --git a/tools/gcc/.gitignore b/tools/gcc/.gitignore new file mode 100644 -index 0000000..54052c3 +index 0000000..4c2c45c --- /dev/null +++ b/tools/gcc/.gitignore -@@ -0,0 +1,3 @@ -+size_overflow_hash.h +@@ -0,0 +1,2 @@ +randomize_layout_seed.h -+randomize_layout_hash.data ++size_overflow_hash.h diff --git a/tools/gcc/Makefile b/tools/gcc/Makefile new file mode 100644 -index 0000000..51a2ba2 +index 0000000..0d1d9d3 --- /dev/null +++ b/tools/gcc/Makefile -@@ -0,0 +1,55 @@ +@@ -0,0 +1,54 @@ +#CC := gcc +#PLUGIN_SOURCE_FILES := pax_plugin.c +#PLUGIN_OBJECT_FILES := $(patsubst %.c,%.o,$(PLUGIN_SOURCE_FILES)) @@ -107093,8 +107091,7 @@ index 0000000..51a2ba2 +randomize_layout_plugin-objs := randomize_layout_plugin.o + +$(obj)/size_overflow_plugin.o: $(objtree)/$(obj)/size_overflow_hash.h -+$(obj)/randomize_layout_plugin.o: $(objtree)/$(obj)/randomize_layout_seed.h \ -+ $(objtree)/$(obj)/randomize_layout_hash.data ++$(obj)/randomize_layout_plugin.o: $(objtree)/$(obj)/randomize_layout_seed.h + +quiet_cmd_build_size_overflow_hash = GENHASH $@ + cmd_build_size_overflow_hash = \ @@ -107104,11 +107101,11 @@ index 0000000..51a2ba2 + +quiet_cmd_create_randomize_layout_seed = GENSEED $@ + cmd_create_randomize_layout_seed = \ -+ $(CONFIG_SHELL) $(srctree)/$(src)/gen-random-seed.sh $@ $(objtree)/$(obj)/randomize_layout_hash.data -+$(objtree)/$(obj)/randomize_layout_seed.h $(objtree)/$(obj)/randomize_layout_hash.data: FORCE ++ $(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 += size_overflow_hash.h randomize_layout_seed.h randomize_layout_hash.data ++targets += size_overflow_hash.h randomize_layout_seed.h randomize_layout_hash.h diff --git a/tools/gcc/checker_plugin.c b/tools/gcc/checker_plugin.c new file mode 100644 index 0000000..5452feea @@ -108274,16 +108271,17 @@ index 0000000..312d3b6 +#endif diff --git a/tools/gcc/gen-random-seed.sh b/tools/gcc/gen-random-seed.sh new file mode 100644 -index 0000000..8030e6e +index 0000000..7514850 --- /dev/null +++ b/tools/gcc/gen-random-seed.sh -@@ -0,0 +1,7 @@ +@@ -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" -+ echo -n "$SEED" | sha256sum | cut -d" " -f1 | tr -d "\n" > "$2" ++ HASH=`echo -n "$SEED" | sha256sum | cut -d" " -f1 | tr -d ' \n'` ++ echo "#define RANDSTRUCT_HASHED_SEED \"$HASH\"" > "$2" +fi diff --git a/tools/gcc/generate_size_overflow_hash.sh b/tools/gcc/generate_size_overflow_hash.sh new file mode 100644 |