Gentoo Archives: gentoo-commits

From: "Anthony G. Basile" <blueness@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/hardened-patchset:master commit in: 3.2.54/, 3.13.2/
Date: Tue, 11 Feb 2014 12:51:23
Message-Id: 1392123102.eb86a5e709200f411aa6d78217a9705e6794af4e.blueness@gentoo
1 commit: eb86a5e709200f411aa6d78217a9705e6794af4e
2 Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
3 AuthorDate: Tue Feb 11 12:51:42 2014 +0000
4 Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
5 CommitDate: Tue Feb 11 12:51:42 2014 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/hardened-patchset.git;a=commit;h=eb86a5e7
7
8 Grsec/PaX: 3.0-{3.2.54,3.13.2}-201402091134
9
10 ---
11 3.13.2/0000_README | 2 +-
12 ... 4420_grsecurity-3.0-3.13.2-201402091134.patch} | 68 +++++++++++-----------
13 3.2.54/0000_README | 2 +-
14 ... 4420_grsecurity-3.0-3.2.54-201402091132.patch} | 68 +++++++++++-----------
15 4 files changed, 68 insertions(+), 72 deletions(-)
16
17 diff --git a/3.13.2/0000_README b/3.13.2/0000_README
18 index a01567b..cb647cd 100644
19 --- a/3.13.2/0000_README
20 +++ b/3.13.2/0000_README
21 @@ -2,7 +2,7 @@ README
22 -----------------------------------------------------------------------------
23 Individual Patch Descriptions:
24 -----------------------------------------------------------------------------
25 -Patch: 4420_grsecurity-3.0-3.13.2-201402090002.patch
26 +Patch: 4420_grsecurity-3.0-3.13.2-201402091134.patch
27 From: http://www.grsecurity.net
28 Desc: hardened-sources base patch from upstream grsecurity
29
30
31 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
32 similarity index 99%
33 rename from 3.13.2/4420_grsecurity-3.0-3.13.2-201402090002.patch
34 rename to 3.13.2/4420_grsecurity-3.0-3.13.2-201402091134.patch
35 index 76aaa29..df6cd99 100644
36 --- a/3.13.2/4420_grsecurity-3.0-3.13.2-201402090002.patch
37 +++ b/3.13.2/4420_grsecurity-3.0-3.13.2-201402091134.patch
38 @@ -1,5 +1,5 @@
39 diff --git a/Documentation/dontdiff b/Documentation/dontdiff
40 -index b89a739..9aa2627 100644
41 +index b89a739..e289b9b 100644
42 --- a/Documentation/dontdiff
43 +++ b/Documentation/dontdiff
44 @@ -2,9 +2,11 @@
45 @@ -173,7 +173,7 @@ index b89a739..9aa2627 100644
46 r300_reg_safe.h
47 r420_reg_safe.h
48 r600_reg_safe.h
49 -+randomize_layout_hash.data
50 ++randomize_layout_hash.h
51 +randomize_layout_seed.h
52 +realmode.lds
53 +realmode.relocs
54 @@ -287,7 +287,7 @@ index b9e9bd8..bf49b92 100644
55
56 pcd. [PARIDE]
57 diff --git a/Makefile b/Makefile
58 -index a7fd5d9..84ed0df 100644
59 +index a7fd5d9..dc8e4db 100644
60 --- a/Makefile
61 +++ b/Makefile
62 @@ -244,8 +244,9 @@ CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
63 @@ -329,7 +329,7 @@ index a7fd5d9..84ed0df 100644
64 $(Q)$(MAKE) $(build)=scripts/basic
65 $(Q)rm -f .tmp_quiet_recordmcount
66
67 -@@ -579,6 +586,74 @@ else
68 +@@ -579,6 +586,72 @@ else
69 KBUILD_CFLAGS += -O2
70 endif
71
72 @@ -357,8 +357,6 @@ index a7fd5d9..84ed0df 100644
73 +endif
74 +ifdef CONFIG_GRKERNSEC_RANDSTRUCT
75 +RANDSTRUCT_PLUGIN_CFLAGS := -fplugin=$(objtree)/tools/gcc/randomize_layout_plugin.so -DRANDSTRUCT_PLUGIN
76 -+RANDSTRUCT_HASHED_SEED := $(shell cat "$(objtree)/tools/gcc/randomize_layout_hash.data")
77 -+RANDSTRUCT_PLUGIN_CFLAGS += -DRANDSTRUCT_HASHED_SEED="\"$(RANDSTRUCT_HASHED_SEED)\""
78 +ifdef CONFIG_GRKERNSEC_RANDSTRUCT_PERFORMANCE
79 +RANDSTRUCT_PLUGIN_CFLAGS += -fplugin-arg-randomize_layout_plugin-performance-mode
80 +endif
81 @@ -404,7 +402,7 @@ index a7fd5d9..84ed0df 100644
82 include $(srctree)/arch/$(SRCARCH)/Makefile
83
84 ifdef CONFIG_READABLE_ASM
85 -@@ -619,7 +694,7 @@ endif
86 +@@ -619,7 +692,7 @@ endif
87
88 ifdef CONFIG_DEBUG_INFO
89 KBUILD_CFLAGS += -g
90 @@ -413,7 +411,7 @@ index a7fd5d9..84ed0df 100644
91 endif
92
93 ifdef CONFIG_DEBUG_INFO_REDUCED
94 -@@ -754,7 +829,7 @@ export mod_sign_cmd
95 +@@ -754,7 +827,7 @@ export mod_sign_cmd
96
97
98 ifeq ($(KBUILD_EXTMOD),)
99 @@ -422,7 +420,7 @@ index a7fd5d9..84ed0df 100644
100
101 vmlinux-dirs := $(patsubst %/,%,$(filter %/, $(init-y) $(init-m) \
102 $(core-y) $(core-m) $(drivers-y) $(drivers-m) \
103 -@@ -803,6 +878,8 @@ endif
104 +@@ -803,6 +876,8 @@ endif
105
106 # The actual objects are generated when descending,
107 # make sure no implicit rule kicks in
108 @@ -431,7 +429,7 @@ index a7fd5d9..84ed0df 100644
109 $(sort $(vmlinux-deps)): $(vmlinux-dirs) ;
110
111 # Handle descending into subdirectories listed in $(vmlinux-dirs)
112 -@@ -812,7 +889,7 @@ $(sort $(vmlinux-deps)): $(vmlinux-dirs) ;
113 +@@ -812,7 +887,7 @@ $(sort $(vmlinux-deps)): $(vmlinux-dirs) ;
114 # Error messages still appears in the original language
115
116 PHONY += $(vmlinux-dirs)
117 @@ -440,7 +438,7 @@ index a7fd5d9..84ed0df 100644
118 $(Q)$(MAKE) $(build)=$@
119
120 define filechk_kernel.release
121 -@@ -855,10 +932,13 @@ prepare1: prepare2 $(version_h) include/generated/utsrelease.h \
122 +@@ -855,10 +930,13 @@ prepare1: prepare2 $(version_h) include/generated/utsrelease.h \
123
124 archprepare: archheaders archscripts prepare1 scripts_basic
125
126 @@ -454,7 +452,7 @@ index a7fd5d9..84ed0df 100644
127 prepare: prepare0
128
129 # Generate some files
130 -@@ -966,6 +1046,8 @@ all: modules
131 +@@ -966,6 +1044,8 @@ all: modules
132 # using awk while concatenating to the final file.
133
134 PHONY += modules
135 @@ -463,7 +461,7 @@ index a7fd5d9..84ed0df 100644
136 modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux) modules.builtin
137 $(Q)$(AWK) '!x[$$0]++' $(vmlinux-dirs:%=$(objtree)/%/modules.order) > $(objtree)/modules.order
138 @$(kecho) ' Building modules, stage 2.';
139 -@@ -981,7 +1063,7 @@ modules.builtin: $(vmlinux-dirs:%=%/modules.builtin)
140 +@@ -981,7 +1061,7 @@ modules.builtin: $(vmlinux-dirs:%=%/modules.builtin)
141
142 # Target to prepare building external modules
143 PHONY += modules_prepare
144 @@ -472,17 +470,17 @@ index a7fd5d9..84ed0df 100644
145
146 # Target to install modules
147 PHONY += modules_install
148 -@@ -1047,7 +1129,8 @@ MRPROPER_FILES += .config .config.old .version .old_version $(version_h) \
149 +@@ -1047,7 +1127,8 @@ MRPROPER_FILES += .config .config.old .version .old_version $(version_h) \
150 Module.symvers tags TAGS cscope* GPATH GTAGS GRTAGS GSYMS \
151 signing_key.priv signing_key.x509 x509.genkey \
152 extra_certificates signing_key.x509.keyid \
153 - signing_key.x509.signer
154 + signing_key.x509.signer tools/gcc/size_overflow_hash.h \
155 -+ tools/gcc/randomize_layout_seed.h tools/gcc/randomize_layout_hash.data
156 ++ tools/gcc/randomize_layout_seed.h
157
158 # clean - Delete most, but leave enough to build external modules
159 #
160 -@@ -1087,6 +1170,7 @@ distclean: mrproper
161 +@@ -1087,6 +1168,7 @@ distclean: mrproper
162 \( -name '*.orig' -o -name '*.rej' -o -name '*~' \
163 -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
164 -o -name '.*.rej' \
165 @@ -490,7 +488,7 @@ index a7fd5d9..84ed0df 100644
166 -o -name '*%' -o -name '.*.cmd' -o -name 'core' \) \
167 -type f -print | xargs rm -f
168
169 -@@ -1248,6 +1332,8 @@ PHONY += $(module-dirs) modules
170 +@@ -1248,6 +1330,8 @@ PHONY += $(module-dirs) modules
171 $(module-dirs): crmodverdir $(objtree)/Module.symvers
172 $(Q)$(MAKE) $(build)=$(patsubst _module_%,%,$@)
173
174 @@ -499,7 +497,7 @@ index a7fd5d9..84ed0df 100644
175 modules: $(module-dirs)
176 @$(kecho) ' Building modules, stage 2.';
177 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
178 -@@ -1387,17 +1473,21 @@ else
179 +@@ -1387,17 +1471,21 @@ else
180 target-dir = $(if $(KBUILD_EXTMOD),$(dir $<),$(dir $@))
181 endif
182
183 @@ -525,7 +523,7 @@ index a7fd5d9..84ed0df 100644
184 $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
185 %.symtypes: %.c prepare scripts FORCE
186 $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
187 -@@ -1407,11 +1497,15 @@ endif
188 +@@ -1407,11 +1495,15 @@ endif
189 $(cmd_crmodverdir)
190 $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
191 $(build)=$(build-dir)
192 @@ -81343,10 +81341,10 @@ index 239e277..22a5cf5 100644
193
194 #ifdef CONFIG_UTS_NS
195 diff --git a/include/linux/vermagic.h b/include/linux/vermagic.h
196 -index 6f8fbcf..e2a0e61 100644
197 +index 6f8fbcf..4efc177 100644
198 --- a/include/linux/vermagic.h
199 +++ b/include/linux/vermagic.h
200 -@@ -25,9 +25,41 @@
201 +@@ -25,9 +25,42 @@
202 #define MODULE_ARCH_VERMAGIC ""
203 #endif
204
205 @@ -81369,6 +81367,7 @@ index 6f8fbcf..e2a0e61 100644
206 +#endif
207 +
208 +#ifdef RANDSTRUCT_PLUGIN
209 ++#include <generated/randomize_layout_hash.h>
210 +#define MODULE_RANDSTRUCT_PLUGIN "RANDSTRUCT_PLUGIN_" RANDSTRUCT_HASHED_SEED
211 +#else
212 +#define MODULE_RANDSTRUCT_PLUGIN
213 @@ -103826,19 +103825,18 @@ index 7778b8e..3d619fc 100644
214
215 diff --git a/tools/gcc/.gitignore b/tools/gcc/.gitignore
216 new file mode 100644
217 -index 0000000..54052c3
218 +index 0000000..4c2c45c
219 --- /dev/null
220 +++ b/tools/gcc/.gitignore
221 -@@ -0,0 +1,3 @@
222 -+size_overflow_hash.h
223 +@@ -0,0 +1,2 @@
224 +randomize_layout_seed.h
225 -+randomize_layout_hash.data
226 ++size_overflow_hash.h
227 diff --git a/tools/gcc/Makefile b/tools/gcc/Makefile
228 new file mode 100644
229 -index 0000000..51a2ba2
230 +index 0000000..0d1d9d3
231 --- /dev/null
232 +++ b/tools/gcc/Makefile
233 -@@ -0,0 +1,55 @@
234 +@@ -0,0 +1,54 @@
235 +#CC := gcc
236 +#PLUGIN_SOURCE_FILES := pax_plugin.c
237 +#PLUGIN_OBJECT_FILES := $(patsubst %.c,%.o,$(PLUGIN_SOURCE_FILES))
238 @@ -103878,8 +103876,7 @@ index 0000000..51a2ba2
239 +randomize_layout_plugin-objs := randomize_layout_plugin.o
240 +
241 +$(obj)/size_overflow_plugin.o: $(objtree)/$(obj)/size_overflow_hash.h
242 -+$(obj)/randomize_layout_plugin.o: $(objtree)/$(obj)/randomize_layout_seed.h \
243 -+ $(objtree)/$(obj)/randomize_layout_hash.data
244 ++$(obj)/randomize_layout_plugin.o: $(objtree)/$(obj)/randomize_layout_seed.h
245 +
246 +quiet_cmd_build_size_overflow_hash = GENHASH $@
247 + cmd_build_size_overflow_hash = \
248 @@ -103889,11 +103886,11 @@ index 0000000..51a2ba2
249 +
250 +quiet_cmd_create_randomize_layout_seed = GENSEED $@
251 + cmd_create_randomize_layout_seed = \
252 -+ $(CONFIG_SHELL) $(srctree)/$(src)/gen-random-seed.sh $@ $(objtree)/$(obj)/randomize_layout_hash.data
253 -+$(objtree)/$(obj)/randomize_layout_seed.h $(objtree)/$(obj)/randomize_layout_hash.data: FORCE
254 ++ $(CONFIG_SHELL) $(srctree)/$(src)/gen-random-seed.sh $@ $(objtree)/include/generated/randomize_layout_hash.h
255 ++$(objtree)/$(obj)/randomize_layout_seed.h: FORCE
256 + $(call if_changed,create_randomize_layout_seed)
257 +
258 -+targets += size_overflow_hash.h randomize_layout_seed.h randomize_layout_hash.data
259 ++targets += size_overflow_hash.h randomize_layout_seed.h randomize_layout_hash.h
260 diff --git a/tools/gcc/checker_plugin.c b/tools/gcc/checker_plugin.c
261 new file mode 100644
262 index 0000000..5452feea
263 @@ -105059,16 +105056,17 @@ index 0000000..312d3b6
264 +#endif
265 diff --git a/tools/gcc/gen-random-seed.sh b/tools/gcc/gen-random-seed.sh
266 new file mode 100644
267 -index 0000000..8030e6e
268 +index 0000000..7514850
269 --- /dev/null
270 +++ b/tools/gcc/gen-random-seed.sh
271 -@@ -0,0 +1,7 @@
272 +@@ -0,0 +1,8 @@
273 +#!/bin/sh
274 +
275 +if [ ! -f "$1" ]; then
276 + SEED=`od -A n -t x8 -N 32 /dev/urandom | tr -d ' \n'`
277 + echo "const char *randstruct_seed = \"$SEED\";" > "$1"
278 -+ echo -n "$SEED" | sha256sum | cut -d" " -f1 | tr -d "\n" > "$2"
279 ++ HASH=`echo -n "$SEED" | sha256sum | cut -d" " -f1 | tr -d ' \n'`
280 ++ echo "#define RANDSTRUCT_HASHED_SEED \"$HASH\"" > "$2"
281 +fi
282 diff --git a/tools/gcc/generate_size_overflow_hash.sh b/tools/gcc/generate_size_overflow_hash.sh
283 new file mode 100644
284
285 diff --git a/3.2.54/0000_README b/3.2.54/0000_README
286 index 2e1f77c..36ebbf6 100644
287 --- a/3.2.54/0000_README
288 +++ b/3.2.54/0000_README
289 @@ -134,7 +134,7 @@ Patch: 1053_linux-3.2.54.patch
290 From: http://www.kernel.org
291 Desc: Linux 3.2.54
292
293 -Patch: 4420_grsecurity-3.0-3.2.54-201402090000.patch
294 +Patch: 4420_grsecurity-3.0-3.2.54-201402091132.patch
295 From: http://www.grsecurity.net
296 Desc: hardened-sources base patch from upstream grsecurity
297
298
299 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
300 similarity index 99%
301 rename from 3.2.54/4420_grsecurity-3.0-3.2.54-201402090000.patch
302 rename to 3.2.54/4420_grsecurity-3.0-3.2.54-201402091132.patch
303 index f378eea..c8d6e90 100644
304 --- a/3.2.54/4420_grsecurity-3.0-3.2.54-201402090000.patch
305 +++ b/3.2.54/4420_grsecurity-3.0-3.2.54-201402091132.patch
306 @@ -1,5 +1,5 @@
307 diff --git a/Documentation/dontdiff b/Documentation/dontdiff
308 -index dfa6fc6..58798e8 100644
309 +index dfa6fc6..ccbfbf3 100644
310 --- a/Documentation/dontdiff
311 +++ b/Documentation/dontdiff
312 @@ -2,9 +2,11 @@
313 @@ -153,7 +153,7 @@ index dfa6fc6..58798e8 100644
314 r300_reg_safe.h
315 r420_reg_safe.h
316 r600_reg_safe.h
317 -+randomize_layout_hash.data
318 ++randomize_layout_hash.h
319 +randomize_layout_seed.h
320 recordmcount
321 +regdb.c
322 @@ -273,7 +273,7 @@ index 88fd7f5..b318a78 100644
323 ==============================================================
324
325 diff --git a/Makefile b/Makefile
326 -index 848be26..a460525 100644
327 +index 848be26..296b92f 100644
328 --- a/Makefile
329 +++ b/Makefile
330 @@ -245,8 +245,9 @@ CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
331 @@ -315,7 +315,7 @@ index 848be26..a460525 100644
332 $(Q)$(MAKE) $(build)=scripts/basic
333 $(Q)rm -f .tmp_quiet_recordmcount
334
335 -@@ -564,6 +571,74 @@ else
336 +@@ -564,6 +571,72 @@ else
337 KBUILD_CFLAGS += -O2
338 endif
339
340 @@ -343,8 +343,6 @@ index 848be26..a460525 100644
341 +endif
342 +ifdef CONFIG_GRKERNSEC_RANDSTRUCT
343 +RANDSTRUCT_PLUGIN_CFLAGS := -fplugin=$(objtree)/tools/gcc/randomize_layout_plugin.so -DRANDSTRUCT_PLUGIN
344 -+RANDSTRUCT_HASHED_SEED := $(shell cat "$(objtree)/tools/gcc/randomize_layout_hash.data")
345 -+RANDSTRUCT_PLUGIN_CFLAGS += -DRANDSTRUCT_HASHED_SEED="\"$(RANDSTRUCT_HASHED_SEED)\""
346 +ifdef CONFIG_GRKERNSEC_RANDSTRUCT_PERFORMANCE
347 +RANDSTRUCT_PLUGIN_CFLAGS += -fplugin-arg-randomize_layout_plugin-performance-mode
348 +endif
349 @@ -390,7 +388,7 @@ index 848be26..a460525 100644
350 include $(srctree)/arch/$(SRCARCH)/Makefile
351
352 ifneq ($(CONFIG_FRAME_WARN),0)
353 -@@ -594,7 +669,7 @@ endif
354 +@@ -594,7 +667,7 @@ endif
355
356 ifdef CONFIG_DEBUG_INFO
357 KBUILD_CFLAGS += -g
358 @@ -399,7 +397,7 @@ index 848be26..a460525 100644
359 endif
360
361 ifdef CONFIG_DEBUG_INFO_REDUCED
362 -@@ -708,7 +783,7 @@ export mod_strip_cmd
363 +@@ -708,7 +781,7 @@ export mod_strip_cmd
364
365
366 ifeq ($(KBUILD_EXTMOD),)
367 @@ -408,7 +406,7 @@ index 848be26..a460525 100644
368
369 vmlinux-dirs := $(patsubst %/,%,$(filter %/, $(init-y) $(init-m) \
370 $(core-y) $(core-m) $(drivers-y) $(drivers-m) \
371 -@@ -932,6 +1007,8 @@ vmlinux.o: $(modpost-init) $(vmlinux-main) FORCE
372 +@@ -932,6 +1005,8 @@ vmlinux.o: $(modpost-init) $(vmlinux-main) FORCE
373
374 # The actual objects are generated when descending,
375 # make sure no implicit rule kicks in
376 @@ -417,7 +415,7 @@ index 848be26..a460525 100644
377 $(sort $(vmlinux-init) $(vmlinux-main)) $(vmlinux-lds): $(vmlinux-dirs) ;
378
379 # Handle descending into subdirectories listed in $(vmlinux-dirs)
380 -@@ -941,7 +1018,7 @@ $(sort $(vmlinux-init) $(vmlinux-main)) $(vmlinux-lds): $(vmlinux-dirs) ;
381 +@@ -941,7 +1016,7 @@ $(sort $(vmlinux-init) $(vmlinux-main)) $(vmlinux-lds): $(vmlinux-dirs) ;
382 # Error messages still appears in the original language
383
384 PHONY += $(vmlinux-dirs)
385 @@ -426,7 +424,7 @@ index 848be26..a460525 100644
386 $(Q)$(MAKE) $(build)=$@
387
388 # Store (new) KERNELRELASE string in include/config/kernel.release
389 -@@ -981,10 +1058,13 @@ prepare1: prepare2 include/linux/version.h include/generated/utsrelease.h \
390 +@@ -981,10 +1056,13 @@ prepare1: prepare2 include/linux/version.h include/generated/utsrelease.h \
391
392 archprepare: archscripts prepare1 scripts_basic
393
394 @@ -440,7 +438,7 @@ index 848be26..a460525 100644
395 prepare: prepare0
396
397 # Generate some files
398 -@@ -1089,6 +1169,8 @@ all: modules
399 +@@ -1089,6 +1167,8 @@ all: modules
400 # using awk while concatenating to the final file.
401
402 PHONY += modules
403 @@ -449,7 +447,7 @@ index 848be26..a460525 100644
404 modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux) modules.builtin
405 $(Q)$(AWK) '!x[$$0]++' $(vmlinux-dirs:%=$(objtree)/%/modules.order) > $(objtree)/modules.order
406 @$(kecho) ' Building modules, stage 2.';
407 -@@ -1104,7 +1186,7 @@ modules.builtin: $(vmlinux-dirs:%=%/modules.builtin)
408 +@@ -1104,7 +1184,7 @@ modules.builtin: $(vmlinux-dirs:%=%/modules.builtin)
409
410 # Target to prepare building external modules
411 PHONY += modules_prepare
412 @@ -458,7 +456,7 @@ index 848be26..a460525 100644
413
414 # Target to install modules
415 PHONY += modules_install
416 -@@ -1163,8 +1245,9 @@ CLEAN_FILES += vmlinux System.map \
417 +@@ -1163,8 +1243,9 @@ CLEAN_FILES += vmlinux System.map \
418 MRPROPER_DIRS += include/config usr/include include/generated \
419 arch/*/include/generated
420 MRPROPER_FILES += .config .config.old .version .old_version \
421 @@ -466,11 +464,11 @@ index 848be26..a460525 100644
422 - Module.symvers tags TAGS cscope* GPATH GTAGS GRTAGS GSYMS
423 + include/linux/version.h tools/gcc/size_overflow_hash.h\
424 + Module.symvers tags TAGS cscope* GPATH GTAGS GRTAGS GSYMS \
425 -+ tools/gcc/randomize_layout_seed.h tools/gcc/randomize_layout_hash.data
426 ++ tools/gcc/randomize_layout_seed.h
427
428 # clean - Delete most, but leave enough to build external modules
429 #
430 -@@ -1201,6 +1284,7 @@ distclean: mrproper
431 +@@ -1201,6 +1282,7 @@ distclean: mrproper
432 \( -name '*.orig' -o -name '*.rej' -o -name '*~' \
433 -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
434 -o -name '.*.rej' \
435 @@ -478,7 +476,7 @@ index 848be26..a460525 100644
436 -o -name '*%' -o -name '.*.cmd' -o -name 'core' \) \
437 -type f -print | xargs rm -f
438
439 -@@ -1361,6 +1445,8 @@ PHONY += $(module-dirs) modules
440 +@@ -1361,6 +1443,8 @@ PHONY += $(module-dirs) modules
441 $(module-dirs): crmodverdir $(objtree)/Module.symvers
442 $(Q)$(MAKE) $(build)=$(patsubst _module_%,%,$@)
443
444 @@ -487,7 +485,7 @@ index 848be26..a460525 100644
445 modules: $(module-dirs)
446 @$(kecho) ' Building modules, stage 2.';
447 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
448 -@@ -1487,17 +1573,21 @@ else
449 +@@ -1487,17 +1571,21 @@ else
450 target-dir = $(if $(KBUILD_EXTMOD),$(dir $<),$(dir $@))
451 endif
452
453 @@ -513,7 +511,7 @@ index 848be26..a460525 100644
454 $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
455 %.symtypes: %.c prepare scripts FORCE
456 $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
457 -@@ -1507,11 +1597,15 @@ endif
458 +@@ -1507,11 +1595,15 @@ endif
459 $(cmd_crmodverdir)
460 $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
461 $(build)=$(build-dir)
462 @@ -80703,10 +80701,10 @@ index c714ed7..fb6d16c 100644
463
464 #ifdef CONFIG_UTS_NS
465 diff --git a/include/linux/vermagic.h b/include/linux/vermagic.h
466 -index 6f8fbcf..e2a0e61 100644
467 +index 6f8fbcf..4efc177 100644
468 --- a/include/linux/vermagic.h
469 +++ b/include/linux/vermagic.h
470 -@@ -25,9 +25,41 @@
471 +@@ -25,9 +25,42 @@
472 #define MODULE_ARCH_VERMAGIC ""
473 #endif
474
475 @@ -80729,6 +80727,7 @@ index 6f8fbcf..e2a0e61 100644
476 +#endif
477 +
478 +#ifdef RANDSTRUCT_PLUGIN
479 ++#include <generated/randomize_layout_hash.h>
480 +#define MODULE_RANDSTRUCT_PLUGIN "RANDSTRUCT_PLUGIN_" RANDSTRUCT_HASHED_SEED
481 +#else
482 +#define MODULE_RANDSTRUCT_PLUGIN
483 @@ -107041,19 +107040,18 @@ index 0a7ca6c..f4b948c 100644
484 };
485 diff --git a/tools/gcc/.gitignore b/tools/gcc/.gitignore
486 new file mode 100644
487 -index 0000000..54052c3
488 +index 0000000..4c2c45c
489 --- /dev/null
490 +++ b/tools/gcc/.gitignore
491 -@@ -0,0 +1,3 @@
492 -+size_overflow_hash.h
493 +@@ -0,0 +1,2 @@
494 +randomize_layout_seed.h
495 -+randomize_layout_hash.data
496 ++size_overflow_hash.h
497 diff --git a/tools/gcc/Makefile b/tools/gcc/Makefile
498 new file mode 100644
499 -index 0000000..51a2ba2
500 +index 0000000..0d1d9d3
501 --- /dev/null
502 +++ b/tools/gcc/Makefile
503 -@@ -0,0 +1,55 @@
504 +@@ -0,0 +1,54 @@
505 +#CC := gcc
506 +#PLUGIN_SOURCE_FILES := pax_plugin.c
507 +#PLUGIN_OBJECT_FILES := $(patsubst %.c,%.o,$(PLUGIN_SOURCE_FILES))
508 @@ -107093,8 +107091,7 @@ index 0000000..51a2ba2
509 +randomize_layout_plugin-objs := randomize_layout_plugin.o
510 +
511 +$(obj)/size_overflow_plugin.o: $(objtree)/$(obj)/size_overflow_hash.h
512 -+$(obj)/randomize_layout_plugin.o: $(objtree)/$(obj)/randomize_layout_seed.h \
513 -+ $(objtree)/$(obj)/randomize_layout_hash.data
514 ++$(obj)/randomize_layout_plugin.o: $(objtree)/$(obj)/randomize_layout_seed.h
515 +
516 +quiet_cmd_build_size_overflow_hash = GENHASH $@
517 + cmd_build_size_overflow_hash = \
518 @@ -107104,11 +107101,11 @@ index 0000000..51a2ba2
519 +
520 +quiet_cmd_create_randomize_layout_seed = GENSEED $@
521 + cmd_create_randomize_layout_seed = \
522 -+ $(CONFIG_SHELL) $(srctree)/$(src)/gen-random-seed.sh $@ $(objtree)/$(obj)/randomize_layout_hash.data
523 -+$(objtree)/$(obj)/randomize_layout_seed.h $(objtree)/$(obj)/randomize_layout_hash.data: FORCE
524 ++ $(CONFIG_SHELL) $(srctree)/$(src)/gen-random-seed.sh $@ $(objtree)/include/generated/randomize_layout_hash.h
525 ++$(objtree)/$(obj)/randomize_layout_seed.h: FORCE
526 + $(call if_changed,create_randomize_layout_seed)
527 +
528 -+targets += size_overflow_hash.h randomize_layout_seed.h randomize_layout_hash.data
529 ++targets += size_overflow_hash.h randomize_layout_seed.h randomize_layout_hash.h
530 diff --git a/tools/gcc/checker_plugin.c b/tools/gcc/checker_plugin.c
531 new file mode 100644
532 index 0000000..5452feea
533 @@ -108274,16 +108271,17 @@ index 0000000..312d3b6
534 +#endif
535 diff --git a/tools/gcc/gen-random-seed.sh b/tools/gcc/gen-random-seed.sh
536 new file mode 100644
537 -index 0000000..8030e6e
538 +index 0000000..7514850
539 --- /dev/null
540 +++ b/tools/gcc/gen-random-seed.sh
541 -@@ -0,0 +1,7 @@
542 +@@ -0,0 +1,8 @@
543 +#!/bin/sh
544 +
545 +if [ ! -f "$1" ]; then
546 + SEED=`od -A n -t x8 -N 32 /dev/urandom | tr -d ' \n'`
547 + echo "const char *randstruct_seed = \"$SEED\";" > "$1"
548 -+ echo -n "$SEED" | sha256sum | cut -d" " -f1 | tr -d "\n" > "$2"
549 ++ HASH=`echo -n "$SEED" | sha256sum | cut -d" " -f1 | tr -d ' \n'`
550 ++ echo "#define RANDSTRUCT_HASHED_SEED \"$HASH\"" > "$2"
551 +fi
552 diff --git a/tools/gcc/generate_size_overflow_hash.sh b/tools/gcc/generate_size_overflow_hash.sh
553 new file mode 100644