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: 4.5.7/
Date: Thu, 30 Jun 2016 13:09:49
Message-Id: 1467292336.9efc134b4d978753db4dd108ac3fb9e5b8f0a52b.blueness@gentoo
1 commit: 9efc134b4d978753db4dd108ac3fb9e5b8f0a52b
2 Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
3 AuthorDate: Thu Jun 30 13:12:16 2016 +0000
4 Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
5 CommitDate: Thu Jun 30 13:12:16 2016 +0000
6 URL: https://gitweb.gentoo.org/proj/hardened-patchset.git/commit/?id=9efc134b
7
8 grsecurity-3.1-4.5.7-201606282216
9
10 4.5.7/0000_README | 2 +-
11 ...> 4420_grsecurity-3.1-4.5.7-201606282216.patch} | 680 ++++++++++++++++-----
12 2 files changed, 524 insertions(+), 158 deletions(-)
13
14 diff --git a/4.5.7/0000_README b/4.5.7/0000_README
15 index bdf9f5e..b74e534 100644
16 --- a/4.5.7/0000_README
17 +++ b/4.5.7/0000_README
18 @@ -2,7 +2,7 @@ README
19 -----------------------------------------------------------------------------
20 Individual Patch Descriptions:
21 -----------------------------------------------------------------------------
22 -Patch: 4420_grsecurity-3.1-4.5.7-201606280009.patch
23 +Patch: 4420_grsecurity-3.1-4.5.7-201606282216.patch
24 From: http://www.grsecurity.net
25 Desc: hardened-sources base patch from upstream grsecurity
26
27
28 diff --git a/4.5.7/4420_grsecurity-3.1-4.5.7-201606280009.patch b/4.5.7/4420_grsecurity-3.1-4.5.7-201606282216.patch
29 similarity index 99%
30 rename from 4.5.7/4420_grsecurity-3.1-4.5.7-201606280009.patch
31 rename to 4.5.7/4420_grsecurity-3.1-4.5.7-201606282216.patch
32 index f3179f6..01f7898 100644
33 --- a/4.5.7/4420_grsecurity-3.1-4.5.7-201606280009.patch
34 +++ b/4.5.7/4420_grsecurity-3.1-4.5.7-201606282216.patch
35 @@ -8554,6 +8554,37 @@ index 523673d..4aeef3b 100644
36 : "=&r"(tmp)
37 : "r"(&rw->lock)
38 : "cr0", "xer", "memory");
39 +diff --git a/arch/powerpc/include/asm/string.h b/arch/powerpc/include/asm/string.h
40 +index e40010a..d3c3d6b 100644
41 +--- a/arch/powerpc/include/asm/string.h
42 ++++ b/arch/powerpc/include/asm/string.h
43 +@@ -15,17 +15,17 @@
44 + #define __HAVE_ARCH_MEMCMP
45 + #define __HAVE_ARCH_MEMCHR
46 +
47 +-extern char * strcpy(char *,const char *);
48 +-extern char * strncpy(char *,const char *, __kernel_size_t);
49 ++extern char * strcpy(char *,const char *) __nocapture(2);
50 ++extern char * strncpy(char *,const char *, __kernel_size_t) __nocapture(2);
51 + extern __kernel_size_t strlen(const char *);
52 +-extern int strcmp(const char *,const char *);
53 +-extern int strncmp(const char *, const char *, __kernel_size_t);
54 +-extern char * strcat(char *, const char *);
55 ++extern int strcmp(const char *,const char *) __nocapture(1, 2);
56 ++extern int strncmp(const char *, const char *, __kernel_size_t) __nocapture(1, 2);
57 ++extern char * strcat(char *, const char *) __nocapture(2);
58 + extern void * memset(void *,int,__kernel_size_t);
59 +-extern void * memcpy(void *,const void *,__kernel_size_t);
60 +-extern void * memmove(void *,const void *,__kernel_size_t);
61 +-extern int memcmp(const void *,const void *,__kernel_size_t);
62 +-extern void * memchr(const void *,int,__kernel_size_t);
63 ++extern void * memcpy(void *,const void *,__kernel_size_t) __nocapture(2);
64 ++extern void * memmove(void *,const void *,__kernel_size_t) __nocapture(2);
65 ++extern int memcmp(const void *,const void *,__kernel_size_t) __nocapture(1, 2);
66 ++extern void * memchr(const void *,int,__kernel_size_t) __nocapture(1);
67 +
68 + #endif /* __KERNEL__ */
69 +
70 diff --git a/arch/powerpc/include/asm/thread_info.h b/arch/powerpc/include/asm/thread_info.h
71 index 7efee4a..48d47cc 100644
72 --- a/arch/powerpc/include/asm/thread_info.h
73 @@ -12410,7 +12441,7 @@ index ad8f795..2c7eec6 100644
74 /*
75 * Memory returned by kmalloc() may be used for DMA, so we must make
76 diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
77 -index 3bf45a0..25ca7da 100644
78 +index 3bf45a0..b08241b 100644
79 --- a/arch/x86/Kconfig
80 +++ b/arch/x86/Kconfig
81 @@ -38,14 +38,13 @@ config X86
82 @@ -12446,7 +12477,23 @@ index 3bf45a0..25ca7da 100644
83 select HAVE_GENERIC_DMA_COHERENT if X86_32
84 select HAVE_HW_BREAKPOINT
85 select HAVE_IDE
86 -@@ -290,7 +290,7 @@ config X86_64_SMP
87 +@@ -184,11 +184,13 @@ config MMU
88 + def_bool y
89 +
90 + config ARCH_MMAP_RND_BITS_MIN
91 +- default 28 if 64BIT
92 ++ default 28 if 64BIT && !PAX_PER_CPU_PGD
93 ++ default 27 if 64BIT && PAX_PER_CPU_PGD
94 + default 8
95 +
96 + config ARCH_MMAP_RND_BITS_MAX
97 +- default 32 if 64BIT
98 ++ default 32 if 64BIT && !PAX_PER_CPU_PGD
99 ++ default 27 if 64BIT && PAX_PER_CPU_PGD
100 + default 16
101 +
102 + config ARCH_MMAP_RND_COMPAT_BITS_MIN
103 +@@ -290,7 +292,7 @@ config X86_64_SMP
104
105 config X86_32_LAZY_GS
106 def_bool y
107 @@ -12455,7 +12502,7 @@ index 3bf45a0..25ca7da 100644
108
109 config ARCH_HWEIGHT_CFLAGS
110 string
111 -@@ -674,6 +674,7 @@ config SCHED_OMIT_FRAME_POINTER
112 +@@ -674,6 +676,7 @@ config SCHED_OMIT_FRAME_POINTER
113
114 menuconfig HYPERVISOR_GUEST
115 bool "Linux guest support"
116 @@ -12463,7 +12510,7 @@ index 3bf45a0..25ca7da 100644
117 ---help---
118 Say Y here to enable options for running Linux under various hyper-
119 visors. This option enables basic hypervisor detection and platform
120 -@@ -1073,6 +1074,7 @@ config VM86
121 +@@ -1073,6 +1076,7 @@ config VM86
122
123 config X86_16BIT
124 bool "Enable support for 16-bit segments" if EXPERT
125 @@ -12471,7 +12518,7 @@ index 3bf45a0..25ca7da 100644
126 default y
127 depends on MODIFY_LDT_SYSCALL
128 ---help---
129 -@@ -1227,6 +1229,7 @@ choice
130 +@@ -1227,6 +1231,7 @@ choice
131
132 config NOHIGHMEM
133 bool "off"
134 @@ -12479,7 +12526,7 @@ index 3bf45a0..25ca7da 100644
135 ---help---
136 Linux can use up to 64 Gigabytes of physical memory on x86 systems.
137 However, the address space of 32-bit x86 processors is only 4
138 -@@ -1263,6 +1266,7 @@ config NOHIGHMEM
139 +@@ -1263,6 +1268,7 @@ config NOHIGHMEM
140
141 config HIGHMEM4G
142 bool "4GB"
143 @@ -12487,7 +12534,7 @@ index 3bf45a0..25ca7da 100644
144 ---help---
145 Select this if you have a 32-bit processor and between 1 and 4
146 gigabytes of physical RAM.
147 -@@ -1315,7 +1319,7 @@ config PAGE_OFFSET
148 +@@ -1315,7 +1321,7 @@ config PAGE_OFFSET
149 hex
150 default 0xB0000000 if VMSPLIT_3G_OPT
151 default 0x80000000 if VMSPLIT_2G
152 @@ -12496,7 +12543,7 @@ index 3bf45a0..25ca7da 100644
153 default 0x40000000 if VMSPLIT_1G
154 default 0xC0000000
155 depends on X86_32
156 -@@ -1336,7 +1340,6 @@ config X86_PAE
157 +@@ -1336,7 +1342,6 @@ config X86_PAE
158
159 config ARCH_PHYS_ADDR_T_64BIT
160 def_bool y
161 @@ -12504,7 +12551,7 @@ index 3bf45a0..25ca7da 100644
162
163 config ARCH_DMA_ADDR_T_64BIT
164 def_bool y
165 -@@ -1467,7 +1470,7 @@ config ARCH_PROC_KCORE_TEXT
166 +@@ -1467,7 +1472,7 @@ config ARCH_PROC_KCORE_TEXT
167
168 config ILLEGAL_POINTER_VALUE
169 hex
170 @@ -12513,7 +12560,7 @@ index 3bf45a0..25ca7da 100644
171 default 0xdead000000000000 if X86_64
172
173 source "mm/Kconfig"
174 -@@ -1776,6 +1779,7 @@ source kernel/Kconfig.hz
175 +@@ -1776,6 +1781,7 @@ source kernel/Kconfig.hz
176 config KEXEC
177 bool "kexec system call"
178 select KEXEC_CORE
179 @@ -12521,7 +12568,7 @@ index 3bf45a0..25ca7da 100644
180 ---help---
181 kexec is a system call that implements the ability to shutdown your
182 current kernel, and to start another kernel. It is like a reboot
183 -@@ -1958,7 +1962,9 @@ config X86_NEED_RELOCS
184 +@@ -1958,7 +1964,9 @@ config X86_NEED_RELOCS
185
186 config PHYSICAL_ALIGN
187 hex "Alignment value to which kernel should be aligned"
188 @@ -12532,7 +12579,7 @@ index 3bf45a0..25ca7da 100644
189 range 0x2000 0x1000000 if X86_32
190 range 0x200000 0x1000000 if X86_64
191 ---help---
192 -@@ -2041,6 +2047,7 @@ config COMPAT_VDSO
193 +@@ -2041,6 +2049,7 @@ config COMPAT_VDSO
194 def_bool n
195 prompt "Disable the 32-bit vDSO (needed for glibc 2.3.3)"
196 depends on X86_32 || IA32_EMULATION
197 @@ -12540,7 +12587,7 @@ index 3bf45a0..25ca7da 100644
198 ---help---
199 Certain buggy versions of glibc will crash if they are
200 presented with a 32-bit vDSO that is not mapped at the address
201 -@@ -2081,15 +2088,6 @@ choice
202 +@@ -2081,15 +2090,6 @@ choice
203
204 If unsure, select "Emulate".
205
206 @@ -12556,7 +12603,7 @@ index 3bf45a0..25ca7da 100644
207 config LEGACY_VSYSCALL_EMULATE
208 bool "Emulate"
209 help
210 -@@ -2170,6 +2168,22 @@ config MODIFY_LDT_SYSCALL
211 +@@ -2170,6 +2170,22 @@ config MODIFY_LDT_SYSCALL
212
213 Saying 'N' here may make sense for embedded or server kernels.
214
215 @@ -12995,22 +13042,6 @@ index db75d07..8e6d0af 100644
216 struct biosregs ireg, oreg;
217 struct e820entry *desc = boot_params.e820_map;
218 static struct e820entry buf; /* static so it is zeroed */
219 -diff --git a/arch/x86/boot/string.h b/arch/x86/boot/string.h
220 -index 725e820..d7ea2759 100644
221 ---- a/arch/x86/boot/string.h
222 -+++ b/arch/x86/boot/string.h
223 -@@ -6,9 +6,9 @@
224 - #undef memset
225 - #undef memcmp
226 -
227 --void *memcpy(void *dst, const void *src, size_t len);
228 -+void *memcpy(void *dst, const void *src, size_t len) __nocapture(2);
229 - void *memset(void *dst, int c, size_t len);
230 --int memcmp(const void *s1, const void *s2, size_t len);
231 -+int memcmp(const void *s1, const void *s2, size_t len) __nocapture(1, 2);
232 -
233 - /*
234 - * Access builtin version by default. If one needs to use optimized version,
235 diff --git a/arch/x86/boot/video-vesa.c b/arch/x86/boot/video-vesa.c
236 index ba3e100..6501b8f 100644
237 --- a/arch/x86/boot/video-vesa.c
238 @@ -43254,6 +43285,40 @@ index aa872d2..afeae37 100644
239
240 /**
241 * struct samsung_clk_reg_dump: register dump of clock controller registers.
242 +diff --git a/drivers/clk/socfpga/clk-gate-a10.c b/drivers/clk/socfpga/clk-gate-a10.c
243 +index 1cebf25..ff2186f 100644
244 +--- a/drivers/clk/socfpga/clk-gate-a10.c
245 ++++ b/drivers/clk/socfpga/clk-gate-a10.c
246 +@@ -19,6 +19,7 @@
247 + #include <linux/mfd/syscon.h>
248 + #include <linux/of.h>
249 + #include <linux/regmap.h>
250 ++#include <asm/pgtable.h>
251 +
252 + #include "clk.h"
253 +
254 +@@ -97,7 +98,7 @@ static int socfpga_clk_prepare(struct clk_hw *hwclk)
255 + return 0;
256 + }
257 +
258 +-static struct clk_ops gateclk_ops = {
259 ++static clk_ops_no_const gateclk_ops __read_only = {
260 + .prepare = socfpga_clk_prepare,
261 + .recalc_rate = socfpga_gate_clk_recalc_rate,
262 + };
263 +@@ -129,8 +130,10 @@ static void __init __socfpga_gate_init(struct device_node *node,
264 + socfpga_clk->hw.reg = clk_mgr_a10_base_addr + clk_gate[0];
265 + socfpga_clk->hw.bit_idx = clk_gate[1];
266 +
267 +- gateclk_ops.enable = clk_gate_ops.enable;
268 +- gateclk_ops.disable = clk_gate_ops.disable;
269 ++ pax_open_kernel();
270 ++ const_cast(gateclk_ops.enable) = clk_gate_ops.enable;
271 ++ const_cast(gateclk_ops.disable) = clk_gate_ops.disable;
272 ++ pax_close_kernel();
273 + }
274 +
275 + rc = of_property_read_u32(node, "fixed-divider", &fixed_div);
276 diff --git a/drivers/clk/socfpga/clk-gate.c b/drivers/clk/socfpga/clk-gate.c
277 index aa7a6e6..1e9b426 100644
278 --- a/drivers/clk/socfpga/clk-gate.c
279 @@ -43288,6 +43353,40 @@ index aa7a6e6..1e9b426 100644
280 }
281
282 rc = of_property_read_u32(node, "fixed-divider", &fixed_div);
283 +diff --git a/drivers/clk/socfpga/clk-pll-a10.c b/drivers/clk/socfpga/clk-pll-a10.c
284 +index 402d630..d8590c8 100644
285 +--- a/drivers/clk/socfpga/clk-pll-a10.c
286 ++++ b/drivers/clk/socfpga/clk-pll-a10.c
287 +@@ -18,6 +18,7 @@
288 + #include <linux/io.h>
289 + #include <linux/of.h>
290 + #include <linux/of_address.h>
291 ++#include <asm/pgtable.h>
292 +
293 + #include "clk.h"
294 +
295 +@@ -69,7 +70,7 @@ static u8 clk_pll_get_parent(struct clk_hw *hwclk)
296 + CLK_MGR_PLL_CLK_SRC_MASK;
297 + }
298 +
299 +-static struct clk_ops clk_pll_ops = {
300 ++static clk_ops_no_const clk_pll_ops __read_only = {
301 + .recalc_rate = clk_pll_recalc_rate,
302 + .get_parent = clk_pll_get_parent,
303 + };
304 +@@ -112,8 +113,10 @@ static struct __init clk * __socfpga_pll_init(struct device_node *node,
305 + pll_clk->hw.hw.init = &init;
306 +
307 + pll_clk->hw.bit_idx = SOCFPGA_PLL_EXT_ENA;
308 +- clk_pll_ops.enable = clk_gate_ops.enable;
309 +- clk_pll_ops.disable = clk_gate_ops.disable;
310 ++ pax_open_kernel();
311 ++ const_cast(clk_pll_ops.enable) = clk_gate_ops.enable;
312 ++ const_cast(clk_pll_ops.disable) = clk_gate_ops.disable;
313 ++ pax_close_kernel();
314 +
315 + clk = clk_register(NULL, &pll_clk->hw.hw);
316 + if (WARN_ON(IS_ERR(clk))) {
317 diff --git a/drivers/clk/socfpga/clk-pll.c b/drivers/clk/socfpga/clk-pll.c
318 index c7f4631..8d1b7d0 100644
319 --- a/drivers/clk/socfpga/clk-pll.c
320 @@ -48960,19 +49059,18 @@ index 1161d68..7a42e2c 100644
321 packetlen_aligned = ALIGN(packetlen, sizeof(u64));
322
323 diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c
324 -index 11bca51..360c83e 100644
325 +index 11bca51..cc7da6f 100644
326 --- a/drivers/hv/hv.c
327 +++ b/drivers/hv/hv.c
328 -@@ -183,6 +183,8 @@ static struct clocksource hyperv_cs_tsc = {
329 +@@ -183,6 +183,7 @@ static struct clocksource hyperv_cs_tsc = {
330 };
331 #endif
332
333 -+extern char hv_hypercall_page[PAGE_SIZE] __aligned(PAGE_SIZE);
334 -+asm(".text; .balign 4096; hv_hypercall_page: .fill 4096,1,0xcc; .previous;");
335 ++static char hv_hypercall_page[PAGE_SIZE] __aligned(PAGE_SIZE) __used __section(".text");
336
337 /*
338 * hv_init - Main initialization routine.
339 -@@ -193,7 +195,6 @@ int hv_init(void)
340 +@@ -193,7 +194,6 @@ int hv_init(void)
341 {
342 int max_leaf;
343 union hv_x64_msr_hypercall_contents hypercall_msr;
344 @@ -48980,7 +49078,7 @@ index 11bca51..360c83e 100644
345
346 memset(hv_context.synic_event_page, 0, sizeof(void *) * NR_CPUS);
347 memset(hv_context.synic_message_page, 0,
348 -@@ -218,14 +219,9 @@ int hv_init(void)
349 +@@ -218,14 +218,9 @@ int hv_init(void)
350 /* See if the hypercall page is already set */
351 rdmsrl(HV_X64_MSR_HYPERCALL, hypercall_msr.as_uint64);
352
353 @@ -48996,7 +49094,7 @@ index 11bca51..360c83e 100644
354 wrmsrl(HV_X64_MSR_HYPERCALL, hypercall_msr.as_uint64);
355
356 /* Confirm that hypercall page did get setup. */
357 -@@ -235,7 +231,7 @@ int hv_init(void)
358 +@@ -235,7 +230,7 @@ int hv_init(void)
359 if (!hypercall_msr.enable)
360 goto cleanup;
361
362 @@ -49005,7 +49103,7 @@ index 11bca51..360c83e 100644
363
364 #ifdef CONFIG_X86_64
365 if (ms_hyperv.features & HV_X64_MSR_REFERENCE_TSC_AVAILABLE) {
366 -@@ -259,13 +255,9 @@ int hv_init(void)
367 +@@ -259,13 +254,9 @@ int hv_init(void)
368 return 0;
369
370 cleanup:
371 @@ -49022,7 +49120,7 @@ index 11bca51..360c83e 100644
372 }
373
374 return -ENOTSUPP;
375 -@@ -286,7 +278,6 @@ void hv_cleanup(void)
376 +@@ -286,7 +277,6 @@ void hv_cleanup(void)
377 if (hv_context.hypercall_page) {
378 hypercall_msr.as_uint64 = 0;
379 wrmsrl(HV_X64_MSR_HYPERCALL, hypercall_msr.as_uint64);
380 @@ -49160,7 +49258,7 @@ index 579bdf9..0dac21d5 100644
381 enable_cap_knobs, "IBM Active Energy Manager",
382 {
383 diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
384 -index 0af7fd3..2701c0a 100644
385 +index 0af7fd3..9aade6a 100644
386 --- a/drivers/hwmon/applesmc.c
387 +++ b/drivers/hwmon/applesmc.c
388 @@ -1105,7 +1105,7 @@ static int applesmc_create_nodes(struct applesmc_node_group *groups, int num)
389 @@ -49172,6 +49270,15 @@ index 0af7fd3..2701c0a 100644
390 int ret, i;
391
392 for (grp = groups; grp->format; grp++) {
393 +@@ -1242,7 +1242,7 @@ static int applesmc_dmi_match(const struct dmi_system_id *id)
394 + * Note that DMI_MATCH(...,"MacBook") will match "MacBookPro1,1".
395 + * So we need to put "Apple MacBook Pro" before "Apple MacBook".
396 + */
397 +-static __initdata struct dmi_system_id applesmc_whitelist[] = {
398 ++static __initconst struct dmi_system_id applesmc_whitelist[] = {
399 + { applesmc_dmi_match, "Apple MacBook Air", {
400 + DMI_MATCH(DMI_BOARD_VENDOR, "Apple"),
401 + DMI_MATCH(DMI_PRODUCT_NAME, "MacBookAir") },
402 diff --git a/drivers/hwmon/asus_atk0110.c b/drivers/hwmon/asus_atk0110.c
403 index cccef87..06ce8ec 100644
404 --- a/drivers/hwmon/asus_atk0110.c
405 @@ -49214,7 +49321,7 @@ index 6a27eb2..349ed23 100644
406 };
407
408 diff --git a/drivers/hwmon/dell-smm-hwmon.c b/drivers/hwmon/dell-smm-hwmon.c
409 -index c43318d..72f7656 100644
410 +index c43318d..2574fc5 100644
411 --- a/drivers/hwmon/dell-smm-hwmon.c
412 +++ b/drivers/hwmon/dell-smm-hwmon.c
413 @@ -819,7 +819,7 @@ static const struct i8k_config_data i8k_config_data[] = {
414 @@ -49222,10 +49329,19 @@ index c43318d..72f7656 100644
415 };
416
417 -static struct dmi_system_id i8k_dmi_table[] __initdata = {
418 -+static const struct dmi_system_id i8k_dmi_table[] __initconst = {
419 ++static struct dmi_system_id i8k_dmi_table[] __initconst = {
420 {
421 .ident = "Dell Inspiron",
422 .matches = {
423 +@@ -929,7 +929,7 @@ static struct dmi_system_id i8k_dmi_table[] __initdata = {
424 +
425 + MODULE_DEVICE_TABLE(dmi, i8k_dmi_table);
426 +
427 +-static struct dmi_system_id i8k_blacklist_dmi_table[] __initdata = {
428 ++static struct dmi_system_id i8k_blacklist_dmi_table[] __initconst = {
429 + {
430 + /*
431 + * CPU fan speed going up and down on Dell Studio XPS 8000
432 diff --git a/drivers/hwmon/ibmaem.c b/drivers/hwmon/ibmaem.c
433 index 1f64378..2b6e615 100644
434 --- a/drivers/hwmon/ibmaem.c
435 @@ -51034,7 +51150,7 @@ index 59ee4b8..e4b6234 100644
436
437 if (smmu->features & ARM_SMMU_FEAT_TRANS_S1)
438 diff --git a/drivers/iommu/io-pgtable-arm.c b/drivers/iommu/io-pgtable-arm.c
439 -index 381ca5a..f383021 100644
440 +index 381ca5a..6443bb0 100644
441 --- a/drivers/iommu/io-pgtable-arm.c
442 +++ b/drivers/iommu/io-pgtable-arm.c
443 @@ -39,9 +39,6 @@
444 @@ -51114,7 +51230,14 @@ index 381ca5a..f383021 100644
445
446 return data;
447 }
448 -@@ -911,9 +909,9 @@ static struct iommu_gather_ops dummy_tlb_ops __initdata = {
449 +@@ -905,15 +903,15 @@ static void dummy_tlb_sync(void *cookie)
450 + WARN_ON(cookie != cfg_cookie);
451 + }
452 +
453 +-static struct iommu_gather_ops dummy_tlb_ops __initdata = {
454 ++static struct iommu_gather_ops dummy_tlb_ops __initconst = {
455 + .tlb_flush_all = dummy_tlb_flush_all,
456 + .tlb_add_flush = dummy_tlb_add_flush,
457 .tlb_sync = dummy_tlb_sync,
458 };
459
460 @@ -53132,6 +53255,32 @@ index 67c2187..fc71e33 100644
461 hc->timeout_tl.data = (ulong)hc;
462 init_timer(&hc->timeout_tl);
463 hc->timeout_on = 0; /* state that we have timer off */
464 +diff --git a/drivers/leds/leds-clevo-mail.c b/drivers/leds/leds-clevo-mail.c
465 +index 0f9ed1e..2715d6f 100644
466 +--- a/drivers/leds/leds-clevo-mail.c
467 ++++ b/drivers/leds/leds-clevo-mail.c
468 +@@ -40,7 +40,7 @@ static int __init clevo_mail_led_dmi_callback(const struct dmi_system_id *id)
469 + * detected as working, but in reality it is not) as low as
470 + * possible.
471 + */
472 +-static struct dmi_system_id clevo_mail_led_dmi_table[] __initdata = {
473 ++static struct dmi_system_id clevo_mail_led_dmi_table[] __initconst = {
474 + {
475 + .callback = clevo_mail_led_dmi_callback,
476 + .ident = "Clevo D410J",
477 +diff --git a/drivers/leds/leds-ss4200.c b/drivers/leds/leds-ss4200.c
478 +index 046cb70..6b20d39 100644
479 +--- a/drivers/leds/leds-ss4200.c
480 ++++ b/drivers/leds/leds-ss4200.c
481 +@@ -91,7 +91,7 @@ MODULE_PARM_DESC(nodetect, "Skip DMI-based hardware detection");
482 + * detected as working, but in reality it is not) as low as
483 + * possible.
484 + */
485 +-static struct dmi_system_id nas_led_whitelist[] __initdata = {
486 ++static struct dmi_system_id nas_led_whitelist[] __initconst = {
487 + {
488 + .callback = ss4200_led_dmi_callback,
489 + .ident = "Intel SS4200-E",
490 diff --git a/drivers/lguest/core.c b/drivers/lguest/core.c
491 index 9e385b3..7077882 100644
492 --- a/drivers/lguest/core.c
493 @@ -68239,6 +68388,19 @@ index 523b6b7..eb4c74d 100644
494
495 /* Disable irqs of this PIO controller */
496 writel_relaxed(~0, at91_gpio->regbase + PIO_IDR);
497 +diff --git a/drivers/platform/chrome/chromeos_laptop.c b/drivers/platform/chrome/chromeos_laptop.c
498 +index 2b441e9..855d867 100644
499 +--- a/drivers/platform/chrome/chromeos_laptop.c
500 ++++ b/drivers/platform/chrome/chromeos_laptop.c
501 +@@ -498,7 +498,7 @@ static struct chromeos_laptop cr48 = {
502 + .callback = chromeos_laptop_dmi_matched, \
503 + .driver_data = (void *)&board_
504 +
505 +-static struct dmi_system_id chromeos_laptop_dmi_table[] __initdata = {
506 ++static struct dmi_system_id chromeos_laptop_dmi_table[] __initconst = {
507 + {
508 + .ident = "Samsung Series 5 550",
509 + .matches = {
510 diff --git a/drivers/platform/chrome/chromeos_pstore.c b/drivers/platform/chrome/chromeos_pstore.c
511 index 3474920..acc9581 100644
512 --- a/drivers/platform/chrome/chromeos_pstore.c
513 @@ -68252,6 +68414,19 @@ index 3474920..acc9581 100644
514 {
515 /*
516 * Today all Chromebooks/boxes ship with Google_* as version and
517 +diff --git a/drivers/platform/chrome/cros_ec_lpc.c b/drivers/platform/chrome/cros_ec_lpc.c
518 +index f9a2454..03f513c 100644
519 +--- a/drivers/platform/chrome/cros_ec_lpc.c
520 ++++ b/drivers/platform/chrome/cros_ec_lpc.c
521 +@@ -300,7 +300,7 @@ static int cros_ec_lpc_remove(struct platform_device *pdev)
522 + return 0;
523 + }
524 +
525 +-static struct dmi_system_id cros_ec_lpc_dmi_table[] __initdata = {
526 ++static struct dmi_system_id cros_ec_lpc_dmi_table[] __initconst = {
527 + {
528 + /*
529 + * Today all Chromebooks/boxes ship with Google_* as version and
530 diff --git a/drivers/platform/x86/alienware-wmi.c b/drivers/platform/x86/alienware-wmi.c
531 index 1e1e594..8fe59c5 100644
532 --- a/drivers/platform/x86/alienware-wmi.c
533 @@ -112988,7 +113163,7 @@ index b6c00ce..ab37ad1 100644
534 static struct pid *
535 get_children_pid(struct inode *inode, struct pid *pid_prev, loff_t pos)
536 diff --git a/fs/proc/base.c b/fs/proc/base.c
537 -index 45f2162..6484c0f 100644
538 +index 45f2162..284806a 100644
539 --- a/fs/proc/base.c
540 +++ b/fs/proc/base.c
541 @@ -113,6 +113,14 @@ struct pid_entry {
542 @@ -113149,18 +113324,40 @@ index 45f2162..6484c0f 100644
543 /*
544 * Let's make getdents(), stat(), and open()
545 * consistent with each other. If a process
546 -@@ -811,6 +871,10 @@ struct mm_struct *proc_mem_open(struct inode *inode, unsigned int mode)
547 +@@ -804,13 +864,24 @@ static const struct file_operations proc_single_file_operations = {
548 + };
549
550 +
551 +-struct mm_struct *proc_mem_open(struct inode *inode, unsigned int mode)
552 ++struct mm_struct *proc_mem_open(struct inode *inode, unsigned int mode, u64 *ptracer_exec_id)
553 + {
554 + struct task_struct *task = get_proc_task(inode);
555 + struct mm_struct *mm = ERR_PTR(-ESRCH);
556 +
557 ++ if (ptracer_exec_id)
558 ++ *ptracer_exec_id = 0;
559 ++
560 if (task) {
561 mm = mm_access(task, mode | PTRACE_MODE_FSCREDS);
562 + if (!IS_ERR_OR_NULL(mm) && gr_acl_handle_procpidmem(task)) {
563 + mmput(mm);
564 + mm = ERR_PTR(-EPERM);
565 + }
566 ++#ifdef CONFIG_GRKERNSEC
567 ++ if (ptracer_exec_id)
568 ++ current_is_ptracer(task, ptracer_exec_id);
569 ++#endif
570 put_task_struct(task);
571
572 if (!IS_ERR_OR_NULL(mm)) {
573 -@@ -832,6 +896,11 @@ static int __mem_open(struct inode *inode, struct file *file, unsigned int mode)
574 +@@ -826,12 +897,17 @@ struct mm_struct *proc_mem_open(struct inode *inode, unsigned int mode)
575 +
576 + static int __mem_open(struct inode *inode, struct file *file, unsigned int mode)
577 + {
578 +- struct mm_struct *mm = proc_mem_open(inode, mode);
579 ++ struct mm_struct *mm = proc_mem_open(inode, mode, NULL);
580 +
581 + if (IS_ERR(mm))
582 return PTR_ERR(mm);
583
584 file->private_data = mm;
585 @@ -113172,25 +113369,34 @@ index 45f2162..6484c0f 100644
586 return 0;
587 }
588
589 -@@ -853,6 +922,17 @@ static ssize_t mem_rw(struct file *file, char __user *buf,
590 +@@ -853,6 +929,26 @@ static ssize_t mem_rw(struct file *file, char __user *buf,
591 ssize_t copied;
592 char *page;
593
594 +#ifdef CONFIG_GRKERNSEC
595 -+ if (write)
596 ++ struct task_struct *task = get_proc_task(file_inode(file));
597 ++ bool is_by_ptracer = false;
598 ++
599 ++ if (task) {
600 ++ is_by_ptracer = current_is_ptracer(task, NULL);
601 ++ put_task_struct(task);
602 ++ }
603 ++
604 ++ if (write && !is_by_ptracer)
605 + return -EPERM;
606 -+#endif
607 ++
608 +#ifdef CONFIG_GRKERNSEC_PROC_MEMMAP
609 -+ if (file->f_version != current->exec_id) {
610 ++ if (file->f_version != current->exec_id && !is_by_ptracer) {
611 + gr_log_badprocpid("mem");
612 + return 0;
613 + }
614 +#endif
615 ++#endif
616 +
617 if (!mm)
618 return 0;
619
620 -@@ -865,7 +945,7 @@ static ssize_t mem_rw(struct file *file, char __user *buf,
621 +@@ -865,7 +961,7 @@ static ssize_t mem_rw(struct file *file, char __user *buf,
622 goto free;
623
624 while (count > 0) {
625 @@ -113199,7 +113405,7 @@ index 45f2162..6484c0f 100644
626
627 if (write && copy_from_user(page, buf, this_len)) {
628 copied = -EFAULT;
629 -@@ -959,6 +1039,13 @@ static ssize_t environ_read(struct file *file, char __user *buf,
630 +@@ -959,6 +1055,13 @@ static ssize_t environ_read(struct file *file, char __user *buf,
631 if (!mm || !mm->env_end)
632 return 0;
633
634 @@ -113213,7 +113419,7 @@ index 45f2162..6484c0f 100644
635 page = (char *)__get_free_page(GFP_TEMPORARY);
636 if (!page)
637 return -ENOMEM;
638 -@@ -972,9 +1059,12 @@ static ssize_t environ_read(struct file *file, char __user *buf,
639 +@@ -972,9 +1075,12 @@ static ssize_t environ_read(struct file *file, char __user *buf,
640 env_end = mm->env_end;
641 up_read(&mm->mmap_sem);
642
643 @@ -113227,7 +113433,7 @@ index 45f2162..6484c0f 100644
644
645 if (src >= (env_end - env_start))
646 break;
647 -@@ -1584,7 +1674,7 @@ static const char *proc_pid_get_link(struct dentry *dentry,
648 +@@ -1584,7 +1690,7 @@ static const char *proc_pid_get_link(struct dentry *dentry,
649 return ERR_PTR(-ECHILD);
650
651 /* Are we allowed to snoop on the tasks file descriptors? */
652 @@ -113236,7 +113442,7 @@ index 45f2162..6484c0f 100644
653 goto out;
654
655 error = PROC_I(inode)->op.proc_get_link(dentry, &path);
656 -@@ -1628,8 +1718,18 @@ static int proc_pid_readlink(struct dentry * dentry, char __user * buffer, int b
657 +@@ -1628,8 +1734,18 @@ static int proc_pid_readlink(struct dentry * dentry, char __user * buffer, int b
658 struct path path;
659
660 /* Are we allowed to snoop on the tasks file descriptors? */
661 @@ -113257,7 +113463,7 @@ index 45f2162..6484c0f 100644
662
663 error = PROC_I(inode)->op.proc_get_link(dentry, &path);
664 if (error)
665 -@@ -1679,7 +1779,11 @@ struct inode *proc_pid_make_inode(struct super_block * sb, struct task_struct *t
666 +@@ -1679,7 +1795,11 @@ struct inode *proc_pid_make_inode(struct super_block * sb, struct task_struct *t
667 rcu_read_lock();
668 cred = __task_cred(task);
669 inode->i_uid = cred->euid;
670 @@ -113269,7 +113475,7 @@ index 45f2162..6484c0f 100644
671 rcu_read_unlock();
672 }
673 security_task_to_inode(task, inode);
674 -@@ -1715,10 +1819,19 @@ int pid_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
675 +@@ -1715,10 +1835,19 @@ int pid_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
676 return -ENOENT;
677 }
678 if ((inode->i_mode == (S_IFDIR|S_IRUGO|S_IXUGO)) ||
679 @@ -113289,7 +113495,7 @@ index 45f2162..6484c0f 100644
680 }
681 }
682 rcu_read_unlock();
683 -@@ -1756,11 +1869,20 @@ int pid_revalidate(struct dentry *dentry, unsigned int flags)
684 +@@ -1756,11 +1885,20 @@ int pid_revalidate(struct dentry *dentry, unsigned int flags)
685
686 if (task) {
687 if ((inode->i_mode == (S_IFDIR|S_IRUGO|S_IXUGO)) ||
688 @@ -113310,7 +113516,7 @@ index 45f2162..6484c0f 100644
689 rcu_read_unlock();
690 } else {
691 inode->i_uid = GLOBAL_ROOT_UID;
692 -@@ -2301,6 +2423,9 @@ static struct dentry *proc_pident_lookup(struct inode *dir,
693 +@@ -2301,6 +2439,9 @@ static struct dentry *proc_pident_lookup(struct inode *dir,
694 if (!task)
695 goto out_no_task;
696
697 @@ -113320,7 +113526,7 @@ index 45f2162..6484c0f 100644
698 /*
699 * Yes, it does not scale. And it should not. Don't add
700 * new entries into /proc/<tgid>/ without very good reasons.
701 -@@ -2331,6 +2456,9 @@ static int proc_pident_readdir(struct file *file, struct dir_context *ctx,
702 +@@ -2331,6 +2472,9 @@ static int proc_pident_readdir(struct file *file, struct dir_context *ctx,
703 if (!task)
704 return -ENOENT;
705
706 @@ -113330,7 +113536,7 @@ index 45f2162..6484c0f 100644
707 if (!dir_emit_dots(file, ctx))
708 goto out;
709
710 -@@ -2743,7 +2871,9 @@ static const struct inode_operations proc_task_inode_operations;
711 +@@ -2743,7 +2887,9 @@ static const struct inode_operations proc_task_inode_operations;
712 static const struct pid_entry tgid_base_stuff[] = {
713 DIR("task", S_IRUGO|S_IXUGO, proc_task_inode_operations, proc_task_operations),
714 DIR("fd", S_IRUSR|S_IXUSR, proc_fd_inode_operations, proc_fd_operations),
715 @@ -113340,7 +113546,7 @@ index 45f2162..6484c0f 100644
716 DIR("fdinfo", S_IRUSR|S_IXUSR, proc_fdinfo_inode_operations, proc_fdinfo_operations),
717 DIR("ns", S_IRUSR|S_IXUGO, proc_ns_dir_inode_operations, proc_ns_dir_operations),
718 #ifdef CONFIG_NET
719 -@@ -2761,7 +2891,7 @@ static const struct pid_entry tgid_base_stuff[] = {
720 +@@ -2761,7 +2907,7 @@ static const struct pid_entry tgid_base_stuff[] = {
721 REG("autogroup", S_IRUGO|S_IWUSR, proc_pid_sched_autogroup_operations),
722 #endif
723 REG("comm", S_IRUGO|S_IWUSR, proc_pid_set_comm_operations),
724 @@ -113349,7 +113555,7 @@ index 45f2162..6484c0f 100644
725 ONE("syscall", S_IRUSR, proc_pid_syscall),
726 #endif
727 REG("cmdline", S_IRUGO, proc_pid_cmdline_ops),
728 -@@ -2786,10 +2916,10 @@ static const struct pid_entry tgid_base_stuff[] = {
729 +@@ -2786,10 +2932,10 @@ static const struct pid_entry tgid_base_stuff[] = {
730 #ifdef CONFIG_SECURITY
731 DIR("attr", S_IRUGO|S_IXUGO, proc_attr_dir_inode_operations, proc_attr_dir_operations),
732 #endif
733 @@ -113362,7 +113568,7 @@ index 45f2162..6484c0f 100644
734 ONE("stack", S_IRUSR, proc_pid_stack),
735 #endif
736 #ifdef CONFIG_SCHED_INFO
737 -@@ -2823,6 +2953,9 @@ static const struct pid_entry tgid_base_stuff[] = {
738 +@@ -2823,6 +2969,9 @@ static const struct pid_entry tgid_base_stuff[] = {
739 #ifdef CONFIG_HARDWALL
740 ONE("hardwall", S_IRUGO, proc_pid_hardwall),
741 #endif
742 @@ -113372,7 +113578,7 @@ index 45f2162..6484c0f 100644
743 #ifdef CONFIG_USER_NS
744 REG("uid_map", S_IRUGO|S_IWUSR, proc_uid_map_operations),
745 REG("gid_map", S_IRUGO|S_IWUSR, proc_gid_map_operations),
746 -@@ -2955,7 +3088,14 @@ static int proc_pid_instantiate(struct inode *dir,
747 +@@ -2955,7 +3104,14 @@ static int proc_pid_instantiate(struct inode *dir,
748 if (!inode)
749 goto out;
750
751 @@ -113387,7 +113593,7 @@ index 45f2162..6484c0f 100644
752 inode->i_op = &proc_tgid_base_inode_operations;
753 inode->i_fop = &proc_tgid_base_operations;
754 inode->i_flags|=S_IMMUTABLE;
755 -@@ -2993,7 +3133,11 @@ struct dentry *proc_pid_lookup(struct inode *dir, struct dentry * dentry, unsign
756 +@@ -2993,7 +3149,11 @@ struct dentry *proc_pid_lookup(struct inode *dir, struct dentry * dentry, unsign
757 if (!task)
758 goto out;
759
760 @@ -113399,7 +113605,7 @@ index 45f2162..6484c0f 100644
761 put_task_struct(task);
762 out:
763 return ERR_PTR(result);
764 -@@ -3107,7 +3251,7 @@ static const struct pid_entry tid_base_stuff[] = {
765 +@@ -3107,7 +3267,7 @@ static const struct pid_entry tid_base_stuff[] = {
766 REG("sched", S_IRUGO|S_IWUSR, proc_pid_sched_operations),
767 #endif
768 REG("comm", S_IRUGO|S_IWUSR, proc_pid_set_comm_operations),
769 @@ -113408,7 +113614,7 @@ index 45f2162..6484c0f 100644
770 ONE("syscall", S_IRUSR, proc_pid_syscall),
771 #endif
772 REG("cmdline", S_IRUGO, proc_pid_cmdline_ops),
773 -@@ -3134,10 +3278,10 @@ static const struct pid_entry tid_base_stuff[] = {
774 +@@ -3134,10 +3294,10 @@ static const struct pid_entry tid_base_stuff[] = {
775 #ifdef CONFIG_SECURITY
776 DIR("attr", S_IRUGO|S_IXUGO, proc_attr_dir_inode_operations, proc_attr_dir_operations),
777 #endif
778 @@ -113653,7 +113859,7 @@ index 42305dd..968caba 100644
779 if (de->size)
780 inode->i_size = de->size;
781 diff --git a/fs/proc/internal.h b/fs/proc/internal.h
782 -index aa27810..9f2d3b2 100644
783 +index aa27810..6f98bdd 100644
784 --- a/fs/proc/internal.h
785 +++ b/fs/proc/internal.h
786 @@ -47,9 +47,10 @@ struct proc_dir_entry {
787 @@ -113700,6 +113906,21 @@ index aa27810..9f2d3b2 100644
788 extern int proc_readdir_de(struct proc_dir_entry *, struct file *, struct dir_context *);
789
790 static inline struct proc_dir_entry *pde_get(struct proc_dir_entry *pde)
791 +@@ -285,9 +292,12 @@ struct proc_maps_private {
792 + #ifdef CONFIG_NUMA
793 + struct mempolicy *task_mempolicy;
794 + #endif
795 +-};
796 ++#ifdef CONFIG_GRKERNSEC
797 ++ u64 ptracer_exec_id;
798 ++#endif
799 ++} __randomize_layout;
800 +
801 +-struct mm_struct *proc_mem_open(struct inode *inode, unsigned int mode);
802 ++struct mm_struct *proc_mem_open(struct inode *inode, unsigned int mode, u64 *ptracer_exec_id);
803 +
804 + extern const struct file_operations proc_pid_maps_operations;
805 + extern const struct file_operations proc_tid_maps_operations;
806 diff --git a/fs/proc/interrupts.c b/fs/proc/interrupts.c
807 index a352d57..cb94a5c 100644
808 --- a/fs/proc/interrupts.c
809 @@ -114256,7 +114477,7 @@ index 510413eb..34d9a8c 100644
810 seq_printf(p, "softirq %llu", (unsigned long long)sum_softirq);
811
812 diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
813 -index 9d2f3e0..52c3ee0 100644
814 +index 9d2f3e0..0cb1d3f 100644
815 --- a/fs/proc/task_mmu.c
816 +++ b/fs/proc/task_mmu.c
817 @@ -15,12 +15,19 @@
818 @@ -114316,7 +114537,20 @@ index 9d2f3e0..52c3ee0 100644
819 hugetlb_report_usage(m, mm);
820 }
821
822 -@@ -281,7 +305,7 @@ static int is_stack(struct proc_maps_private *priv,
823 +@@ -230,7 +254,11 @@ static int proc_maps_open(struct inode *inode, struct file *file,
824 + return -ENOMEM;
825 +
826 + priv->inode = inode;
827 +- priv->mm = proc_mem_open(inode, PTRACE_MODE_READ);
828 ++#ifdef CONFIG_GRKERNSEC
829 ++ priv->mm = proc_mem_open(inode, PTRACE_MODE_READ, &priv->ptracer_exec_id);
830 ++#else
831 ++ priv->mm = proc_mem_open(inode, PTRACE_MODE_READ, NULL);
832 ++#endif
833 + if (IS_ERR(priv->mm)) {
834 + int err = PTR_ERR(priv->mm);
835 +
836 +@@ -281,11 +309,11 @@ static int is_stack(struct proc_maps_private *priv,
837 stack = vma_is_stack_for_task(vma, task);
838 rcu_read_unlock();
839 }
840 @@ -114325,38 +114559,37 @@ index 9d2f3e0..52c3ee0 100644
841 }
842
843 static void
844 -@@ -304,13 +328,13 @@ show_map_vma(struct seq_file *m, struct vm_area_struct *vma, int is_pid)
845 +-show_map_vma(struct seq_file *m, struct vm_area_struct *vma, int is_pid)
846 ++show_map_vma(struct seq_file *m, struct vm_area_struct *vma, int is_pid, bool restrict)
847 + {
848 + struct mm_struct *mm = vma->vm_mm;
849 + struct file *file = vma->vm_file;
850 +@@ -304,13 +332,8 @@ show_map_vma(struct seq_file *m, struct vm_area_struct *vma, int is_pid)
851 pgoff = ((loff_t)vma->vm_pgoff) << PAGE_SHIFT;
852 }
853
854 - /* We don't show the stack guard page in /proc/maps */
855 -+#ifdef CONFIG_GRKERNSEC_PROC_MEMMAP
856 -+ start = PAX_RAND_FLAGS(mm) ? 0UL : vma->vm_start;
857 -+ end = PAX_RAND_FLAGS(mm) ? 0UL : vma->vm_end;
858 -+#else
859 - start = vma->vm_start;
860 +- start = vma->vm_start;
861 - if (stack_guard_page_start(vma, start))
862 - start += PAGE_SIZE;
863 - end = vma->vm_end;
864 +- end = vma->vm_end;
865 - if (stack_guard_page_end(vma, end))
866 - end -= PAGE_SIZE;
867 -+#endif
868 ++ start = restrict ? 0UL : vma->vm_start;
869 ++ end = restrict ? 0UL : vma->vm_end;
870
871 seq_setwidth(m, 25 + sizeof(void *) * 6 - 1);
872 seq_printf(m, "%08lx-%08lx %c%c%c%c %08llx %02x:%02x %lu ",
873 -@@ -320,7 +344,11 @@ show_map_vma(struct seq_file *m, struct vm_area_struct *vma, int is_pid)
874 +@@ -320,7 +343,7 @@ show_map_vma(struct seq_file *m, struct vm_area_struct *vma, int is_pid)
875 flags & VM_WRITE ? 'w' : '-',
876 flags & VM_EXEC ? 'x' : '-',
877 flags & VM_MAYSHARE ? 's' : 'p',
878 -+#ifdef CONFIG_GRKERNSEC_PROC_MEMMAP
879 -+ PAX_RAND_FLAGS(mm) ? 0UL : pgoff,
880 -+#else
881 - pgoff,
882 -+#endif
883 +- pgoff,
884 ++ restrict ? 0UL : pgoff,
885 MAJOR(dev), MINOR(dev), ino);
886
887 /*
888 -@@ -329,7 +357,7 @@ show_map_vma(struct seq_file *m, struct vm_area_struct *vma, int is_pid)
889 +@@ -329,7 +352,7 @@ show_map_vma(struct seq_file *m, struct vm_area_struct *vma, int is_pid)
890 */
891 if (file) {
892 seq_pad(m, ' ');
893 @@ -114365,20 +114598,29 @@ index 9d2f3e0..52c3ee0 100644
894 goto done;
895 }
896
897 -@@ -366,6 +394,12 @@ done:
898 +@@ -366,7 +389,20 @@ done:
899
900 static int show_map(struct seq_file *m, void *v, int is_pid)
901 {
902 +- show_map_vma(m, v, is_pid);
903 ++ bool restrict = false;
904 ++
905 +#ifdef CONFIG_GRKERNSEC_PROC_MEMMAP
906 -+ if (current->exec_id != m->exec_id) {
907 ++ struct vm_area_struct *vma = (struct vm_area_struct *)v;
908 ++ struct proc_maps_private *priv = m->private;
909 ++ restrict = current->exec_id != priv->ptracer_exec_id;
910 ++ if (current->exec_id != m->exec_id && restrict) {
911 + gr_log_badprocpid("maps");
912 + return 0;
913 + }
914 ++ if (restrict)
915 ++ restrict = PAX_RAND_FLAGS(vma->vm_mm);
916 +#endif
917 - show_map_vma(m, v, is_pid);
918 ++ show_map_vma(m, v, is_pid, restrict);
919 m_cache_vma(m, v);
920 return 0;
921 -@@ -646,6 +680,9 @@ static void show_smap_vma_flags(struct seq_file *m, struct vm_area_struct *vma)
922 + }
923 +@@ -646,6 +682,9 @@ static void show_smap_vma_flags(struct seq_file *m, struct vm_area_struct *vma)
924 [ilog2(VM_RAND_READ)] = "rr",
925 [ilog2(VM_DONTCOPY)] = "dc",
926 [ilog2(VM_DONTEXPAND)] = "de",
927 @@ -114388,9 +114630,11 @@ index 9d2f3e0..52c3ee0 100644
928 [ilog2(VM_ACCOUNT)] = "ac",
929 [ilog2(VM_NORESERVE)] = "nr",
930 [ilog2(VM_HUGETLB)] = "ht",
931 -@@ -715,6 +752,12 @@ static int show_smap(struct seq_file *m, void *v, int is_pid)
932 +@@ -714,7 +753,14 @@ static int show_smap(struct seq_file *m, void *v, int is_pid)
933 + .mm = vma->vm_mm,
934 .private = &mss,
935 };
936 ++ bool restrict = false;
937
938 +#ifdef CONFIG_GRKERNSEC_PROC_MEMMAP
939 + if (current->exec_id != m->exec_id) {
940 @@ -114401,33 +114645,44 @@ index 9d2f3e0..52c3ee0 100644
941 memset(&mss, 0, sizeof mss);
942
943 #ifdef CONFIG_SHMEM
944 -@@ -741,8 +784,11 @@ static int show_smap(struct seq_file *m, void *v, int is_pid)
945 +@@ -741,10 +787,15 @@ static int show_smap(struct seq_file *m, void *v, int is_pid)
946 }
947 #endif
948
949 - /* mmap_sem is held in m_start */
950 - walk_page_vma(vma, &smaps_walk);
951 +#ifdef CONFIG_GRKERNSEC_PROC_MEMMAP
952 -+ if (!PAX_RAND_FLAGS(vma->vm_mm))
953 ++ if (PAX_RAND_FLAGS(vma->vm_mm))
954 ++ restrict = true;
955 ++ else
956 +#endif
957 + /* mmap_sem is held in m_start */
958 + walk_page_vma(vma, &smaps_walk);
959
960 - show_map_vma(m, vma, is_pid);
961 +- show_map_vma(m, vma, is_pid);
962 ++ show_map_vma(m, vma, is_pid, restrict);
963
964 -@@ -764,7 +810,11 @@ static int show_smap(struct seq_file *m, void *v, int is_pid)
965 + seq_printf(m,
966 + "Size: %8lu kB\n"
967 +@@ -764,7 +815,7 @@ static int show_smap(struct seq_file *m, void *v, int is_pid)
968 "KernelPageSize: %8lu kB\n"
969 "MMUPageSize: %8lu kB\n"
970 "Locked: %8lu kB\n",
971 -+#ifdef CONFIG_GRKERNSEC_PROC_MEMMAP
972 -+ PAX_RAND_FLAGS(vma->vm_mm) ? 0UL : (vma->vm_end - vma->vm_start) >> 10,
973 -+#else
974 - (vma->vm_end - vma->vm_start) >> 10,
975 -+#endif
976 +- (vma->vm_end - vma->vm_start) >> 10,
977 ++ restrict ? 0UL : (vma->vm_end - vma->vm_start) >> 10,
978 mss.resident >> 10,
979 (unsigned long)(mss.pss >> (10 + PSS_SHIFT)),
980 mss.shared_clean >> 10,
981 -@@ -1615,6 +1665,13 @@ static int show_numa_map(struct seq_file *m, void *v, int is_pid)
982 +@@ -1412,7 +1463,7 @@ static int pagemap_open(struct inode *inode, struct file *file)
983 + {
984 + struct mm_struct *mm;
985 +
986 +- mm = proc_mem_open(inode, PTRACE_MODE_READ);
987 ++ mm = proc_mem_open(inode, PTRACE_MODE_READ, NULL);
988 + if (IS_ERR(mm))
989 + return PTR_ERR(mm);
990 + file->private_data = mm;
991 +@@ -1615,6 +1666,13 @@ static int show_numa_map(struct seq_file *m, void *v, int is_pid)
992 char buffer[64];
993 int nid;
994
995 @@ -114441,7 +114696,7 @@ index 9d2f3e0..52c3ee0 100644
996 if (!mm)
997 return 0;
998
999 -@@ -1629,11 +1686,15 @@ static int show_numa_map(struct seq_file *m, void *v, int is_pid)
1000 +@@ -1629,11 +1687,15 @@ static int show_numa_map(struct seq_file *m, void *v, int is_pid)
1001 mpol_to_str(buffer, sizeof(buffer), proc_priv->task_mempolicy);
1002 }
1003
1004 @@ -114459,7 +114714,7 @@ index 9d2f3e0..52c3ee0 100644
1005 seq_puts(m, " heap");
1006 } else if (is_stack(proc_priv, vma, is_pid)) {
1007 diff --git a/fs/proc/task_nommu.c b/fs/proc/task_nommu.c
1008 -index faacb0c..ce736cd 100644
1009 +index faacb0c..b185575 100644
1010 --- a/fs/proc/task_nommu.c
1011 +++ b/fs/proc/task_nommu.c
1012 @@ -51,7 +51,7 @@ void task_mem(struct seq_file *m, struct mm_struct *mm)
1013 @@ -114489,6 +114744,15 @@ index faacb0c..ce736cd 100644
1014 } else if (mm && is_stack(priv, vma, is_pid)) {
1015 seq_pad(m, ' ');
1016 seq_printf(m, "[stack]");
1017 +@@ -287,7 +287,7 @@ static int maps_open(struct inode *inode, struct file *file,
1018 + return -ENOMEM;
1019 +
1020 + priv->inode = inode;
1021 +- priv->mm = proc_mem_open(inode, PTRACE_MODE_READ);
1022 ++ priv->mm = proc_mem_open(inode, PTRACE_MODE_READ, NULL);
1023 + if (IS_ERR(priv->mm)) {
1024 + int err = PTR_ERR(priv->mm);
1025 +
1026 diff --git a/fs/proc/vmcore.c b/fs/proc/vmcore.c
1027 index 4e61388..1a2523d 100644
1028 --- a/fs/proc/vmcore.c
1029 @@ -131914,6 +132178,19 @@ index 792c898..3f045d6 100644
1030 atomic_t numainfo_updating;
1031 #endif
1032
1033 +diff --git a/include/linux/memory.h b/include/linux/memory.h
1034 +index 8b8d8d1..75abd50 100644
1035 +--- a/include/linux/memory.h
1036 ++++ b/include/linux/memory.h
1037 +@@ -123,7 +123,7 @@ extern struct memory_block *find_memory_block(struct mem_section *);
1038 +
1039 + #ifdef CONFIG_MEMORY_HOTPLUG
1040 + #define hotplug_memory_notifier(fn, pri) ({ \
1041 +- static __meminitdata struct notifier_block fn##_mem_nb =\
1042 ++ static __meminitconst struct notifier_block fn##_mem_nb =\
1043 + { .notifier_call = fn, .priority = pri };\
1044 + register_memory_notifier(&fn##_mem_nb); \
1045 + })
1046 diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h
1047 index 2696c1f..9320d41 100644
1048 --- a/include/linux/mempolicy.h
1049 @@ -133552,7 +133829,7 @@ index 556ec1e..38c19c9 100644
1050
1051 /*
1052 diff --git a/include/linux/sched.h b/include/linux/sched.h
1053 -index a10494a..2d7faf1 100644
1054 +index a10494a..3ab8d31 100644
1055 --- a/include/linux/sched.h
1056 +++ b/include/linux/sched.h
1057 @@ -7,7 +7,7 @@
1058 @@ -133825,7 +134102,7 @@ index a10494a..2d7faf1 100644
1059 {
1060 return tsk->pid;
1061 }
1062 -@@ -2289,6 +2397,25 @@ extern u64 sched_clock_cpu(int cpu);
1063 +@@ -2289,6 +2397,46 @@ extern u64 sched_clock_cpu(int cpu);
1064
1065 extern void sched_clock_init(void);
1066
1067 @@ -133848,10 +134125,31 @@ index a10494a..2d7faf1 100644
1068 +}
1069 +#endif
1070 +
1071 ++#ifdef CONFIG_GRKERNSEC
1072 ++static inline bool current_is_ptracer(struct task_struct *task, u64 *exec_id)
1073 ++{
1074 ++ bool ret = false;
1075 ++ if (!task->ptrace)
1076 ++ return ret;
1077 ++
1078 ++ rcu_read_lock();
1079 ++ read_lock(&tasklist_lock);
1080 ++ if (task->parent && task->parent == current) {
1081 ++ ret = true;
1082 ++ if (exec_id)
1083 ++ *exec_id = task->parent->exec_id;
1084 ++ }
1085 ++ read_unlock(&tasklist_lock);
1086 ++ rcu_read_unlock();
1087 ++
1088 ++ return ret;
1089 ++}
1090 ++#endif
1091 ++
1092 #ifndef CONFIG_HAVE_UNSTABLE_SCHED_CLOCK
1093 static inline void sched_clock_tick(void)
1094 {
1095 -@@ -2417,7 +2544,9 @@ extern void set_curr_task(int cpu, struct task_struct *p);
1096 +@@ -2417,7 +2565,9 @@ extern void set_curr_task(int cpu, struct task_struct *p);
1097 void yield(void);
1098
1099 union thread_union {
1100 @@ -133861,7 +134159,7 @@ index a10494a..2d7faf1 100644
1101 unsigned long stack[THREAD_SIZE/sizeof(long)];
1102 };
1103
1104 -@@ -2450,6 +2579,7 @@ extern struct pid_namespace init_pid_ns;
1105 +@@ -2450,6 +2600,7 @@ extern struct pid_namespace init_pid_ns;
1106 */
1107
1108 extern struct task_struct *find_task_by_vpid(pid_t nr);
1109 @@ -133869,7 +134167,7 @@ index a10494a..2d7faf1 100644
1110 extern struct task_struct *find_task_by_pid_ns(pid_t nr,
1111 struct pid_namespace *ns);
1112
1113 -@@ -2481,7 +2611,7 @@ extern void proc_caches_init(void);
1114 +@@ -2481,7 +2632,7 @@ extern void proc_caches_init(void);
1115 extern void flush_signals(struct task_struct *);
1116 extern void ignore_signals(struct task_struct *);
1117 extern void flush_signal_handlers(struct task_struct *, int force_default);
1118 @@ -133878,7 +134176,7 @@ index a10494a..2d7faf1 100644
1119
1120 static inline int kernel_dequeue_signal(siginfo_t *info)
1121 {
1122 -@@ -2635,7 +2765,7 @@ extern void __cleanup_sighand(struct sighand_struct *);
1123 +@@ -2635,7 +2786,7 @@ extern void __cleanup_sighand(struct sighand_struct *);
1124 extern void exit_itimers(struct signal_struct *);
1125 extern void flush_itimer_signals(void);
1126
1127 @@ -133887,7 +134185,7 @@ index a10494a..2d7faf1 100644
1128
1129 extern int do_execve(struct filename *,
1130 const char __user * const __user *,
1131 -@@ -2750,11 +2880,13 @@ static inline int thread_group_empty(struct task_struct *p)
1132 +@@ -2750,11 +2901,13 @@ static inline int thread_group_empty(struct task_struct *p)
1133 * It must not be nested with write_lock_irq(&tasklist_lock),
1134 * neither inside nor outside.
1135 */
1136 @@ -133901,7 +134199,7 @@ index a10494a..2d7faf1 100644
1137 static inline void task_unlock(struct task_struct *p)
1138 {
1139 spin_unlock(&p->alloc_lock);
1140 -@@ -2840,9 +2972,9 @@ static inline unsigned long *end_of_stack(struct task_struct *p)
1141 +@@ -2840,9 +2993,9 @@ static inline unsigned long *end_of_stack(struct task_struct *p)
1142 #define task_stack_end_corrupted(task) \
1143 (*(end_of_stack(task)) != STACK_END_MAGIC)
1144
1145 @@ -162129,10 +162427,10 @@ index 53449a6..c1fd180 100644
1146 warning-2 += -Wdisabled-optimization
1147 diff --git a/scripts/Makefile.gcc-plugins b/scripts/Makefile.gcc-plugins
1148 new file mode 100644
1149 -index 0000000..97e7a48
1150 +index 0000000..3dfdd31
1151 --- /dev/null
1152 +++ b/scripts/Makefile.gcc-plugins
1153 -@@ -0,0 +1,96 @@
1154 +@@ -0,0 +1,98 @@
1155 +ifdef CONFIG_GCC_PLUGINS
1156 + __PLUGINCC := $(call cc-ifversion, -ge, 0408, $(HOSTCXX), $(HOSTCC))
1157 + PLUGINCC := $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-plugin.sh "$(__PLUGINCC)" "$(HOSTCXX)" "$(CC)")
1158 @@ -162180,6 +162478,8 @@ index 0000000..97e7a48
1159 +
1160 + gcc-plugin-y += initify_plugin.so
1161 + gcc-plugin-cflags-y += -DINITIFY_PLUGIN
1162 ++# -fplugin-arg-initify_plugin-search_init_exit_functions
1163 ++# gcc-plugin-cflags-y += -fplugin-arg-initify_plugin-verbose
1164 +
1165 + gcc-plugin-subdir-$(CONFIG_PAX_RAP) += rap_plugin
1166 + gcc-plugin-$(CONFIG_PAX_RAP) += rap_plugin/rap_plugin.so
1167 @@ -163326,10 +163626,10 @@ index 0000000..ffe60f6
1168 +}
1169 diff --git a/scripts/gcc-plugins/constify_plugin.c b/scripts/gcc-plugins/constify_plugin.c
1170 new file mode 100644
1171 -index 0000000..7142f36
1172 +index 0000000..e25c12c
1173 --- /dev/null
1174 +++ b/scripts/gcc-plugins/constify_plugin.c
1175 -@@ -0,0 +1,521 @@
1176 +@@ -0,0 +1,574 @@
1177 +/*
1178 + * Copyright 2011 by Emese Revfy <re.emese@×××××.com>
1179 + * Copyright 2011-2016 by PaX Team <pageexec@××××××××.hu>
1180 @@ -163355,10 +163655,25 @@ index 0000000..7142f36
1181 +static bool enabled = true;
1182 +
1183 +static struct plugin_info const_plugin_info = {
1184 -+ .version = "201605212045",
1185 ++ .version = "201606280200",
1186 + .help = "disable\tturn off constification\n",
1187 +};
1188 +
1189 ++static struct {
1190 ++ const char *name;
1191 ++ const char *asm_op;
1192 ++} const_sections[] = {
1193 ++ {".init.rodata", "\t.section\t.init.rodata,\"a\""},
1194 ++ {".ref.rodata", "\t.section\t.ref.rodata,\"a\""},
1195 ++ {".devinit.rodata", "\t.section\t.devinit.rodata,\"a\""},
1196 ++ {".devexit.rodata", "\t.section\t.devexit.rodata,\"a\""},
1197 ++ {".cpuinit.rodata", "\t.section\t.cpuinit.rodata,\"a\""},
1198 ++ {".cpuexit.rodata", "\t.section\t.cpuexit.rodata,\"a\""},
1199 ++ {".meminit.rodata", "\t.section\t.meminit.rodata,\"a\""},
1200 ++ {".memexit.rodata", "\t.section\t.memexit.rodata,\"a\""},
1201 ++ {".data..read_only", "\t.section\t.data..read_only,\"a\""},
1202 ++};
1203 ++
1204 +typedef struct {
1205 + bool has_fptr_field;
1206 + bool has_writable_field;
1207 @@ -163706,33 +164021,85 @@ index 0000000..7142f36
1208 + TYPE_CONSTIFY_VISITED(type) = 1;
1209 +}
1210 +
1211 -+static void check_global_variables(void *event_data, void *data)
1212 ++static bool is_constified_var(varpool_node_ptr node)
1213 +{
1214 -+ varpool_node_ptr node;
1215 ++ tree var = NODE_DECL(node);
1216 ++ tree type = TREE_TYPE(var);
1217 +
1218 -+ FOR_EACH_VARIABLE(node) {
1219 -+ tree var = NODE_DECL(node);
1220 -+ tree type = TREE_TYPE(var);
1221 ++ if (DECL_EXTERNAL(var))
1222 ++ return false;
1223 +
1224 -+ if (TREE_CODE(type) != RECORD_TYPE && TREE_CODE(type) != UNION_TYPE)
1225 -+ continue;
1226 ++ // XXX handle more complex nesting of arrays/structs
1227 ++ if (TREE_CODE(type) == ARRAY_TYPE)
1228 ++ type = TREE_TYPE(type);
1229 +
1230 -+ if (!TYPE_READONLY(type) || !C_TYPE_FIELDS_READONLY(type))
1231 -+ continue;
1232 ++ if (TREE_CODE(type) != RECORD_TYPE && TREE_CODE(type) != UNION_TYPE)
1233 ++ return false;
1234 +
1235 -+ if (!TYPE_CONSTIFY_VISITED(type))
1236 -+ continue;
1237 ++ if (!TYPE_READONLY(type) || !C_TYPE_FIELDS_READONLY(type))
1238 ++ return false;
1239 +
1240 -+ if (DECL_EXTERNAL(var))
1241 -+ continue;
1242 ++ if (!TYPE_CONSTIFY_VISITED(type))
1243 ++ return false;
1244 ++
1245 ++ return true;
1246 ++}
1247 ++
1248 ++static void check_section_mismatch(varpool_node_ptr node)
1249 ++{
1250 ++ tree var, section;
1251 ++ size_t i;
1252 ++
1253 ++ var = NODE_DECL(node);
1254 ++ section = lookup_attribute("section", DECL_ATTRIBUTES(var));
1255 ++ if (!section) {
1256 ++ gcc_assert(!get_decl_section_name(var));
1257 ++ return;
1258 ++ } else
1259 ++ gcc_assert(get_decl_section_name(var));
1260 ++
1261 ++//fprintf(stderr, "SECTIONAME: [%s] ", get_decl_section_name(var));
1262 ++//debug_tree(var);
1263 ++
1264 ++ gcc_assert(!TREE_CHAIN(section));
1265 ++ gcc_assert(TREE_VALUE(section));
1266 ++
1267 ++ section = TREE_VALUE(TREE_VALUE(section));
1268 ++ gcc_assert(!strcmp(TREE_STRING_POINTER(section), get_decl_section_name(var)));
1269 ++//debug_tree(section);
1270 ++
1271 ++ for (i = 0; i < ARRAY_SIZE(const_sections); i++)
1272 ++ if (!strcmp(const_sections[i].name, get_decl_section_name(var)))
1273 ++ return;
1274 ++
1275 ++ error_at(DECL_SOURCE_LOCATION(var), "constified variable %qD placed into writable section %E", var, section);
1276 ++}
1277 ++
1278 ++// this works around a gcc bug/feature where uninitialized globals
1279 ++// are moved into the .bss section regardless of any constification
1280 ++// see gcc/varasm.c:bss_initializer_p()
1281 ++static void fix_initializer(varpool_node_ptr node)
1282 ++{
1283 ++ tree var = NODE_DECL(node);
1284 ++ tree type = TREE_TYPE(var);
1285 ++
1286 ++ if (DECL_INITIAL(var))
1287 ++ return;
1288 ++
1289 ++ DECL_INITIAL(var) = build_constructor(type, NULL);
1290 ++// inform(DECL_SOURCE_LOCATION(var), "constified variable %qE moved into .rodata", var);
1291 ++}
1292 ++
1293 ++static void check_global_variables(void *event_data, void *data)
1294 ++{
1295 ++ varpool_node_ptr node;
1296 +
1297 -+ if (DECL_INITIAL(var))
1298 ++ FOR_EACH_VARIABLE(node) {
1299 ++ if (!is_constified_var(node))
1300 + continue;
1301 +
1302 -+ // this works around a gcc bug/feature where uninitialized globals
1303 -+ // are moved into the .bss section regardless of any constification
1304 -+ DECL_INITIAL(var) = build_constructor(type, NULL);
1305 -+// inform(DECL_SOURCE_LOCATION(var), "constified variable %qE moved into .rodata", var);
1306 ++ check_section_mismatch(node);
1307 ++ fix_initializer(node);
1308 + }
1309 +}
1310 +
1311 @@ -163769,30 +164136,16 @@ index 0000000..7142f36
1312 +#define NO_GATE
1313 +#include "gcc-generate-gimple-pass.h"
1314 +
1315 -+static struct {
1316 -+ const char *name;
1317 -+ const char *asm_op;
1318 -+} sections[] = {
1319 -+ {".init.rodata", "\t.section\t.init.rodata,\"a\""},
1320 -+ {".ref.rodata", "\t.section\t.ref.rodata,\"a\""},
1321 -+ {".devinit.rodata", "\t.section\t.devinit.rodata,\"a\""},
1322 -+ {".devexit.rodata", "\t.section\t.devexit.rodata,\"a\""},
1323 -+ {".cpuinit.rodata", "\t.section\t.cpuinit.rodata,\"a\""},
1324 -+ {".cpuexit.rodata", "\t.section\t.cpuexit.rodata,\"a\""},
1325 -+ {".meminit.rodata", "\t.section\t.meminit.rodata,\"a\""},
1326 -+ {".memexit.rodata", "\t.section\t.memexit.rodata,\"a\""},
1327 -+ {".data..read_only", "\t.section\t.data..read_only,\"a\""},
1328 -+};
1329 -+
1330 +static unsigned int (*old_section_type_flags)(tree decl, const char *name, int reloc);
1331 +
1332 +static unsigned int constify_section_type_flags(tree decl, const char *name, int reloc)
1333 +{
1334 + size_t i;
1335 +
1336 -+ for (i = 0; i < ARRAY_SIZE(sections); i++)
1337 -+ if (!strcmp(sections[i].name, name))
1338 ++ for (i = 0; i < ARRAY_SIZE(const_sections); i++)
1339 ++ if (!strcmp(const_sections[i].name, name))
1340 + return 0;
1341 ++
1342 + return old_section_type_flags(decl, name, reloc);
1343 +}
1344 +
1345 @@ -163800,9 +164153,9 @@ index 0000000..7142f36
1346 +{
1347 +// size_t i;
1348 +
1349 -+// for (i = 0; i < ARRAY_SIZE(sections); i++)
1350 -+// sections[i].section = get_unnamed_section(0, output_section_asm_op, sections[i].asm_op);
1351 -+// sections[i].section = get_section(sections[i].name, 0, NULL);
1352 ++// for (i = 0; i < ARRAY_SIZE(const_sections); i++)
1353 ++// const_sections[i].section = get_unnamed_section(0, output_section_asm_op, const_sections[i].asm_op);
1354 ++// const_sections[i].section = get_section(const_sections[i].name, 0, NULL);
1355 +
1356 + old_section_type_flags = targetm.section_type_flags;
1357 + targetm.section_type_flags = constify_section_type_flags;
1358 @@ -163853,10 +164206,10 @@ index 0000000..7142f36
1359 +}
1360 diff --git a/scripts/gcc-plugins/gcc-common.h b/scripts/gcc-plugins/gcc-common.h
1361 new file mode 100644
1362 -index 0000000..0c0b842
1363 +index 0000000..fd6362e7
1364 --- /dev/null
1365 +++ b/scripts/gcc-plugins/gcc-common.h
1366 -@@ -0,0 +1,879 @@
1367 +@@ -0,0 +1,892 @@
1368 +#ifndef GCC_COMMON_H_INCLUDED
1369 +#define GCC_COMMON_H_INCLUDED
1370 +
1371 @@ -164396,6 +164749,14 @@ index 0000000..0c0b842
1372 +
1373 +typedef struct rtx_def rtx_insn;
1374 +
1375 ++static inline const char *get_decl_section_name(const_tree decl)
1376 ++{
1377 ++ if (!DECL_SECTION_NAME(decl))
1378 ++ return NULL;
1379 ++
1380 ++ return TREE_STRING_POINTER(DECL_SECTION_NAME(decl));
1381 ++}
1382 ++
1383 +static inline void set_decl_section_name(tree node, const char *value)
1384 +{
1385 + if (value)
1386 @@ -164513,6 +164874,11 @@ index 0000000..0c0b842
1387 +
1388 +#define INSN_DELETED_P(insn) (insn)->deleted()
1389 +
1390 ++static inline const char *get_decl_section_name(const_tree decl)
1391 ++{
1392 ++ return DECL_SECTION_NAME(decl);
1393 ++}
1394 ++
1395 +/* symtab/cgraph related */
1396 +#define debug_cgraph_node(node) (node)->debug()
1397 +#define cgraph_get_node(decl) cgraph_node::get(decl)