1 |
commit: 3896e54a5e5781b0c950817bf3b89e8f53185893 |
2 |
Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri May 29 12:30:03 2015 +0000 |
4 |
Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri May 29 12:30:03 2015 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/hardened-patchset.git/commit/?id=3896e54a |
7 |
|
8 |
Grsec/PaX: 3.1-{3.2.69,3.14.43,4.0.4}-201505272113 |
9 |
|
10 |
3.14.43/0000_README | 2 +- |
11 |
...4420_grsecurity-3.1-3.14.43-201505272112.patch} | 47 +- |
12 |
3.2.69/0000_README | 2 +- |
13 |
... 4420_grsecurity-3.1-3.2.69-201505272108.patch} | 38 +- |
14 |
4.0.4/0000_README | 2 +- |
15 |
...> 4420_grsecurity-3.1-4.0.4-201505272113.patch} | 905 +++++++++++++++++++-- |
16 |
6 files changed, 904 insertions(+), 92 deletions(-) |
17 |
|
18 |
diff --git a/3.14.43/0000_README b/3.14.43/0000_README |
19 |
index 6494a01..09a43ed 100644 |
20 |
--- a/3.14.43/0000_README |
21 |
+++ b/3.14.43/0000_README |
22 |
@@ -2,7 +2,7 @@ README |
23 |
----------------------------------------------------------------------------- |
24 |
Individual Patch Descriptions: |
25 |
----------------------------------------------------------------------------- |
26 |
-Patch: 4420_grsecurity-3.1-3.14.43-201505222221.patch |
27 |
+Patch: 4420_grsecurity-3.1-3.14.43-201505272112.patch |
28 |
From: http://www.grsecurity.net |
29 |
Desc: hardened-sources base patch from upstream grsecurity |
30 |
|
31 |
|
32 |
diff --git a/3.14.43/4420_grsecurity-3.1-3.14.43-201505222221.patch b/3.14.43/4420_grsecurity-3.1-3.14.43-201505272112.patch |
33 |
similarity index 99% |
34 |
rename from 3.14.43/4420_grsecurity-3.1-3.14.43-201505222221.patch |
35 |
rename to 3.14.43/4420_grsecurity-3.1-3.14.43-201505272112.patch |
36 |
index c57dea0..2ecf955 100644 |
37 |
--- a/3.14.43/4420_grsecurity-3.1-3.14.43-201505222221.patch |
38 |
+++ b/3.14.43/4420_grsecurity-3.1-3.14.43-201505272112.patch |
39 |
@@ -76699,6 +76699,19 @@ index aead369..0dfecfd 100644 |
40 |
xfs_dir3_get_dtype(mp, filetype))) |
41 |
return 0; |
42 |
sfep = dp->d_ops->sf_nextentry(sfp, sfep); |
43 |
+diff --git a/fs/xfs/xfs_error.c b/fs/xfs/xfs_error.c |
44 |
+index 9995b80..981f0f4 100644 |
45 |
+--- a/fs/xfs/xfs_error.c |
46 |
++++ b/fs/xfs/xfs_error.c |
47 |
+@@ -156,7 +156,7 @@ xfs_error_report( |
48 |
+ { |
49 |
+ if (level <= xfs_error_level) { |
50 |
+ xfs_alert_tag(mp, XFS_PTAG_ERROR_REPORT, |
51 |
+- "Internal error %s at line %d of file %s. Caller 0x%p", |
52 |
++ "Internal error %s at line %d of file %s. Caller 0x%pS", |
53 |
+ tag, linenum, filename, ra); |
54 |
+ |
55 |
+ xfs_stack_trace(); |
56 |
diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c |
57 |
index 78e62cc..eec3706 100644 |
58 |
--- a/fs/xfs/xfs_ioctl.c |
59 |
@@ -120148,10 +120161,10 @@ index 0000000..0c96d8a |
60 |
+} |
61 |
diff --git a/tools/gcc/constify_plugin.c b/tools/gcc/constify_plugin.c |
62 |
new file mode 100644 |
63 |
-index 0000000..93b181d |
64 |
+index 0000000..da184c5 |
65 |
--- /dev/null |
66 |
+++ b/tools/gcc/constify_plugin.c |
67 |
-@@ -0,0 +1,563 @@ |
68 |
+@@ -0,0 +1,564 @@ |
69 |
+/* |
70 |
+ * Copyright 2011 by Emese Revfy <re.emese@×××××.com> |
71 |
+ * Copyright 2011-2015 by PaX Team <pageexec@××××××××.hu> |
72 |
@@ -120390,7 +120403,8 @@ index 0000000..93b181d |
73 |
+ return NULL_TREE; |
74 |
+ } |
75 |
+ |
76 |
-+ error("%qE attribute used on type %qT that is not constified", name, type); |
77 |
++ if (TYPE_FIELDS(type)) |
78 |
++ error("%qE attribute used on type %qT that is not constified", name, type); |
79 |
+ return NULL_TREE; |
80 |
+} |
81 |
+ |
82 |
@@ -120717,10 +120731,10 @@ index 0000000..93b181d |
83 |
+} |
84 |
diff --git a/tools/gcc/gcc-common.h b/tools/gcc/gcc-common.h |
85 |
new file mode 100644 |
86 |
-index 0000000..d8ec362 |
87 |
+index 0000000..77f8462 |
88 |
--- /dev/null |
89 |
+++ b/tools/gcc/gcc-common.h |
90 |
-@@ -0,0 +1,666 @@ |
91 |
+@@ -0,0 +1,689 @@ |
92 |
+#ifndef GCC_COMMON_H_INCLUDED |
93 |
+#define GCC_COMMON_H_INCLUDED |
94 |
+ |
95 |
@@ -120935,6 +120949,12 @@ index 0000000..d8ec362 |
96 |
+ return false; |
97 |
+ } |
98 |
+} |
99 |
++ |
100 |
++static inline void add_local_decl(struct function *fun, tree d) |
101 |
++{ |
102 |
++ gcc_assert(TREE_CODE(d) == VAR_DECL); |
103 |
++ fun->local_decls = tree_cons(NULL_TREE, d, fun->local_decls); |
104 |
++} |
105 |
+#endif |
106 |
+ |
107 |
+#if BUILDING_GCC_VERSION <= 4006 |
108 |
@@ -121012,6 +121032,11 @@ index 0000000..d8ec362 |
109 |
+#define FOR_EACH_FUNCTION_WITH_GIMPLE_BODY(node) \ |
110 |
+ for ((node) = cgraph_first_function_with_gimple_body(); (node); \ |
111 |
+ (node) = cgraph_next_function_with_gimple_body(node)) |
112 |
++ |
113 |
++static inline void varpool_add_new_variable(tree decl) |
114 |
++{ |
115 |
++ varpool_finalize_decl(decl); |
116 |
++} |
117 |
+#endif |
118 |
+ |
119 |
+#if BUILDING_GCC_VERSION == 4006 |
120 |
@@ -121128,8 +121153,10 @@ index 0000000..d8ec362 |
121 |
+#define add_referenced_var(var) |
122 |
+#define mark_sym_for_renaming(var) |
123 |
+#define varpool_mark_needed_node(node) |
124 |
++#define create_var_ann(var) |
125 |
+#define TODO_dump_func 0 |
126 |
+#define TODO_dump_cgraph 0 |
127 |
++ |
128 |
+#endif |
129 |
+ |
130 |
+#if BUILDING_GCC_VERSION <= 4009 |
131 |
@@ -121150,6 +121177,11 @@ index 0000000..d8ec362 |
132 |
+#if BUILDING_GCC_VERSION <= 4009 |
133 |
+typedef struct rtx_def rtx_insn; |
134 |
+ |
135 |
++static inline void set_decl_section_name(tree node, const char *value) |
136 |
++{ |
137 |
++ DECL_SECTION_NAME(node) = build_string(strlen(value) + 1, value); |
138 |
++} |
139 |
++ |
140 |
+static inline gasm *as_a_gasm(gimple stmt) |
141 |
+{ |
142 |
+ return stmt; |
143 |
@@ -121246,6 +121278,11 @@ index 0000000..d8ec362 |
144 |
+ varpool_node::finalize_decl(decl); |
145 |
+} |
146 |
+ |
147 |
++static inline void varpool_add_new_variable(tree decl) |
148 |
++{ |
149 |
++ varpool_node::add(decl); |
150 |
++} |
151 |
++ |
152 |
+static inline cgraph_node_ptr cgraph_function_node(cgraph_node_ptr node, enum availability *availability) |
153 |
+{ |
154 |
+ return node->function_symbol(availability); |
155 |
|
156 |
diff --git a/3.2.69/0000_README b/3.2.69/0000_README |
157 |
index 8bf4976..4b24d8f 100644 |
158 |
--- a/3.2.69/0000_README |
159 |
+++ b/3.2.69/0000_README |
160 |
@@ -194,7 +194,7 @@ Patch: 1068_linux-3.2.69.patch |
161 |
From: http://www.kernel.org |
162 |
Desc: Linux 3.2.69 |
163 |
|
164 |
-Patch: 4420_grsecurity-3.1-3.2.69-201505181926.patch |
165 |
+Patch: 4420_grsecurity-3.1-3.2.69-201505272108.patch |
166 |
From: http://www.grsecurity.net |
167 |
Desc: hardened-sources base patch from upstream grsecurity |
168 |
|
169 |
|
170 |
diff --git a/3.2.69/4420_grsecurity-3.1-3.2.69-201505181926.patch b/3.2.69/4420_grsecurity-3.1-3.2.69-201505272108.patch |
171 |
similarity index 99% |
172 |
rename from 3.2.69/4420_grsecurity-3.1-3.2.69-201505181926.patch |
173 |
rename to 3.2.69/4420_grsecurity-3.1-3.2.69-201505272108.patch |
174 |
index b43610c..58543ee 100644 |
175 |
--- a/3.2.69/4420_grsecurity-3.1-3.2.69-201505181926.patch |
176 |
+++ b/3.2.69/4420_grsecurity-3.1-3.2.69-201505272108.patch |
177 |
@@ -115626,10 +115626,10 @@ index 0000000..0c96d8a |
178 |
+} |
179 |
diff --git a/tools/gcc/constify_plugin.c b/tools/gcc/constify_plugin.c |
180 |
new file mode 100644 |
181 |
-index 0000000..93b181d |
182 |
+index 0000000..da184c5 |
183 |
--- /dev/null |
184 |
+++ b/tools/gcc/constify_plugin.c |
185 |
-@@ -0,0 +1,563 @@ |
186 |
+@@ -0,0 +1,564 @@ |
187 |
+/* |
188 |
+ * Copyright 2011 by Emese Revfy <re.emese@×××××.com> |
189 |
+ * Copyright 2011-2015 by PaX Team <pageexec@××××××××.hu> |
190 |
@@ -115868,7 +115868,8 @@ index 0000000..93b181d |
191 |
+ return NULL_TREE; |
192 |
+ } |
193 |
+ |
194 |
-+ error("%qE attribute used on type %qT that is not constified", name, type); |
195 |
++ if (TYPE_FIELDS(type)) |
196 |
++ error("%qE attribute used on type %qT that is not constified", name, type); |
197 |
+ return NULL_TREE; |
198 |
+} |
199 |
+ |
200 |
@@ -116195,10 +116196,10 @@ index 0000000..93b181d |
201 |
+} |
202 |
diff --git a/tools/gcc/gcc-common.h b/tools/gcc/gcc-common.h |
203 |
new file mode 100644 |
204 |
-index 0000000..d8ec362 |
205 |
+index 0000000..77f8462 |
206 |
--- /dev/null |
207 |
+++ b/tools/gcc/gcc-common.h |
208 |
-@@ -0,0 +1,666 @@ |
209 |
+@@ -0,0 +1,689 @@ |
210 |
+#ifndef GCC_COMMON_H_INCLUDED |
211 |
+#define GCC_COMMON_H_INCLUDED |
212 |
+ |
213 |
@@ -116413,6 +116414,12 @@ index 0000000..d8ec362 |
214 |
+ return false; |
215 |
+ } |
216 |
+} |
217 |
++ |
218 |
++static inline void add_local_decl(struct function *fun, tree d) |
219 |
++{ |
220 |
++ gcc_assert(TREE_CODE(d) == VAR_DECL); |
221 |
++ fun->local_decls = tree_cons(NULL_TREE, d, fun->local_decls); |
222 |
++} |
223 |
+#endif |
224 |
+ |
225 |
+#if BUILDING_GCC_VERSION <= 4006 |
226 |
@@ -116490,6 +116497,11 @@ index 0000000..d8ec362 |
227 |
+#define FOR_EACH_FUNCTION_WITH_GIMPLE_BODY(node) \ |
228 |
+ for ((node) = cgraph_first_function_with_gimple_body(); (node); \ |
229 |
+ (node) = cgraph_next_function_with_gimple_body(node)) |
230 |
++ |
231 |
++static inline void varpool_add_new_variable(tree decl) |
232 |
++{ |
233 |
++ varpool_finalize_decl(decl); |
234 |
++} |
235 |
+#endif |
236 |
+ |
237 |
+#if BUILDING_GCC_VERSION == 4006 |
238 |
@@ -116606,8 +116618,10 @@ index 0000000..d8ec362 |
239 |
+#define add_referenced_var(var) |
240 |
+#define mark_sym_for_renaming(var) |
241 |
+#define varpool_mark_needed_node(node) |
242 |
++#define create_var_ann(var) |
243 |
+#define TODO_dump_func 0 |
244 |
+#define TODO_dump_cgraph 0 |
245 |
++ |
246 |
+#endif |
247 |
+ |
248 |
+#if BUILDING_GCC_VERSION <= 4009 |
249 |
@@ -116628,6 +116642,11 @@ index 0000000..d8ec362 |
250 |
+#if BUILDING_GCC_VERSION <= 4009 |
251 |
+typedef struct rtx_def rtx_insn; |
252 |
+ |
253 |
++static inline void set_decl_section_name(tree node, const char *value) |
254 |
++{ |
255 |
++ DECL_SECTION_NAME(node) = build_string(strlen(value) + 1, value); |
256 |
++} |
257 |
++ |
258 |
+static inline gasm *as_a_gasm(gimple stmt) |
259 |
+{ |
260 |
+ return stmt; |
261 |
@@ -116724,6 +116743,11 @@ index 0000000..d8ec362 |
262 |
+ varpool_node::finalize_decl(decl); |
263 |
+} |
264 |
+ |
265 |
++static inline void varpool_add_new_variable(tree decl) |
266 |
++{ |
267 |
++ varpool_node::add(decl); |
268 |
++} |
269 |
++ |
270 |
+static inline cgraph_node_ptr cgraph_function_node(cgraph_node_ptr node, enum availability *availability) |
271 |
+{ |
272 |
+ return node->function_symbol(availability); |
273 |
@@ -129688,7 +129712,7 @@ index 0000000..1d296ce |
274 |
+} |
275 |
diff --git a/tools/gcc/structleak_plugin.c b/tools/gcc/structleak_plugin.c |
276 |
new file mode 100644 |
277 |
-index 0000000..4436cbe |
278 |
+index 0000000..e9dbd4b |
279 |
--- /dev/null |
280 |
+++ b/tools/gcc/structleak_plugin.c |
281 |
@@ -0,0 +1,287 @@ |
282 |
@@ -129957,7 +129981,7 @@ index 0000000..4436cbe |
283 |
+ return 1; |
284 |
+ } |
285 |
+ |
286 |
-+ if (strncmp(lang_hooks.name, "GNU C", 5) || !strncmp(lang_hooks.name, "GNU C+", 6)) { |
287 |
++ if (strncmp(lang_hooks.name, "GNU C", 5) && !strncmp(lang_hooks.name, "GNU C+", 6)) { |
288 |
+ inform(UNKNOWN_LOCATION, G_("%s supports C only"), plugin_name); |
289 |
+ enable = false; |
290 |
+ } |
291 |
|
292 |
diff --git a/4.0.4/0000_README b/4.0.4/0000_README |
293 |
index 34a1fb8..e870dbc 100644 |
294 |
--- a/4.0.4/0000_README |
295 |
+++ b/4.0.4/0000_README |
296 |
@@ -2,7 +2,7 @@ README |
297 |
----------------------------------------------------------------------------- |
298 |
Individual Patch Descriptions: |
299 |
----------------------------------------------------------------------------- |
300 |
-Patch: 4420_grsecurity-3.1-4.0.4-201505222222.patch |
301 |
+Patch: 4420_grsecurity-3.1-4.0.4-201505272113.patch |
302 |
From: http://www.grsecurity.net |
303 |
Desc: hardened-sources base patch from upstream grsecurity |
304 |
|
305 |
|
306 |
diff --git a/4.0.4/4420_grsecurity-3.1-4.0.4-201505222222.patch b/4.0.4/4420_grsecurity-3.1-4.0.4-201505272113.patch |
307 |
similarity index 99% |
308 |
rename from 4.0.4/4420_grsecurity-3.1-4.0.4-201505222222.patch |
309 |
rename to 4.0.4/4420_grsecurity-3.1-4.0.4-201505272113.patch |
310 |
index 63e7f9a..b338663 100644 |
311 |
--- a/4.0.4/4420_grsecurity-3.1-4.0.4-201505222222.patch |
312 |
+++ b/4.0.4/4420_grsecurity-3.1-4.0.4-201505272113.patch |
313 |
@@ -373,7 +373,7 @@ index 4d68ec8..9546b75 100644 |
314 |
|
315 |
pcd. [PARIDE] |
316 |
diff --git a/Makefile b/Makefile |
317 |
-index 3d16bcc..a3b342e 100644 |
318 |
+index 3d16bcc..c31faf4 100644 |
319 |
--- a/Makefile |
320 |
+++ b/Makefile |
321 |
@@ -298,7 +298,9 @@ CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \ |
322 |
@@ -398,7 +398,7 @@ index 3d16bcc..a3b342e 100644 |
323 |
$(Q)$(MAKE) $(build)=scripts/basic |
324 |
$(Q)rm -f .tmp_quiet_recordmcount |
325 |
|
326 |
-@@ -622,6 +624,72 @@ endif |
327 |
+@@ -622,6 +624,74 @@ endif |
328 |
# Tell gcc to never replace conditional load with a non-conditional one |
329 |
KBUILD_CFLAGS += $(call cc-option,--param=allow-store-data-races=0) |
330 |
|
331 |
@@ -445,9 +445,11 @@ index 3d16bcc..a3b342e 100644 |
332 |
+ifdef CONFIG_PAX_MEMORY_STRUCTLEAK |
333 |
+STRUCTLEAK_PLUGIN_CFLAGS := -fplugin=$(objtree)/tools/gcc/structleak_plugin.so -DSTRUCTLEAK_PLUGIN |
334 |
+endif |
335 |
++INITIFY_PLUGIN_CFLAGS := -fplugin=$(objtree)/tools/gcc/initify_plugin.so -DINITIFY_PLUGIN |
336 |
+GCC_PLUGINS_CFLAGS := $(CONSTIFY_PLUGIN_CFLAGS) $(STACKLEAK_PLUGIN_CFLAGS) $(KALLOCSTAT_PLUGIN_CFLAGS) |
337 |
+GCC_PLUGINS_CFLAGS += $(KERNEXEC_PLUGIN_CFLAGS) $(CHECKER_PLUGIN_CFLAGS) $(COLORIZE_PLUGIN_CFLAGS) |
338 |
+GCC_PLUGINS_CFLAGS += $(SIZE_OVERFLOW_PLUGIN_CFLAGS) $(LATENT_ENTROPY_PLUGIN_CFLAGS) $(STRUCTLEAK_PLUGIN_CFLAGS) |
339 |
++GCC_PLUGINS_CFLAGS += $(INITIFY_PLUGIN_CFLAGS) |
340 |
+GCC_PLUGINS_CFLAGS += $(RANDSTRUCT_PLUGIN_CFLAGS) |
341 |
+GCC_PLUGINS_AFLAGS := $(KERNEXEC_PLUGIN_AFLAGS) |
342 |
+export PLUGINCC GCC_PLUGINS_CFLAGS GCC_PLUGINS_AFLAGS CONSTIFY_PLUGIN LATENT_ENTROPY_PLUGIN_CFLAGS |
343 |
@@ -471,7 +473,7 @@ index 3d16bcc..a3b342e 100644 |
344 |
ifdef CONFIG_READABLE_ASM |
345 |
# Disable optimizations that make assembler listings hard to read. |
346 |
# reorder blocks reorders the control in the function |
347 |
-@@ -714,7 +782,7 @@ KBUILD_CFLAGS += $(call cc-option, -gsplit-dwarf, -g) |
348 |
+@@ -714,7 +784,7 @@ KBUILD_CFLAGS += $(call cc-option, -gsplit-dwarf, -g) |
349 |
else |
350 |
KBUILD_CFLAGS += -g |
351 |
endif |
352 |
@@ -480,7 +482,7 @@ index 3d16bcc..a3b342e 100644 |
353 |
endif |
354 |
ifdef CONFIG_DEBUG_INFO_DWARF4 |
355 |
KBUILD_CFLAGS += $(call cc-option, -gdwarf-4,) |
356 |
-@@ -884,7 +952,7 @@ export mod_sign_cmd |
357 |
+@@ -884,7 +954,7 @@ export mod_sign_cmd |
358 |
|
359 |
|
360 |
ifeq ($(KBUILD_EXTMOD),) |
361 |
@@ -489,7 +491,7 @@ index 3d16bcc..a3b342e 100644 |
362 |
|
363 |
vmlinux-dirs := $(patsubst %/,%,$(filter %/, $(init-y) $(init-m) \ |
364 |
$(core-y) $(core-m) $(drivers-y) $(drivers-m) \ |
365 |
-@@ -934,6 +1002,8 @@ endif |
366 |
+@@ -934,6 +1004,8 @@ endif |
367 |
|
368 |
# The actual objects are generated when descending, |
369 |
# make sure no implicit rule kicks in |
370 |
@@ -498,7 +500,7 @@ index 3d16bcc..a3b342e 100644 |
371 |
$(sort $(vmlinux-deps)): $(vmlinux-dirs) ; |
372 |
|
373 |
# Handle descending into subdirectories listed in $(vmlinux-dirs) |
374 |
-@@ -943,7 +1013,7 @@ $(sort $(vmlinux-deps)): $(vmlinux-dirs) ; |
375 |
+@@ -943,7 +1015,7 @@ $(sort $(vmlinux-deps)): $(vmlinux-dirs) ; |
376 |
# Error messages still appears in the original language |
377 |
|
378 |
PHONY += $(vmlinux-dirs) |
379 |
@@ -507,7 +509,7 @@ index 3d16bcc..a3b342e 100644 |
380 |
$(Q)$(MAKE) $(build)=$@ |
381 |
|
382 |
define filechk_kernel.release |
383 |
-@@ -986,10 +1056,13 @@ prepare1: prepare2 $(version_h) include/generated/utsrelease.h \ |
384 |
+@@ -986,10 +1058,13 @@ prepare1: prepare2 $(version_h) include/generated/utsrelease.h \ |
385 |
|
386 |
archprepare: archheaders archscripts prepare1 scripts_basic |
387 |
|
388 |
@@ -521,7 +523,7 @@ index 3d16bcc..a3b342e 100644 |
389 |
prepare: prepare0 |
390 |
|
391 |
# Generate some files |
392 |
-@@ -1103,6 +1176,8 @@ all: modules |
393 |
+@@ -1103,6 +1178,8 @@ all: modules |
394 |
# using awk while concatenating to the final file. |
395 |
|
396 |
PHONY += modules |
397 |
@@ -530,7 +532,7 @@ index 3d16bcc..a3b342e 100644 |
398 |
modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux) modules.builtin |
399 |
$(Q)$(AWK) '!x[$$0]++' $(vmlinux-dirs:%=$(objtree)/%/modules.order) > $(objtree)/modules.order |
400 |
@$(kecho) ' Building modules, stage 2.'; |
401 |
-@@ -1118,7 +1193,7 @@ modules.builtin: $(vmlinux-dirs:%=%/modules.builtin) |
402 |
+@@ -1118,7 +1195,7 @@ modules.builtin: $(vmlinux-dirs:%=%/modules.builtin) |
403 |
|
404 |
# Target to prepare building external modules |
405 |
PHONY += modules_prepare |
406 |
@@ -539,7 +541,7 @@ index 3d16bcc..a3b342e 100644 |
407 |
|
408 |
# Target to install modules |
409 |
PHONY += modules_install |
410 |
-@@ -1184,7 +1259,10 @@ MRPROPER_FILES += .config .config.old .version .old_version \ |
411 |
+@@ -1184,7 +1261,10 @@ MRPROPER_FILES += .config .config.old .version .old_version \ |
412 |
Module.symvers tags TAGS cscope* GPATH GTAGS GRTAGS GSYMS \ |
413 |
signing_key.priv signing_key.x509 x509.genkey \ |
414 |
extra_certificates signing_key.x509.keyid \ |
415 |
@@ -551,7 +553,7 @@ index 3d16bcc..a3b342e 100644 |
416 |
|
417 |
# clean - Delete most, but leave enough to build external modules |
418 |
# |
419 |
-@@ -1223,7 +1301,7 @@ distclean: mrproper |
420 |
+@@ -1223,7 +1303,7 @@ distclean: mrproper |
421 |
@find $(srctree) $(RCS_FIND_IGNORE) \ |
422 |
\( -name '*.orig' -o -name '*.rej' -o -name '*~' \ |
423 |
-o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \ |
424 |
@@ -560,7 +562,7 @@ index 3d16bcc..a3b342e 100644 |
425 |
-type f -print | xargs rm -f |
426 |
|
427 |
|
428 |
-@@ -1389,6 +1467,8 @@ PHONY += $(module-dirs) modules |
429 |
+@@ -1389,6 +1469,8 @@ PHONY += $(module-dirs) modules |
430 |
$(module-dirs): crmodverdir $(objtree)/Module.symvers |
431 |
$(Q)$(MAKE) $(build)=$(patsubst _module_%,%,$@) |
432 |
|
433 |
@@ -569,7 +571,7 @@ index 3d16bcc..a3b342e 100644 |
434 |
modules: $(module-dirs) |
435 |
@$(kecho) ' Building modules, stage 2.'; |
436 |
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost |
437 |
-@@ -1529,17 +1609,21 @@ else |
438 |
+@@ -1529,17 +1611,21 @@ else |
439 |
target-dir = $(if $(KBUILD_EXTMOD),$(dir $<),$(dir $@)) |
440 |
endif |
441 |
|
442 |
@@ -595,7 +597,7 @@ index 3d16bcc..a3b342e 100644 |
443 |
$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) |
444 |
%.symtypes: %.c prepare scripts FORCE |
445 |
$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) |
446 |
-@@ -1551,11 +1635,15 @@ endif |
447 |
+@@ -1551,11 +1637,15 @@ endif |
448 |
$(build)=$(build-dir) |
449 |
# Make sure the latest headers are built for Documentation |
450 |
Documentation/: headers_install |
451 |
@@ -13969,7 +13971,7 @@ index e3531f8..e123f35 100644 |
452 |
ret; |
453 |
ENDPROC(cast6_xts_dec_8way) |
454 |
diff --git a/arch/x86/crypto/crc32c-pcl-intel-asm_64.S b/arch/x86/crypto/crc32c-pcl-intel-asm_64.S |
455 |
-index 26d49eb..c0a8c84 100644 |
456 |
+index 26d49eb..8bf39c8 100644 |
457 |
--- a/arch/x86/crypto/crc32c-pcl-intel-asm_64.S |
458 |
+++ b/arch/x86/crypto/crc32c-pcl-intel-asm_64.S |
459 |
@@ -45,6 +45,7 @@ |
460 |
@@ -13988,6 +13990,15 @@ index 26d49eb..c0a8c84 100644 |
461 |
ret |
462 |
|
463 |
################################################################ |
464 |
+@@ -330,7 +332,7 @@ ENDPROC(crc_pcl) |
465 |
+ ## PCLMULQDQ tables |
466 |
+ ## Table is 128 entries x 2 words (8 bytes) each |
467 |
+ ################################################################ |
468 |
+-.section .rotata, "a", %progbits |
469 |
++.section .rodata, "a", %progbits |
470 |
+ .align 8 |
471 |
+ K_table: |
472 |
+ .long 0x493c7d27, 0x00000001 |
473 |
diff --git a/arch/x86/crypto/ghash-clmulni-intel_asm.S b/arch/x86/crypto/ghash-clmulni-intel_asm.S |
474 |
index 5d1e007..098cb4f 100644 |
475 |
--- a/arch/x86/crypto/ghash-clmulni-intel_asm.S |
476 |
@@ -39369,6 +39380,165 @@ index 956b7e5..b655045 100644 |
477 |
|
478 |
composite = kzalloc(sizeof(*composite), GFP_KERNEL); |
479 |
if (!composite) { |
480 |
+diff --git a/drivers/clk/hisilicon/clk-hi3620.c b/drivers/clk/hisilicon/clk-hi3620.c |
481 |
+index 2e4f6d4..b4cf487 100644 |
482 |
+--- a/drivers/clk/hisilicon/clk-hi3620.c |
483 |
++++ b/drivers/clk/hisilicon/clk-hi3620.c |
484 |
+@@ -38,44 +38,44 @@ |
485 |
+ #include "clk.h" |
486 |
+ |
487 |
+ /* clock parent list */ |
488 |
+-static const char *timer0_mux_p[] __initconst = { "osc32k", "timerclk01", }; |
489 |
+-static const char *timer1_mux_p[] __initconst = { "osc32k", "timerclk01", }; |
490 |
+-static const char *timer2_mux_p[] __initconst = { "osc32k", "timerclk23", }; |
491 |
+-static const char *timer3_mux_p[] __initconst = { "osc32k", "timerclk23", }; |
492 |
+-static const char *timer4_mux_p[] __initconst = { "osc32k", "timerclk45", }; |
493 |
+-static const char *timer5_mux_p[] __initconst = { "osc32k", "timerclk45", }; |
494 |
+-static const char *timer6_mux_p[] __initconst = { "osc32k", "timerclk67", }; |
495 |
+-static const char *timer7_mux_p[] __initconst = { "osc32k", "timerclk67", }; |
496 |
+-static const char *timer8_mux_p[] __initconst = { "osc32k", "timerclk89", }; |
497 |
+-static const char *timer9_mux_p[] __initconst = { "osc32k", "timerclk89", }; |
498 |
+-static const char *uart0_mux_p[] __initconst = { "osc26m", "pclk", }; |
499 |
+-static const char *uart1_mux_p[] __initconst = { "osc26m", "pclk", }; |
500 |
+-static const char *uart2_mux_p[] __initconst = { "osc26m", "pclk", }; |
501 |
+-static const char *uart3_mux_p[] __initconst = { "osc26m", "pclk", }; |
502 |
+-static const char *uart4_mux_p[] __initconst = { "osc26m", "pclk", }; |
503 |
+-static const char *spi0_mux_p[] __initconst = { "osc26m", "rclk_cfgaxi", }; |
504 |
+-static const char *spi1_mux_p[] __initconst = { "osc26m", "rclk_cfgaxi", }; |
505 |
+-static const char *spi2_mux_p[] __initconst = { "osc26m", "rclk_cfgaxi", }; |
506 |
++static const char * const timer0_mux_p[] __initconst = { "osc32k", "timerclk01", }; |
507 |
++static const char * const timer1_mux_p[] __initconst = { "osc32k", "timerclk01", }; |
508 |
++static const char * const timer2_mux_p[] __initconst = { "osc32k", "timerclk23", }; |
509 |
++static const char * const timer3_mux_p[] __initconst = { "osc32k", "timerclk23", }; |
510 |
++static const char * const timer4_mux_p[] __initconst = { "osc32k", "timerclk45", }; |
511 |
++static const char * const timer5_mux_p[] __initconst = { "osc32k", "timerclk45", }; |
512 |
++static const char * const timer6_mux_p[] __initconst = { "osc32k", "timerclk67", }; |
513 |
++static const char * const timer7_mux_p[] __initconst = { "osc32k", "timerclk67", }; |
514 |
++static const char * const timer8_mux_p[] __initconst = { "osc32k", "timerclk89", }; |
515 |
++static const char * const timer9_mux_p[] __initconst = { "osc32k", "timerclk89", }; |
516 |
++static const char * const uart0_mux_p[] __initconst = { "osc26m", "pclk", }; |
517 |
++static const char * const uart1_mux_p[] __initconst = { "osc26m", "pclk", }; |
518 |
++static const char * const uart2_mux_p[] __initconst = { "osc26m", "pclk", }; |
519 |
++static const char * const uart3_mux_p[] __initconst = { "osc26m", "pclk", }; |
520 |
++static const char * const uart4_mux_p[] __initconst = { "osc26m", "pclk", }; |
521 |
++static const char * const spi0_mux_p[] __initconst = { "osc26m", "rclk_cfgaxi", }; |
522 |
++static const char * const spi1_mux_p[] __initconst = { "osc26m", "rclk_cfgaxi", }; |
523 |
++static const char * const spi2_mux_p[] __initconst = { "osc26m", "rclk_cfgaxi", }; |
524 |
+ /* share axi parent */ |
525 |
+-static const char *saxi_mux_p[] __initconst = { "armpll3", "armpll2", }; |
526 |
+-static const char *pwm0_mux_p[] __initconst = { "osc32k", "osc26m", }; |
527 |
+-static const char *pwm1_mux_p[] __initconst = { "osc32k", "osc26m", }; |
528 |
+-static const char *sd_mux_p[] __initconst = { "armpll2", "armpll3", }; |
529 |
+-static const char *mmc1_mux_p[] __initconst = { "armpll2", "armpll3", }; |
530 |
+-static const char *mmc1_mux2_p[] __initconst = { "osc26m", "mmc1_div", }; |
531 |
+-static const char *g2d_mux_p[] __initconst = { "armpll2", "armpll3", }; |
532 |
+-static const char *venc_mux_p[] __initconst = { "armpll2", "armpll3", }; |
533 |
+-static const char *vdec_mux_p[] __initconst = { "armpll2", "armpll3", }; |
534 |
+-static const char *vpp_mux_p[] __initconst = { "armpll2", "armpll3", }; |
535 |
+-static const char *edc0_mux_p[] __initconst = { "armpll2", "armpll3", }; |
536 |
+-static const char *ldi0_mux_p[] __initconst = { "armpll2", "armpll4", |
537 |
++static const char * const saxi_mux_p[] __initconst = { "armpll3", "armpll2", }; |
538 |
++static const char * const pwm0_mux_p[] __initconst = { "osc32k", "osc26m", }; |
539 |
++static const char * const pwm1_mux_p[] __initconst = { "osc32k", "osc26m", }; |
540 |
++static const char * const sd_mux_p[] __initconst = { "armpll2", "armpll3", }; |
541 |
++static const char * const mmc1_mux_p[] __initconst = { "armpll2", "armpll3", }; |
542 |
++static const char * const mmc1_mux2_p[] __initconst = { "osc26m", "mmc1_div", }; |
543 |
++static const char * const g2d_mux_p[] __initconst = { "armpll2", "armpll3", }; |
544 |
++static const char * const venc_mux_p[] __initconst = { "armpll2", "armpll3", }; |
545 |
++static const char * const vdec_mux_p[] __initconst = { "armpll2", "armpll3", }; |
546 |
++static const char * const vpp_mux_p[] __initconst = { "armpll2", "armpll3", }; |
547 |
++static const char * const edc0_mux_p[] __initconst = { "armpll2", "armpll3", }; |
548 |
++static const char * const ldi0_mux_p[] __initconst = { "armpll2", "armpll4", |
549 |
+ "armpll3", "armpll5", }; |
550 |
+-static const char *edc1_mux_p[] __initconst = { "armpll2", "armpll3", }; |
551 |
+-static const char *ldi1_mux_p[] __initconst = { "armpll2", "armpll4", |
552 |
++static const char * const edc1_mux_p[] __initconst = { "armpll2", "armpll3", }; |
553 |
++static const char * const ldi1_mux_p[] __initconst = { "armpll2", "armpll4", |
554 |
+ "armpll3", "armpll5", }; |
555 |
+-static const char *rclk_hsic_p[] __initconst = { "armpll3", "armpll2", }; |
556 |
+-static const char *mmc2_mux_p[] __initconst = { "armpll2", "armpll3", }; |
557 |
+-static const char *mmc3_mux_p[] __initconst = { "armpll2", "armpll3", }; |
558 |
++static const char * const rclk_hsic_p[] __initconst = { "armpll3", "armpll2", }; |
559 |
++static const char * const mmc2_mux_p[] __initconst = { "armpll2", "armpll3", }; |
560 |
++static const char * const mmc3_mux_p[] __initconst = { "armpll2", "armpll3", }; |
561 |
+ |
562 |
+ |
563 |
+ /* fixed rate clocks */ |
564 |
+diff --git a/drivers/clk/hisilicon/clk-hix5hd2.c b/drivers/clk/hisilicon/clk-hix5hd2.c |
565 |
+index 3f369c6..05f9ffd 100644 |
566 |
+--- a/drivers/clk/hisilicon/clk-hix5hd2.c |
567 |
++++ b/drivers/clk/hisilicon/clk-hix5hd2.c |
568 |
+@@ -46,15 +46,15 @@ static struct hisi_fixed_rate_clock hix5hd2_fixed_rate_clks[] __initdata = { |
569 |
+ { HIX5HD2_FIXED_83M, "83m", NULL, CLK_IS_ROOT, 83333333, }, |
570 |
+ }; |
571 |
+ |
572 |
+-static const char *sfc_mux_p[] __initconst = { |
573 |
++static const char * const sfc_mux_p[] __initconst = { |
574 |
+ "24m", "150m", "200m", "100m", "75m", }; |
575 |
+ static u32 sfc_mux_table[] = {0, 4, 5, 6, 7}; |
576 |
+ |
577 |
+-static const char *sdio_mux_p[] __initconst = { |
578 |
++static const char * const sdio_mux_p[] __initconst = { |
579 |
+ "75m", "100m", "50m", "15m", }; |
580 |
+ static u32 sdio_mux_table[] = {0, 1, 2, 3}; |
581 |
+ |
582 |
+-static const char *fephy_mux_p[] __initconst = { "25m", "125m"}; |
583 |
++static const char * const fephy_mux_p[] __initconst = { "25m", "125m"}; |
584 |
+ static u32 fephy_mux_table[] = {0, 1}; |
585 |
+ |
586 |
+ |
587 |
+diff --git a/drivers/clk/rockchip/clk-rk3188.c b/drivers/clk/rockchip/clk-rk3188.c |
588 |
+index 7eb684c..147c6fc 100644 |
589 |
+--- a/drivers/clk/rockchip/clk-rk3188.c |
590 |
++++ b/drivers/clk/rockchip/clk-rk3188.c |
591 |
+@@ -704,7 +704,7 @@ static struct rockchip_clk_branch rk3188_clk_branches[] __initdata = { |
592 |
+ GATE(ACLK_GPS, "aclk_gps", "aclk_peri", 0, RK2928_CLKGATE_CON(8), 13, GFLAGS), |
593 |
+ }; |
594 |
+ |
595 |
+-static const char *rk3188_critical_clocks[] __initconst = { |
596 |
++static const char * const rk3188_critical_clocks[] __initconst = { |
597 |
+ "aclk_cpu", |
598 |
+ "aclk_peri", |
599 |
+ "hclk_peri", |
600 |
+diff --git a/drivers/clk/rockchip/clk-rk3288.c b/drivers/clk/rockchip/clk-rk3288.c |
601 |
+index 05d7a0b..4fc131c 100644 |
602 |
+--- a/drivers/clk/rockchip/clk-rk3288.c |
603 |
++++ b/drivers/clk/rockchip/clk-rk3288.c |
604 |
+@@ -771,7 +771,7 @@ static struct rockchip_clk_branch rk3288_clk_branches[] __initdata = { |
605 |
+ GATE(0, "pclk_isp_in", "ext_isp", 0, RK3288_CLKGATE_CON(16), 3, GFLAGS), |
606 |
+ }; |
607 |
+ |
608 |
+-static const char *rk3288_critical_clocks[] __initconst = { |
609 |
++static const char * const rk3288_critical_clocks[] __initconst = { |
610 |
+ "aclk_cpu", |
611 |
+ "aclk_peri", |
612 |
+ "hclk_peri", |
613 |
+diff --git a/drivers/clk/rockchip/clk.h b/drivers/clk/rockchip/clk.h |
614 |
+index 58d2e3b..0c21b0d 100644 |
615 |
+--- a/drivers/clk/rockchip/clk.h |
616 |
++++ b/drivers/clk/rockchip/clk.h |
617 |
+@@ -182,7 +182,7 @@ struct clk *rockchip_clk_register_mmc(const char *name, |
618 |
+ const char **parent_names, u8 num_parents, |
619 |
+ void __iomem *reg, int shift); |
620 |
+ |
621 |
+-#define PNAME(x) static const char *x[] __initconst |
622 |
++#define PNAME(x) static const char * const x[] __initconst |
623 |
+ |
624 |
+ enum rockchip_clk_branch_type { |
625 |
+ branch_composite, |
626 |
+diff --git a/drivers/clk/samsung/clk.h b/drivers/clk/samsung/clk.h |
627 |
+index e4c7538..99c50cd 100644 |
628 |
+--- a/drivers/clk/samsung/clk.h |
629 |
++++ b/drivers/clk/samsung/clk.h |
630 |
+@@ -260,7 +260,7 @@ struct samsung_gate_clock { |
631 |
+ #define GATE_DA(_id, dname, cname, pname, o, b, f, gf, a) \ |
632 |
+ __GATE(_id, dname, cname, pname, o, b, f, gf, a) |
633 |
+ |
634 |
+-#define PNAME(x) static const char *x[] __initdata |
635 |
++#define PNAME(x) static const char * const x[] __initconst |
636 |
+ |
637 |
+ /** |
638 |
+ * struct samsung_clk_reg_dump: register dump of clock controller registers. |
639 |
diff --git a/drivers/clk/socfpga/clk-gate.c b/drivers/clk/socfpga/clk-gate.c |
640 |
index dd3a78c..386d49c 100644 |
641 |
--- a/drivers/clk/socfpga/clk-gate.c |
642 |
@@ -39437,6 +39607,58 @@ index de6da95..c98278b 100644 |
643 |
|
644 |
clk = clk_register(NULL, &pll_clk->hw.hw); |
645 |
if (WARN_ON(IS_ERR(clk))) { |
646 |
+diff --git a/drivers/clk/ti/composite.c b/drivers/clk/ti/composite.c |
647 |
+index 3654f61..81abe81 100644 |
648 |
+--- a/drivers/clk/ti/composite.c |
649 |
++++ b/drivers/clk/ti/composite.c |
650 |
+@@ -69,7 +69,7 @@ struct component_clk { |
651 |
+ struct list_head link; |
652 |
+ }; |
653 |
+ |
654 |
+-static const char * __initconst component_clk_types[] = { |
655 |
++static const char * const __initconst component_clk_types[] = { |
656 |
+ "gate", "divider", "mux" |
657 |
+ }; |
658 |
+ |
659 |
+diff --git a/drivers/clk/zynq/clkc.c b/drivers/clk/zynq/clkc.c |
660 |
+index f870aad..04ba1e4 100644 |
661 |
+--- a/drivers/clk/zynq/clkc.c |
662 |
++++ b/drivers/clk/zynq/clkc.c |
663 |
+@@ -85,22 +85,22 @@ static DEFINE_SPINLOCK(canmioclk_lock); |
664 |
+ static DEFINE_SPINLOCK(dbgclk_lock); |
665 |
+ static DEFINE_SPINLOCK(aperclk_lock); |
666 |
+ |
667 |
+-static const char *armpll_parents[] __initconst = {"armpll_int", "ps_clk"}; |
668 |
+-static const char *ddrpll_parents[] __initconst = {"ddrpll_int", "ps_clk"}; |
669 |
+-static const char *iopll_parents[] __initconst = {"iopll_int", "ps_clk"}; |
670 |
+-static const char *gem0_mux_parents[] __initconst = {"gem0_div1", "dummy_name"}; |
671 |
+-static const char *gem1_mux_parents[] __initconst = {"gem1_div1", "dummy_name"}; |
672 |
+-static const char *can0_mio_mux2_parents[] __initconst = {"can0_gate", |
673 |
++static const char * const armpll_parents[] __initconst = {"armpll_int", "ps_clk"}; |
674 |
++static const char * const ddrpll_parents[] __initconst = {"ddrpll_int", "ps_clk"}; |
675 |
++static const char * const iopll_parents[] __initconst = {"iopll_int", "ps_clk"}; |
676 |
++static const char * gem0_mux_parents[] __initdata = {"gem0_div1", "dummy_name"}; |
677 |
++static const char * gem1_mux_parents[] __initdata = {"gem1_div1", "dummy_name"}; |
678 |
++static const char * const can0_mio_mux2_parents[] __initconst = {"can0_gate", |
679 |
+ "can0_mio_mux"}; |
680 |
+-static const char *can1_mio_mux2_parents[] __initconst = {"can1_gate", |
681 |
++static const char * const can1_mio_mux2_parents[] __initconst = {"can1_gate", |
682 |
+ "can1_mio_mux"}; |
683 |
+-static const char *dbg_emio_mux_parents[] __initconst = {"dbg_div", |
684 |
++static const char * dbg_emio_mux_parents[] __initdata = {"dbg_div", |
685 |
+ "dummy_name"}; |
686 |
+ |
687 |
+-static const char *dbgtrc_emio_input_names[] __initconst = {"trace_emio_clk"}; |
688 |
+-static const char *gem0_emio_input_names[] __initconst = {"gem0_emio_clk"}; |
689 |
+-static const char *gem1_emio_input_names[] __initconst = {"gem1_emio_clk"}; |
690 |
+-static const char *swdt_ext_clk_input_names[] __initconst = {"swdt_ext_clk"}; |
691 |
++static const char * const dbgtrc_emio_input_names[] __initconst = {"trace_emio_clk"}; |
692 |
++static const char * const gem0_emio_input_names[] __initconst = {"gem0_emio_clk"}; |
693 |
++static const char * const gem1_emio_input_names[] __initconst = {"gem1_emio_clk"}; |
694 |
++static const char * const swdt_ext_clk_input_names[] __initconst = {"swdt_ext_clk"}; |
695 |
+ |
696 |
+ static void __init zynq_clk_register_fclk(enum zynq_clk fclk, |
697 |
+ const char *clk_name, void __iomem *fclk_ctrl_reg, |
698 |
diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c |
699 |
index b0c18ed..1713a80 100644 |
700 |
--- a/drivers/cpufreq/acpi-cpufreq.c |
701 |
@@ -45023,32 +45245,6 @@ index 87f7dff..7300125 100644 |
702 |
dsp_cmx_send(void *arg) |
703 |
{ |
704 |
struct dsp_conf *conf; |
705 |
-diff --git a/drivers/leds/leds-clevo-mail.c b/drivers/leds/leds-clevo-mail.c |
706 |
-index 0f9ed1e..2715d6f 100644 |
707 |
---- a/drivers/leds/leds-clevo-mail.c |
708 |
-+++ b/drivers/leds/leds-clevo-mail.c |
709 |
-@@ -40,7 +40,7 @@ static int __init clevo_mail_led_dmi_callback(const struct dmi_system_id *id) |
710 |
- * detected as working, but in reality it is not) as low as |
711 |
- * possible. |
712 |
- */ |
713 |
--static struct dmi_system_id clevo_mail_led_dmi_table[] __initdata = { |
714 |
-+static struct dmi_system_id clevo_mail_led_dmi_table[] __initconst = { |
715 |
- { |
716 |
- .callback = clevo_mail_led_dmi_callback, |
717 |
- .ident = "Clevo D410J", |
718 |
-diff --git a/drivers/leds/leds-ss4200.c b/drivers/leds/leds-ss4200.c |
719 |
-index 046cb70..6b20d39 100644 |
720 |
---- a/drivers/leds/leds-ss4200.c |
721 |
-+++ b/drivers/leds/leds-ss4200.c |
722 |
-@@ -91,7 +91,7 @@ MODULE_PARM_DESC(nodetect, "Skip DMI-based hardware detection"); |
723 |
- * detected as working, but in reality it is not) as low as |
724 |
- * possible. |
725 |
- */ |
726 |
--static struct dmi_system_id nas_led_whitelist[] __initdata = { |
727 |
-+static struct dmi_system_id nas_led_whitelist[] __initconst = { |
728 |
- { |
729 |
- .callback = ss4200_led_dmi_callback, |
730 |
- .ident = "Intel SS4200-E", |
731 |
diff --git a/drivers/lguest/core.c b/drivers/lguest/core.c |
732 |
index 7dc93aa..8272379 100644 |
733 |
--- a/drivers/lguest/core.c |
734 |
@@ -50954,19 +51150,6 @@ index 3f155e7..0f4b1f0 100644 |
735 |
proc_create("devices", 0, proc_bus_pci_dir, |
736 |
&proc_bus_pci_dev_operations); |
737 |
proc_initialized = 1; |
738 |
-diff --git a/drivers/platform/chrome/chromeos_laptop.c b/drivers/platform/chrome/chromeos_laptop.c |
739 |
-index b84fdd6..b89d829 100644 |
740 |
---- a/drivers/platform/chrome/chromeos_laptop.c |
741 |
-+++ b/drivers/platform/chrome/chromeos_laptop.c |
742 |
-@@ -479,7 +479,7 @@ static struct chromeos_laptop cr48 = { |
743 |
- .callback = chromeos_laptop_dmi_matched, \ |
744 |
- .driver_data = (void *)&board_ |
745 |
- |
746 |
--static struct dmi_system_id chromeos_laptop_dmi_table[] __initdata = { |
747 |
-+static struct dmi_system_id chromeos_laptop_dmi_table[] __initconst = { |
748 |
- { |
749 |
- .ident = "Samsung Series 5 550", |
750 |
- .matches = { |
751 |
diff --git a/drivers/platform/chrome/chromeos_pstore.c b/drivers/platform/chrome/chromeos_pstore.c |
752 |
index 3474920..acc9581 100644 |
753 |
--- a/drivers/platform/chrome/chromeos_pstore.c |
754 |
@@ -68436,7 +68619,7 @@ index e4141f2..d8263e8 100644 |
755 |
i += packet_length_size; |
756 |
if (copy_to_user(&buf[i], msg_ctx->msg, msg_ctx->msg_size)) |
757 |
diff --git a/fs/exec.c b/fs/exec.c |
758 |
-index 00400cf..b9dca28 100644 |
759 |
+index 00400cf..b9d927b 100644 |
760 |
--- a/fs/exec.c |
761 |
+++ b/fs/exec.c |
762 |
@@ -56,8 +56,20 @@ |
763 |
@@ -69253,7 +69436,7 @@ index 00400cf..b9dca28 100644 |
764 |
+#endif |
765 |
+ |
766 |
+#ifdef CONFIG_PAX_SIZE_OVERFLOW |
767 |
-+void report_size_overflow(const char *file, unsigned int line, const char *func, const char *ssa_name) |
768 |
++void __nocapture(1, 3, 4) report_size_overflow(const char *file, unsigned int line, const char *func, const char *ssa_name) |
769 |
+{ |
770 |
+ printk(KERN_ERR "PAX: size overflow detected in function %s %s:%u %s", func, file, line, ssa_name); |
771 |
+ dump_stack(); |
772 |
@@ -87783,6 +87966,27 @@ index b097cf8..3d40e14 100644 |
773 |
{ |
774 |
if (x == 0) |
775 |
return 0; |
776 |
+diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h |
777 |
+index 630dd23..8c1dcb6b 100644 |
778 |
+--- a/include/asm-generic/bug.h |
779 |
++++ b/include/asm-generic/bug.h |
780 |
+@@ -62,13 +62,13 @@ struct bug_entry { |
781 |
+ * to provide better diagnostics. |
782 |
+ */ |
783 |
+ #ifndef __WARN_TAINT |
784 |
+-extern __printf(3, 4) |
785 |
++extern __printf(3, 4) __nocapture(1, 3, 4) |
786 |
+ void warn_slowpath_fmt(const char *file, const int line, |
787 |
+ const char *fmt, ...); |
788 |
+-extern __printf(4, 5) |
789 |
++extern __printf(4, 5) __nocapture(1, 4, 5) |
790 |
+ void warn_slowpath_fmt_taint(const char *file, const int line, unsigned taint, |
791 |
+ const char *fmt, ...); |
792 |
+-extern void warn_slowpath_null(const char *file, const int line); |
793 |
++extern __nocapture(1) void warn_slowpath_null(const char *file, const int line); |
794 |
+ #define WANT_WARN_ON_SLOWPATH |
795 |
+ #define __WARN() warn_slowpath_null(__FILE__, __LINE__) |
796 |
+ #define __WARN_printf(arg...) warn_slowpath_fmt(__FILE__, __LINE__, arg) |
797 |
diff --git a/include/asm-generic/cache.h b/include/asm-generic/cache.h |
798 |
index 1bfcfe5..e04c5c9 100644 |
799 |
--- a/include/asm-generic/cache.h |
800 |
@@ -88003,7 +88207,7 @@ index 72d8803..cb9749c 100644 |
801 |
+ |
802 |
#endif /* __ASM_GENERIC_UACCESS_H */ |
803 |
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h |
804 |
-index ac78910..775a306 100644 |
805 |
+index ac78910..8b5f068 100644 |
806 |
--- a/include/asm-generic/vmlinux.lds.h |
807 |
+++ b/include/asm-generic/vmlinux.lds.h |
808 |
@@ -234,6 +234,7 @@ |
809 |
@@ -88014,7 +88218,24 @@ index ac78910..775a306 100644 |
810 |
*(__vermagic) /* Kernel version magic */ \ |
811 |
. = ALIGN(8); \ |
812 |
VMLINUX_SYMBOL(__start___tracepoints_ptrs) = .; \ |
813 |
-@@ -727,17 +728,18 @@ |
814 |
+@@ -492,6 +493,7 @@ |
815 |
+ KERNEL_CTORS() \ |
816 |
+ MCOUNT_REC() \ |
817 |
+ *(.init.rodata) \ |
818 |
++ *(.init.rodata.*) \ |
819 |
+ FTRACE_EVENTS() \ |
820 |
+ TRACE_SYSCALLS() \ |
821 |
+ KPROBE_BLACKLIST() \ |
822 |
+@@ -511,6 +513,8 @@ |
823 |
+ |
824 |
+ #define EXIT_DATA \ |
825 |
+ *(.exit.data) \ |
826 |
++ *(.exit.rodata) \ |
827 |
++ *(.exit.rodata.*) \ |
828 |
+ MEM_DISCARD(exit.data) \ |
829 |
+ MEM_DISCARD(exit.rodata) |
830 |
+ |
831 |
+@@ -727,17 +731,18 @@ |
832 |
* section in the linker script will go there too. @phdr should have |
833 |
* a leading colon. |
834 |
* |
835 |
@@ -88452,11 +88673,26 @@ index ab25814..d1540d1 100644 |
836 |
|
837 |
asmlinkage long compat_sys_lookup_dcookie(u32, u32, char __user *, compat_size_t); |
838 |
/* |
839 |
+diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h |
840 |
+index cdf13ca..ba5e086 100644 |
841 |
+--- a/include/linux/compiler-gcc.h |
842 |
++++ b/include/linux/compiler-gcc.h |
843 |
+@@ -94,8 +94,8 @@ |
844 |
+ */ |
845 |
+ #define __pure __attribute__((pure)) |
846 |
+ #define __aligned(x) __attribute__((aligned(x))) |
847 |
+-#define __printf(a, b) __attribute__((format(printf, a, b))) |
848 |
+-#define __scanf(a, b) __attribute__((format(scanf, a, b))) |
849 |
++#define __printf(a, b) __attribute__((format(printf, a, b))) __nocapture(a, b) |
850 |
++#define __scanf(a, b) __attribute__((format(scanf, a, b))) __nocapture(a, b) |
851 |
+ #define noinline __attribute__((noinline)) |
852 |
+ #define __attribute_const__ __attribute__((__const__)) |
853 |
+ #define __maybe_unused __attribute__((unused)) |
854 |
diff --git a/include/linux/compiler-gcc4.h b/include/linux/compiler-gcc4.h |
855 |
-index 769e198..f670585 100644 |
856 |
+index 769e198..7ee7cb5 100644 |
857 |
--- a/include/linux/compiler-gcc4.h |
858 |
+++ b/include/linux/compiler-gcc4.h |
859 |
-@@ -39,9 +39,34 @@ |
860 |
+@@ -39,9 +39,38 @@ |
861 |
# define __compiletime_warning(message) __attribute__((warning(message))) |
862 |
# define __compiletime_error(message) __attribute__((error(message))) |
863 |
#endif /* __CHECKER__ */ |
864 |
@@ -88488,14 +88724,18 @@ index 769e198..f670585 100644 |
865 |
+#define __latent_entropy __attribute__((latent_entropy)) |
866 |
+#endif |
867 |
+ |
868 |
++#ifdef INITIFY_PLUGIN |
869 |
++#define __nocapture(...) __attribute__((nocapture(__VA_ARGS__))) |
870 |
++#endif |
871 |
++ |
872 |
/* |
873 |
* Mark a position in code as unreachable. This can be used to |
874 |
* suppress control flow warnings after asm blocks that transfer |
875 |
diff --git a/include/linux/compiler-gcc5.h b/include/linux/compiler-gcc5.h |
876 |
-index efee493..06f9f63 100644 |
877 |
+index efee493..8aa8f6b 100644 |
878 |
--- a/include/linux/compiler-gcc5.h |
879 |
+++ b/include/linux/compiler-gcc5.h |
880 |
-@@ -28,6 +28,30 @@ |
881 |
+@@ -28,6 +28,34 @@ |
882 |
# define __compiletime_error(message) __attribute__((error(message))) |
883 |
#endif /* __CHECKER__ */ |
884 |
|
885 |
@@ -88523,11 +88763,15 @@ index efee493..06f9f63 100644 |
886 |
+#define __latent_entropy __attribute__((latent_entropy)) |
887 |
+#endif |
888 |
+ |
889 |
++#ifdef INITIFY_PLUGIN |
890 |
++#define __nocapture(...) __attribute__((nocapture(__VA_ARGS__))) |
891 |
++#endif |
892 |
++ |
893 |
/* |
894 |
* Mark a position in code as unreachable. This can be used to |
895 |
* suppress control flow warnings after asm blocks that transfer |
896 |
diff --git a/include/linux/compiler.h b/include/linux/compiler.h |
897 |
-index 1b45e4a..33028cd 100644 |
898 |
+index 1b45e4a..eff29a7 100644 |
899 |
--- a/include/linux/compiler.h |
900 |
+++ b/include/linux/compiler.h |
901 |
@@ -5,11 +5,14 @@ |
902 |
@@ -88639,7 +88883,7 @@ index 1b45e4a..33028cd 100644 |
903 |
data_access_exceeds_word_size(); |
904 |
barrier(); |
905 |
} |
906 |
-@@ -364,6 +386,34 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s |
907 |
+@@ -364,6 +386,38 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s |
908 |
# define __attribute_const__ /* unimplemented */ |
909 |
#endif |
910 |
|
911 |
@@ -88671,10 +88915,14 @@ index 1b45e4a..33028cd 100644 |
912 |
+# define __latent_entropy |
913 |
+#endif |
914 |
+ |
915 |
++#ifndef __nocapture |
916 |
++# define __nocapture(...) |
917 |
++#endif |
918 |
++ |
919 |
/* |
920 |
* Tell gcc if a function is cold. The compiler will assume any path |
921 |
* directly leading to the call is unlikely. |
922 |
-@@ -373,6 +423,22 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s |
923 |
+@@ -373,6 +427,22 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s |
924 |
#define __cold |
925 |
#endif |
926 |
|
927 |
@@ -88697,7 +88945,7 @@ index 1b45e4a..33028cd 100644 |
928 |
/* Simple shorthand for a section definition */ |
929 |
#ifndef __section |
930 |
# define __section(S) __attribute__ ((__section__(#S))) |
931 |
-@@ -387,6 +453,8 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s |
932 |
+@@ -387,6 +457,8 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s |
933 |
# define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) |
934 |
#endif |
935 |
|
936 |
@@ -88706,7 +88954,7 @@ index 1b45e4a..33028cd 100644 |
937 |
/* Is this type a native word size -- useful for atomic operations */ |
938 |
#ifndef __native_word |
939 |
# define __native_word(t) (sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || sizeof(t) == sizeof(int) || sizeof(t) == sizeof(long)) |
940 |
-@@ -466,8 +534,9 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s |
941 |
+@@ -466,8 +538,9 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s |
942 |
*/ |
943 |
#define __ACCESS_ONCE(x) ({ \ |
944 |
__maybe_unused typeof(x) __var = (__force typeof(x)) 0; \ |
945 |
@@ -89181,7 +89429,7 @@ index 8293262..2b3b8bd 100644 |
946 |
extern bool frontswap_enabled; |
947 |
extern struct frontswap_ops * |
948 |
diff --git a/include/linux/fs.h b/include/linux/fs.h |
949 |
-index 52cc449..58b25c9 100644 |
950 |
+index 52cc449..31f35cb 100644 |
951 |
--- a/include/linux/fs.h |
952 |
+++ b/include/linux/fs.h |
953 |
@@ -410,7 +410,7 @@ struct address_space { |
954 |
@@ -89248,6 +89496,15 @@ index 52cc449..58b25c9 100644 |
955 |
|
956 |
struct inode_operations { |
957 |
struct dentry * (*lookup) (struct inode *,struct dentry *, unsigned int); |
958 |
+@@ -2269,7 +2270,7 @@ extern int register_chrdev_region(dev_t, unsigned, const char *); |
959 |
+ extern int __register_chrdev(unsigned int major, unsigned int baseminor, |
960 |
+ unsigned int count, const char *name, |
961 |
+ const struct file_operations *fops); |
962 |
+-extern void __unregister_chrdev(unsigned int major, unsigned int baseminor, |
963 |
++extern __nocapture(4) void __unregister_chrdev(unsigned int major, unsigned int baseminor, |
964 |
+ unsigned int count, const char *name); |
965 |
+ extern void unregister_chrdev_region(dev_t, unsigned); |
966 |
+ extern void chrdev_show(struct seq_file *,off_t); |
967 |
@@ -2918,4 +2919,14 @@ static inline bool dir_relax(struct inode *inode) |
968 |
return !IS_DEADDIR(inode); |
969 |
} |
970 |
@@ -90975,14 +91232,14 @@ index dd1109f..4f4fdda 100644 |
971 |
raw_spinlock_t lock; |
972 |
struct cpumask *percpu_enabled; |
973 |
diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h |
974 |
-index 676d730..5e05daec 100644 |
975 |
+index 676d730..8d3a1ad 100644 |
976 |
--- a/include/linux/irqdomain.h |
977 |
+++ b/include/linux/irqdomain.h |
978 |
@@ -40,6 +40,7 @@ struct device_node; |
979 |
struct irq_domain; |
980 |
struct of_device_id; |
981 |
struct irq_chip; |
982 |
-+struct irq_chip_no_const; |
983 |
++typedef struct irq_chip __no_const irq_chip_no_const; |
984 |
struct irq_data; |
985 |
|
986 |
/* Number of irqs reserved for a legacy isa controller */ |
987 |
@@ -103673,6 +103930,41 @@ index 4abda07..b9d3765 100644 |
988 |
{ |
989 |
phys_addr_t paddr = dma_to_phys(hwdev, dev_addr); |
990 |
|
991 |
+diff --git a/lib/test-hexdump.c b/lib/test-hexdump.c |
992 |
+index daf29a39..56f44ac 100644 |
993 |
+--- a/lib/test-hexdump.c |
994 |
++++ b/lib/test-hexdump.c |
995 |
+@@ -18,26 +18,26 @@ static const unsigned char data_b[] = { |
996 |
+ |
997 |
+ static const unsigned char data_a[] = ".2.{....p..$}.4...1.....L...C..."; |
998 |
+ |
999 |
+-static const char *test_data_1_le[] __initconst = { |
1000 |
++static const char * const test_data_1_le[] __initconst = { |
1001 |
+ "be", "32", "db", "7b", "0a", "18", "93", "b2", |
1002 |
+ "70", "ba", "c4", "24", "7d", "83", "34", "9b", |
1003 |
+ "a6", "9c", "31", "ad", "9c", "0f", "ac", "e9", |
1004 |
+ "4c", "d1", "19", "99", "43", "b1", "af", "0c", |
1005 |
+ }; |
1006 |
+ |
1007 |
+-static const char *test_data_2_le[] __initconst = { |
1008 |
++static const char * const test_data_2_le[] __initconst = { |
1009 |
+ "32be", "7bdb", "180a", "b293", |
1010 |
+ "ba70", "24c4", "837d", "9b34", |
1011 |
+ "9ca6", "ad31", "0f9c", "e9ac", |
1012 |
+ "d14c", "9919", "b143", "0caf", |
1013 |
+ }; |
1014 |
+ |
1015 |
+-static const char *test_data_4_le[] __initconst = { |
1016 |
++static const char * const test_data_4_le[] __initconst = { |
1017 |
+ "7bdb32be", "b293180a", "24c4ba70", "9b34837d", |
1018 |
+ "ad319ca6", "e9ac0f9c", "9919d14c", "0cafb143", |
1019 |
+ }; |
1020 |
+ |
1021 |
+-static const char *test_data_8_le[] __initconst = { |
1022 |
++static const char * const test_data_8_le[] __initconst = { |
1023 |
+ "b293180a7bdb32be", "9b34837d24c4ba70", |
1024 |
+ "e9ac0f9cad319ca6", "0cafb1439919d14c", |
1025 |
+ }; |
1026 |
diff --git a/lib/usercopy.c b/lib/usercopy.c |
1027 |
index 4f5b1dd..7cab418 100644 |
1028 |
--- a/lib/usercopy.c |
1029 |
@@ -118922,10 +119214,10 @@ index 0000000..de92ed9 |
1030 |
+randomize_layout_seed.h |
1031 |
diff --git a/tools/gcc/Makefile b/tools/gcc/Makefile |
1032 |
new file mode 100644 |
1033 |
-index 0000000..a51677e |
1034 |
+index 0000000..4945d82 |
1035 |
--- /dev/null |
1036 |
+++ b/tools/gcc/Makefile |
1037 |
-@@ -0,0 +1,52 @@ |
1038 |
+@@ -0,0 +1,54 @@ |
1039 |
+#CC := gcc |
1040 |
+#PLUGIN_SOURCE_FILES := pax_plugin.c |
1041 |
+#PLUGIN_OBJECT_FILES := $(patsubst %.c,%.o,$(PLUGIN_SOURCE_FILES)) |
1042 |
@@ -118952,6 +119244,7 @@ index 0000000..a51677e |
1043 |
+$(HOSTLIBS)-y += colorize_plugin.so |
1044 |
+$(HOSTLIBS)-$(CONFIG_PAX_LATENT_ENTROPY) += latent_entropy_plugin.so |
1045 |
+$(HOSTLIBS)-$(CONFIG_PAX_MEMORY_STRUCTLEAK) += structleak_plugin.so |
1046 |
++$(HOSTLIBS)-y += initify_plugin.so |
1047 |
+$(HOSTLIBS)-$(CONFIG_GRKERNSEC_RANDSTRUCT) += randomize_layout_plugin.so |
1048 |
+ |
1049 |
+subdir-$(CONFIG_PAX_SIZE_OVERFLOW) := size_overflow_plugin |
1050 |
@@ -118967,6 +119260,7 @@ index 0000000..a51677e |
1051 |
+colorize_plugin-objs := colorize_plugin.o |
1052 |
+latent_entropy_plugin-objs := latent_entropy_plugin.o |
1053 |
+structleak_plugin-objs := structleak_plugin.o |
1054 |
++initify_plugin-objs := initify_plugin.o |
1055 |
+randomize_layout_plugin-objs := randomize_layout_plugin.o |
1056 |
+ |
1057 |
+$(obj)/randomize_layout_plugin.o: $(objtree)/$(obj)/randomize_layout_seed.h |
1058 |
@@ -119357,10 +119651,10 @@ index 0000000..0c96d8a |
1059 |
+} |
1060 |
diff --git a/tools/gcc/constify_plugin.c b/tools/gcc/constify_plugin.c |
1061 |
new file mode 100644 |
1062 |
-index 0000000..93b181d |
1063 |
+index 0000000..da184c5 |
1064 |
--- /dev/null |
1065 |
+++ b/tools/gcc/constify_plugin.c |
1066 |
-@@ -0,0 +1,563 @@ |
1067 |
+@@ -0,0 +1,564 @@ |
1068 |
+/* |
1069 |
+ * Copyright 2011 by Emese Revfy <re.emese@×××××.com> |
1070 |
+ * Copyright 2011-2015 by PaX Team <pageexec@××××××××.hu> |
1071 |
@@ -119599,7 +119893,8 @@ index 0000000..93b181d |
1072 |
+ return NULL_TREE; |
1073 |
+ } |
1074 |
+ |
1075 |
-+ error("%qE attribute used on type %qT that is not constified", name, type); |
1076 |
++ if (TYPE_FIELDS(type)) |
1077 |
++ error("%qE attribute used on type %qT that is not constified", name, type); |
1078 |
+ return NULL_TREE; |
1079 |
+} |
1080 |
+ |
1081 |
@@ -119926,10 +120221,10 @@ index 0000000..93b181d |
1082 |
+} |
1083 |
diff --git a/tools/gcc/gcc-common.h b/tools/gcc/gcc-common.h |
1084 |
new file mode 100644 |
1085 |
-index 0000000..d8ec362 |
1086 |
+index 0000000..77f8462 |
1087 |
--- /dev/null |
1088 |
+++ b/tools/gcc/gcc-common.h |
1089 |
-@@ -0,0 +1,666 @@ |
1090 |
+@@ -0,0 +1,689 @@ |
1091 |
+#ifndef GCC_COMMON_H_INCLUDED |
1092 |
+#define GCC_COMMON_H_INCLUDED |
1093 |
+ |
1094 |
@@ -120144,6 +120439,12 @@ index 0000000..d8ec362 |
1095 |
+ return false; |
1096 |
+ } |
1097 |
+} |
1098 |
++ |
1099 |
++static inline void add_local_decl(struct function *fun, tree d) |
1100 |
++{ |
1101 |
++ gcc_assert(TREE_CODE(d) == VAR_DECL); |
1102 |
++ fun->local_decls = tree_cons(NULL_TREE, d, fun->local_decls); |
1103 |
++} |
1104 |
+#endif |
1105 |
+ |
1106 |
+#if BUILDING_GCC_VERSION <= 4006 |
1107 |
@@ -120221,6 +120522,11 @@ index 0000000..d8ec362 |
1108 |
+#define FOR_EACH_FUNCTION_WITH_GIMPLE_BODY(node) \ |
1109 |
+ for ((node) = cgraph_first_function_with_gimple_body(); (node); \ |
1110 |
+ (node) = cgraph_next_function_with_gimple_body(node)) |
1111 |
++ |
1112 |
++static inline void varpool_add_new_variable(tree decl) |
1113 |
++{ |
1114 |
++ varpool_finalize_decl(decl); |
1115 |
++} |
1116 |
+#endif |
1117 |
+ |
1118 |
+#if BUILDING_GCC_VERSION == 4006 |
1119 |
@@ -120337,8 +120643,10 @@ index 0000000..d8ec362 |
1120 |
+#define add_referenced_var(var) |
1121 |
+#define mark_sym_for_renaming(var) |
1122 |
+#define varpool_mark_needed_node(node) |
1123 |
++#define create_var_ann(var) |
1124 |
+#define TODO_dump_func 0 |
1125 |
+#define TODO_dump_cgraph 0 |
1126 |
++ |
1127 |
+#endif |
1128 |
+ |
1129 |
+#if BUILDING_GCC_VERSION <= 4009 |
1130 |
@@ -120359,6 +120667,11 @@ index 0000000..d8ec362 |
1131 |
+#if BUILDING_GCC_VERSION <= 4009 |
1132 |
+typedef struct rtx_def rtx_insn; |
1133 |
+ |
1134 |
++static inline void set_decl_section_name(tree node, const char *value) |
1135 |
++{ |
1136 |
++ DECL_SECTION_NAME(node) = build_string(strlen(value) + 1, value); |
1137 |
++} |
1138 |
++ |
1139 |
+static inline gasm *as_a_gasm(gimple stmt) |
1140 |
+{ |
1141 |
+ return stmt; |
1142 |
@@ -120455,6 +120768,11 @@ index 0000000..d8ec362 |
1143 |
+ varpool_node::finalize_decl(decl); |
1144 |
+} |
1145 |
+ |
1146 |
++static inline void varpool_add_new_variable(tree decl) |
1147 |
++{ |
1148 |
++ varpool_node::add(decl); |
1149 |
++} |
1150 |
++ |
1151 |
+static inline cgraph_node_ptr cgraph_function_node(cgraph_node_ptr node, enum availability *availability) |
1152 |
+{ |
1153 |
+ return node->function_symbol(availability); |
1154 |
@@ -120610,6 +120928,439 @@ index 0000000..7514850 |
1155 |
+ HASH=`echo -n "$SEED" | sha256sum | cut -d" " -f1 | tr -d ' \n'` |
1156 |
+ echo "#define RANDSTRUCT_HASHED_SEED \"$HASH\"" > "$2" |
1157 |
+fi |
1158 |
+diff --git a/tools/gcc/initify_plugin.c b/tools/gcc/initify_plugin.c |
1159 |
+new file mode 100644 |
1160 |
+index 0000000..125442a |
1161 |
+--- /dev/null |
1162 |
++++ b/tools/gcc/initify_plugin.c |
1163 |
+@@ -0,0 +1,427 @@ |
1164 |
++/* |
1165 |
++ * Copyright 2011-2015 by Emese Revfy <re.emese@×××××.com> |
1166 |
++ * Licensed under the GPL v2, or (at your option) v3 |
1167 |
++ * |
1168 |
++ * Homepage: |
1169 |
++ * https://github.com/ephox-gcc-plugins/initify |
1170 |
++ * |
1171 |
++ * Move string constants (__func__ and function string arguments marked by the nocapture attribute) |
1172 |
++ * only referenced in __init/__exit functions to __initconst/__exitconst sections. |
1173 |
++ * |
1174 |
++ * Usage: |
1175 |
++ * $ make |
1176 |
++ * $ make run |
1177 |
++ */ |
1178 |
++ |
1179 |
++#include "gcc-common.h" |
1180 |
++ |
1181 |
++int plugin_is_GPL_compatible; |
1182 |
++ |
1183 |
++static struct plugin_info initify_plugin_info = { |
1184 |
++ .version = "20150524a", |
1185 |
++ .help = "initify_plugin\n", |
1186 |
++}; |
1187 |
++ |
1188 |
++static tree handle_nocapture_attribute(tree *node, tree __unused name, tree args, int __unused flags, bool *no_add_attrs) |
1189 |
++{ |
1190 |
++ tree orig_attr, arg; |
1191 |
++ |
1192 |
++ *no_add_attrs = true; |
1193 |
++ switch (TREE_CODE(*node)) { |
1194 |
++ case FUNCTION_DECL: |
1195 |
++ case FUNCTION_TYPE: |
1196 |
++ case METHOD_TYPE: |
1197 |
++ break; |
1198 |
++ |
1199 |
++ case TYPE_DECL: { |
1200 |
++ const_tree fntype = TREE_TYPE(*node); |
1201 |
++ |
1202 |
++ if (TREE_CODE(fntype) == POINTER_TYPE) |
1203 |
++ fntype = TREE_TYPE(fntype); |
1204 |
++ if (TREE_CODE(fntype) == FUNCTION_TYPE || TREE_CODE(fntype) == METHOD_TYPE) |
1205 |
++ break; |
1206 |
++ // FALLTHROUGH |
1207 |
++ } |
1208 |
++ |
1209 |
++ default: |
1210 |
++ error("%s: %qE attribute only applies to functions", __func__, name); |
1211 |
++ debug_tree(*node); |
1212 |
++ return NULL_TREE; |
1213 |
++ } |
1214 |
++ |
1215 |
++ for (arg = args; arg; arg = TREE_CHAIN(arg)) { |
1216 |
++ tree position = TREE_VALUE(arg); |
1217 |
++ |
1218 |
++ if (TREE_CODE(position) != INTEGER_CST) { |
1219 |
++ error("%s: parameter isn't an integer", __func__); |
1220 |
++ debug_tree(arg); |
1221 |
++ return NULL_TREE; |
1222 |
++ } |
1223 |
++ } |
1224 |
++ |
1225 |
++ orig_attr = lookup_attribute("nocapture", DECL_ATTRIBUTES(*node)); |
1226 |
++ if (orig_attr) |
1227 |
++ chainon(TREE_VALUE(orig_attr), args); |
1228 |
++ else |
1229 |
++ *no_add_attrs = false; |
1230 |
++ |
1231 |
++ return NULL_TREE; |
1232 |
++} |
1233 |
++ |
1234 |
++static struct attribute_spec nocapture_attr = { |
1235 |
++ .name = "nocapture", |
1236 |
++ .min_length = 1, |
1237 |
++ .max_length = -1, |
1238 |
++ .decl_required = true, |
1239 |
++ .type_required = false, |
1240 |
++ .function_type_required = false, |
1241 |
++ .handler = handle_nocapture_attribute, |
1242 |
++#if BUILDING_GCC_VERSION >= 4007 |
1243 |
++ .affects_type_identity = false |
1244 |
++#endif |
1245 |
++}; |
1246 |
++ |
1247 |
++static void register_attributes(void __unused *event_data, void __unused *data) |
1248 |
++{ |
1249 |
++ register_attribute(&nocapture_attr); |
1250 |
++} |
1251 |
++ |
1252 |
++static const char *get_init_exit_section(const_tree decl) |
1253 |
++{ |
1254 |
++ const_tree section; |
1255 |
++ tree attr_value; |
1256 |
++ |
1257 |
++ section = lookup_attribute("section", DECL_ATTRIBUTES(decl)); |
1258 |
++ if (!section) |
1259 |
++ return NULL; |
1260 |
++ |
1261 |
++ gcc_assert(TREE_VALUE(section)); |
1262 |
++ for (attr_value = TREE_VALUE(section); attr_value; attr_value = TREE_CHAIN(attr_value)) { |
1263 |
++ const char *str = TREE_STRING_POINTER(TREE_VALUE(attr_value)); |
1264 |
++ |
1265 |
++ if (!strncmp(str, ".init.", 6)) |
1266 |
++ return str; |
1267 |
++ |
1268 |
++ if (!strncmp(str, ".exit.", 6)) |
1269 |
++ return str; |
1270 |
++ } |
1271 |
++ |
1272 |
++ return NULL; |
1273 |
++} |
1274 |
++ |
1275 |
++static tree get_string_cst(tree var) |
1276 |
++{ |
1277 |
++ if (var == NULL_TREE) |
1278 |
++ return NULL_TREE; |
1279 |
++ |
1280 |
++ if (TREE_CODE(var) == STRING_CST) |
1281 |
++ return var; |
1282 |
++ |
1283 |
++ switch (TREE_CODE_CLASS(TREE_CODE(var))) { |
1284 |
++ case tcc_expression: |
1285 |
++ case tcc_reference: { |
1286 |
++ int i; |
1287 |
++ |
1288 |
++ for (i = 0; i < TREE_OPERAND_LENGTH(var); i++) { |
1289 |
++ tree ret = get_string_cst(TREE_OPERAND(var, i)); |
1290 |
++ if (ret != NULL_TREE) |
1291 |
++ return ret; |
1292 |
++ } |
1293 |
++ break; |
1294 |
++ } |
1295 |
++ |
1296 |
++ default: |
1297 |
++ break; |
1298 |
++ } |
1299 |
++ |
1300 |
++ return NULL_TREE; |
1301 |
++} |
1302 |
++ |
1303 |
++static bool set_init_exit_section(tree decl, bool initexit) |
1304 |
++{ |
1305 |
++ const char *str; |
1306 |
++ |
1307 |
++ gcc_assert(DECL_P(decl)); |
1308 |
++ |
1309 |
++ str = get_init_exit_section(decl); |
1310 |
++ if (str) |
1311 |
++ return false; |
1312 |
++ |
1313 |
++ if (initexit) |
1314 |
++ set_decl_section_name(decl, ".init.rodata.str"); |
1315 |
++ else |
1316 |
++ set_decl_section_name(decl, ".exit.rodata.str"); |
1317 |
++ return true; |
1318 |
++} |
1319 |
++ |
1320 |
++static void search_local_strs(bool initexit) |
1321 |
++{ |
1322 |
++ unsigned int i; |
1323 |
++ tree var; |
1324 |
++ |
1325 |
++ FOR_EACH_LOCAL_DECL(cfun, i, var) { |
1326 |
++ tree str, init_val = DECL_INITIAL(var); |
1327 |
++ |
1328 |
++ if (init_val == NULL_TREE) |
1329 |
++ continue; |
1330 |
++ if (strcmp(DECL_NAME_POINTER(var), "__func__")) |
1331 |
++ continue; |
1332 |
++ |
1333 |
++ str = get_string_cst(init_val); |
1334 |
++ gcc_assert(str); |
1335 |
++ |
1336 |
++ if (set_init_exit_section(var, initexit)) |
1337 |
++ ;//inform(DECL_SOURCE_LOCATION(var), "initified local var: %s: %s", DECL_NAME_POINTER(current_function_decl), TREE_STRING_POINTER(str)); |
1338 |
++ } |
1339 |
++} |
1340 |
++ |
1341 |
++static tree create_tmp_assign(gcall *stmt, unsigned int num) |
1342 |
++{ |
1343 |
++ tree str, type, decl, arg = gimple_call_arg(stmt, num); |
1344 |
++ |
1345 |
++ str = get_string_cst(arg); |
1346 |
++ decl = build_decl(DECL_SOURCE_LOCATION(current_function_decl), VAR_DECL, create_tmp_var_name("cicus"), TREE_TYPE(str)); |
1347 |
++ |
1348 |
++ type = TREE_TYPE(TREE_TYPE(decl)); |
1349 |
++ TYPE_READONLY(type) = 1; |
1350 |
++ TREE_PUBLIC(type) = 0; |
1351 |
++ |
1352 |
++ DECL_INITIAL(decl) = str; |
1353 |
++ DECL_CONTEXT(decl) = current_function_decl; |
1354 |
++ DECL_ARTIFICIAL(decl) = 1; |
1355 |
++ |
1356 |
++ TREE_STATIC(decl) = 1; |
1357 |
++ TREE_READONLY(decl) = 1; |
1358 |
++ TREE_ADDRESSABLE(decl) = 1; |
1359 |
++ TREE_USED(decl) = 1; |
1360 |
++ |
1361 |
++ add_referenced_var(decl); |
1362 |
++ add_local_decl(cfun, decl); |
1363 |
++ |
1364 |
++ varpool_add_new_variable(decl); |
1365 |
++ varpool_mark_needed_node(varpool_node(decl)); |
1366 |
++ |
1367 |
++ DECL_CHAIN(decl) = BLOCK_VARS(DECL_INITIAL(current_function_decl)); |
1368 |
++ BLOCK_VARS(DECL_INITIAL (current_function_decl)) = decl; |
1369 |
++ |
1370 |
++ decl = build_unary_op(DECL_SOURCE_LOCATION(current_function_decl), ADDR_EXPR, decl, 0); |
1371 |
++ gimple_call_set_arg(stmt, num, decl); |
1372 |
++ update_stmt(stmt); |
1373 |
++ |
1374 |
++ return TREE_OPERAND(decl, 0); |
1375 |
++} |
1376 |
++ |
1377 |
++static bool is_vararg(const_tree fn) |
1378 |
++{ |
1379 |
++ tree arg_list; |
1380 |
++ |
1381 |
++ arg_list = TYPE_ARG_TYPES(TREE_TYPE(fn)); |
1382 |
++ if (arg_list == NULL_TREE) |
1383 |
++ return false; |
1384 |
++ |
1385 |
++ return tree_last(arg_list) != void_list_node; |
1386 |
++} |
1387 |
++ |
1388 |
++// __printf(1, 0), 0: turn off the varargs checking |
1389 |
++static bool check_varargs(const_tree attr) |
1390 |
++{ |
1391 |
++ const_tree attr_val; |
1392 |
++ |
1393 |
++ for (attr_val = TREE_VALUE(attr); attr_val; attr_val = TREE_CHAIN(attr_val)) { |
1394 |
++ if (TREE_VALUE(attr_val) == integer_zero_node) |
1395 |
++ return false; |
1396 |
++ } |
1397 |
++ return true; |
1398 |
++} |
1399 |
++ |
1400 |
++static bool is_in_nocapture_attr_value(const_gimple stmt, unsigned int num) |
1401 |
++{ |
1402 |
++ unsigned int attr_arg_val = 0; |
1403 |
++ tree attr_val; |
1404 |
++ const_tree attr; |
1405 |
++ const_tree fndecl = gimple_call_fndecl(stmt); |
1406 |
++ |
1407 |
++ gcc_assert(DECL_ABSTRACT_ORIGIN(fndecl) == NULL_TREE); |
1408 |
++ |
1409 |
++ attr = lookup_attribute("nocapture", DECL_ATTRIBUTES(fndecl)); |
1410 |
++ for (attr_val = TREE_VALUE(attr); attr_val; attr_val = TREE_CHAIN(attr_val)) { |
1411 |
++ attr_arg_val = (unsigned int)tree_to_uhwi(TREE_VALUE(attr_val)); |
1412 |
++ |
1413 |
++ if (attr_arg_val == num + 1) |
1414 |
++ return true; |
1415 |
++ } |
1416 |
++ |
1417 |
++ if (!is_vararg(fndecl)) |
1418 |
++ return false; |
1419 |
++ if (!check_varargs(attr)) |
1420 |
++ return false; |
1421 |
++ return attr_arg_val < num + 1; |
1422 |
++} |
1423 |
++ |
1424 |
++static void search_str_param(gcall *stmt, bool initexit) |
1425 |
++{ |
1426 |
++ unsigned int num; |
1427 |
++ |
1428 |
++ for (num = 0; num < gimple_call_num_args(stmt); num++) { |
1429 |
++ tree var, str, arg = gimple_call_arg(stmt, num); |
1430 |
++ |
1431 |
++ str = get_string_cst(arg); |
1432 |
++ if (str == NULL_TREE) |
1433 |
++ continue; |
1434 |
++ |
1435 |
++ if (!is_in_nocapture_attr_value(stmt, num)) |
1436 |
++ continue; |
1437 |
++ |
1438 |
++ var = create_tmp_assign(stmt, num); |
1439 |
++ if (set_init_exit_section(var, initexit)) |
1440 |
++ ;//inform(gimple_location(stmt), "initified function arg: %s: [%s]", DECL_NAME_POINTER(current_function_decl), TREE_STRING_POINTER(str)); |
1441 |
++ } |
1442 |
++} |
1443 |
++ |
1444 |
++static bool has_nocapture_attr(const gcall *stmt) |
1445 |
++{ |
1446 |
++ const_tree attr, fndecl = gimple_call_fndecl(stmt); |
1447 |
++ |
1448 |
++ if (fndecl == NULL_TREE) |
1449 |
++ return false; |
1450 |
++ |
1451 |
++ attr = lookup_attribute("nocapture", DECL_ATTRIBUTES(fndecl)); |
1452 |
++ return attr != NULL_TREE; |
1453 |
++} |
1454 |
++ |
1455 |
++static void search_const_strs(bool initexit) |
1456 |
++{ |
1457 |
++ basic_block bb; |
1458 |
++ |
1459 |
++ FOR_ALL_BB_FN(bb, cfun) { |
1460 |
++ gimple_stmt_iterator gsi; |
1461 |
++ |
1462 |
++ for (gsi = gsi_start_bb(bb); !gsi_end_p(gsi); gsi_next(&gsi)) { |
1463 |
++ gcall *call_stmt; |
1464 |
++ gimple stmt = gsi_stmt(gsi); |
1465 |
++ |
1466 |
++ if (!is_gimple_call(stmt)) |
1467 |
++ continue; |
1468 |
++ |
1469 |
++ call_stmt = as_a_gcall(stmt); |
1470 |
++ if (has_nocapture_attr(call_stmt)) |
1471 |
++ search_str_param(call_stmt, initexit); |
1472 |
++ } |
1473 |
++ } |
1474 |
++} |
1475 |
++ |
1476 |
++static unsigned int handle_function(void) |
1477 |
++{ |
1478 |
++ bool initexit; |
1479 |
++ const char *section = get_init_exit_section(current_function_decl); |
1480 |
++ |
1481 |
++ if (!section) |
1482 |
++ return 0; |
1483 |
++ |
1484 |
++ initexit = !strncmp(section, ".init.", 6); |
1485 |
++ search_local_strs(initexit); |
1486 |
++ search_const_strs(initexit); |
1487 |
++ |
1488 |
++ return 0; |
1489 |
++} |
1490 |
++ |
1491 |
++#if BUILDING_GCC_VERSION >= 4009 |
1492 |
++namespace { |
1493 |
++static const struct pass_data initify_plugin_pass_data = { |
1494 |
++#else |
1495 |
++static struct gimple_opt_pass initify_plugin_pass = { |
1496 |
++ .pass = { |
1497 |
++#endif |
1498 |
++ .type = GIMPLE_PASS, |
1499 |
++ .name = "initify_plugin", |
1500 |
++#if BUILDING_GCC_VERSION >= 4008 |
1501 |
++ .optinfo_flags = OPTGROUP_NONE, |
1502 |
++#endif |
1503 |
++#if BUILDING_GCC_VERSION >= 5000 |
1504 |
++#elif BUILDING_GCC_VERSION >= 4009 |
1505 |
++ .has_gate = false, |
1506 |
++ .has_execute = true, |
1507 |
++#else |
1508 |
++ .gate = NULL, |
1509 |
++ .execute = handle_function, |
1510 |
++ .sub = NULL, |
1511 |
++ .next = NULL, |
1512 |
++ .static_pass_number = 0, |
1513 |
++#endif |
1514 |
++ .tv_id = TV_NONE, |
1515 |
++ .properties_required = 0, |
1516 |
++ .properties_provided = 0, |
1517 |
++ .properties_destroyed = 0, |
1518 |
++ .todo_flags_start = 0, |
1519 |
++ .todo_flags_finish = TODO_dump_func | TODO_verify_ssa | TODO_verify_stmts | TODO_remove_unused_locals | TODO_update_ssa_no_phi | TODO_cleanup_cfg | TODO_ggc_collect | TODO_verify_flow |
1520 |
++#if BUILDING_GCC_VERSION < 4009 |
1521 |
++ } |
1522 |
++#endif |
1523 |
++}; |
1524 |
++ |
1525 |
++#if BUILDING_GCC_VERSION >= 4009 |
1526 |
++class initify_plugin_pass : public gimple_opt_pass { |
1527 |
++public: |
1528 |
++ initify_plugin_pass() : gimple_opt_pass(initify_plugin_pass_data, g) {} |
1529 |
++#if BUILDING_GCC_VERSION >= 5000 |
1530 |
++ virtual unsigned int execute(function *) { return handle_function(); } |
1531 |
++#else |
1532 |
++ unsigned int execute() { return handle_function(); } |
1533 |
++#endif |
1534 |
++}; |
1535 |
++} |
1536 |
++ |
1537 |
++static struct opt_pass *make_initify_plugin_pass(void) |
1538 |
++{ |
1539 |
++ return new initify_plugin_pass(); |
1540 |
++} |
1541 |
++#else |
1542 |
++static struct opt_pass *make_initify_plugin_pass(void) |
1543 |
++{ |
1544 |
++ return &initify_plugin_pass.pass; |
1545 |
++} |
1546 |
++#endif |
1547 |
++ |
1548 |
++static unsigned int (*old_section_type_flags)(tree decl, const char *name, int reloc); |
1549 |
++ |
1550 |
++static unsigned int initify_section_type_flags(tree decl, const char *name, int reloc) |
1551 |
++{ |
1552 |
++ if (!strcmp(name, ".init.rodata.str") || !strcmp(name, ".exit.rodata.str")) { |
1553 |
++ gcc_assert(TREE_CODE(decl) == VAR_DECL); |
1554 |
++ gcc_assert(DECL_INITIAL(decl)); |
1555 |
++ gcc_assert(TREE_CODE(DECL_INITIAL(decl)) == STRING_CST); |
1556 |
++ |
1557 |
++ return 1 | SECTION_MERGE | SECTION_STRINGS; |
1558 |
++ } |
1559 |
++ |
1560 |
++ return old_section_type_flags(decl, name, reloc); |
1561 |
++} |
1562 |
++ |
1563 |
++static void initify_start_unit(void __unused *gcc_data, void __unused *user_data) |
1564 |
++{ |
1565 |
++ old_section_type_flags = targetm.section_type_flags; |
1566 |
++ targetm.section_type_flags = initify_section_type_flags; |
1567 |
++} |
1568 |
++ |
1569 |
++int plugin_init(struct plugin_name_args *plugin_info, struct plugin_gcc_version *version) |
1570 |
++{ |
1571 |
++ const char * const plugin_name = plugin_info->base_name; |
1572 |
++ struct register_pass_info initify_plugin_pass_info; |
1573 |
++ |
1574 |
++ initify_plugin_pass_info.pass = make_initify_plugin_pass(); |
1575 |
++ initify_plugin_pass_info.reference_pass_name = "nrv"; |
1576 |
++ initify_plugin_pass_info.ref_pass_instance_number = 1; |
1577 |
++ initify_plugin_pass_info.pos_op = PASS_POS_INSERT_AFTER; |
1578 |
++ |
1579 |
++ if (!plugin_default_version_check(version, &gcc_version)) { |
1580 |
++ error(G_("incompatible gcc/plugin versions")); |
1581 |
++ return 1; |
1582 |
++ } |
1583 |
++ |
1584 |
++ register_callback(plugin_name, PLUGIN_INFO, NULL, &initify_plugin_info); |
1585 |
++ register_callback(plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &initify_plugin_pass_info); |
1586 |
++ register_callback(plugin_name, PLUGIN_ATTRIBUTES, register_attributes, NULL); |
1587 |
++ register_callback(plugin_name, PLUGIN_START_UNIT, initify_start_unit, NULL); |
1588 |
++ |
1589 |
++ return 0; |
1590 |
++} |
1591 |
diff --git a/tools/gcc/kallocstat_plugin.c b/tools/gcc/kallocstat_plugin.c |
1592 |
new file mode 100644 |
1593 |
index 0000000..457d54e |