1 |
commit: 3e678adc57099bd7bd7b6b67f97cc88826db452d |
2 |
Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri May 1 17:55:27 2015 +0000 |
4 |
Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri May 1 17:55:27 2015 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/hardened-patchset.git/commit/?id=3e678adc |
7 |
|
8 |
Grsec/PaX: 3.1-{3.2.68,3.14.40,3.19.6}-201504302119 |
9 |
|
10 |
3.14.40/0000_README | 2 +- |
11 |
...4420_grsecurity-3.1-3.14.40-201504302118.patch} | 917 +++++++++++++-- |
12 |
3.19.6/0000_README | 2 +- |
13 |
... 4420_grsecurity-3.1-3.19.6-201504302119.patch} | 1221 ++++++++++++++++---- |
14 |
3.2.68/0000_README | 2 +- |
15 |
... 4420_grsecurity-3.1-3.2.68-201504302116.patch} | 811 +++++++++++-- |
16 |
6 files changed, 2542 insertions(+), 413 deletions(-) |
17 |
|
18 |
diff --git a/3.14.40/0000_README b/3.14.40/0000_README |
19 |
index 79dc6c4..4907942 100644 |
20 |
--- a/3.14.40/0000_README |
21 |
+++ b/3.14.40/0000_README |
22 |
@@ -6,7 +6,7 @@ Patch: 1039_linux-3.14.40.patch |
23 |
From: http://www.kernel.org |
24 |
Desc: Linux 3.14.40 |
25 |
|
26 |
-Patch: 4420_grsecurity-3.1-3.14.40-201504290821.patch |
27 |
+Patch: 4420_grsecurity-3.1-3.14.40-201504302118.patch |
28 |
From: http://www.grsecurity.net |
29 |
Desc: hardened-sources base patch from upstream grsecurity |
30 |
|
31 |
|
32 |
diff --git a/3.14.40/4420_grsecurity-3.1-3.14.40-201504290821.patch b/3.14.40/4420_grsecurity-3.1-3.14.40-201504302118.patch |
33 |
similarity index 99% |
34 |
rename from 3.14.40/4420_grsecurity-3.1-3.14.40-201504290821.patch |
35 |
rename to 3.14.40/4420_grsecurity-3.1-3.14.40-201504302118.patch |
36 |
index 47246da..59db1dc 100644 |
37 |
--- a/3.14.40/4420_grsecurity-3.1-3.14.40-201504290821.patch |
38 |
+++ b/3.14.40/4420_grsecurity-3.1-3.14.40-201504302118.patch |
39 |
@@ -17533,7 +17533,7 @@ index 775873d..04cd306 100644 |
40 |
|
41 |
#include <asm-generic/memory_model.h> |
42 |
diff --git a/arch/x86/include/asm/page_64.h b/arch/x86/include/asm/page_64.h |
43 |
-index 0f1ddee..e2fc3d1 100644 |
44 |
+index 0f1ddee..7ce1ad2 100644 |
45 |
--- a/arch/x86/include/asm/page_64.h |
46 |
+++ b/arch/x86/include/asm/page_64.h |
47 |
@@ -7,9 +7,9 @@ |
48 |
@@ -17548,6 +17548,17 @@ index 0f1ddee..e2fc3d1 100644 |
49 |
{ |
50 |
unsigned long y = x - __START_KERNEL_map; |
51 |
|
52 |
+@@ -20,8 +20,8 @@ static inline unsigned long __phys_addr_nodebug(unsigned long x) |
53 |
+ } |
54 |
+ |
55 |
+ #ifdef CONFIG_DEBUG_VIRTUAL |
56 |
+-extern unsigned long __phys_addr(unsigned long); |
57 |
+-extern unsigned long __phys_addr_symbol(unsigned long); |
58 |
++extern unsigned long __intentional_overflow(-1) __phys_addr(unsigned long); |
59 |
++extern unsigned long __intentional_overflow(-1) __phys_addr_symbol(unsigned long); |
60 |
+ #else |
61 |
+ #define __phys_addr(x) __phys_addr_nodebug(x) |
62 |
+ #define __phys_addr_symbol(x) \ |
63 |
diff --git a/arch/x86/include/asm/page_64_types.h b/arch/x86/include/asm/page_64_types.h |
64 |
index d54d1ee..75450b2 100644 |
65 |
--- a/arch/x86/include/asm/page_64_types.h |
66 |
@@ -19565,7 +19576,7 @@ index 04905bf..1178cdf 100644 |
67 |
} |
68 |
|
69 |
diff --git a/arch/x86/include/asm/uaccess.h b/arch/x86/include/asm/uaccess.h |
70 |
-index 0d592e0..526f797 100644 |
71 |
+index 0d592e0..a9e3d4a 100644 |
72 |
--- a/arch/x86/include/asm/uaccess.h |
73 |
+++ b/arch/x86/include/asm/uaccess.h |
74 |
@@ -7,6 +7,7 @@ |
75 |
@@ -19628,7 +19639,24 @@ index 0d592e0..526f797 100644 |
76 |
|
77 |
/* |
78 |
* The exception table consists of pairs of addresses relative to the |
79 |
-@@ -176,10 +210,12 @@ __typeof__(__builtin_choose_expr(sizeof(x) > sizeof(0UL), 0ULL, 0UL)) |
80 |
+@@ -134,11 +168,13 @@ extern int __get_user_8(void); |
81 |
+ extern int __get_user_bad(void); |
82 |
+ |
83 |
+ /* |
84 |
+- * This is a type: either unsigned long, if the argument fits into |
85 |
+- * that type, or otherwise unsigned long long. |
86 |
++ * This is a type: either (un)signed int, if the argument fits into |
87 |
++ * that type, or otherwise (un)signed long long. |
88 |
+ */ |
89 |
+ #define __inttype(x) \ |
90 |
+-__typeof__(__builtin_choose_expr(sizeof(x) > sizeof(0UL), 0ULL, 0UL)) |
91 |
++__typeof__(__builtin_choose_expr(sizeof(x) > sizeof(0U), \ |
92 |
++ __builtin_choose_expr(__type_is_unsigned(__typeof__(x)), 0ULL, 0LL),\ |
93 |
++ __builtin_choose_expr(__type_is_unsigned(__typeof__(x)), 0U, 0))) |
94 |
+ |
95 |
+ /** |
96 |
+ * get_user: - Get a simple variable from user space. |
97 |
+@@ -176,10 +212,12 @@ __typeof__(__builtin_choose_expr(sizeof(x) > sizeof(0UL), 0ULL, 0UL)) |
98 |
register __inttype(*(ptr)) __val_gu asm("%"_ASM_DX); \ |
99 |
__chk_user_ptr(ptr); \ |
100 |
might_fault(); \ |
101 |
@@ -19641,7 +19669,7 @@ index 0d592e0..526f797 100644 |
102 |
__ret_gu; \ |
103 |
}) |
104 |
|
105 |
-@@ -187,13 +223,21 @@ __typeof__(__builtin_choose_expr(sizeof(x) > sizeof(0UL), 0ULL, 0UL)) |
106 |
+@@ -187,13 +225,21 @@ __typeof__(__builtin_choose_expr(sizeof(x) > sizeof(0UL), 0ULL, 0UL)) |
107 |
asm volatile("call __put_user_" #size : "=a" (__ret_pu) \ |
108 |
: "0" ((typeof(*(ptr)))(x)), "c" (ptr) : "ebx") |
109 |
|
110 |
@@ -19666,7 +19694,7 @@ index 0d592e0..526f797 100644 |
111 |
"3: " ASM_CLAC "\n" \ |
112 |
".section .fixup,\"ax\"\n" \ |
113 |
"4: movl %3,%0\n" \ |
114 |
-@@ -206,8 +250,8 @@ __typeof__(__builtin_choose_expr(sizeof(x) > sizeof(0UL), 0ULL, 0UL)) |
115 |
+@@ -206,8 +252,8 @@ __typeof__(__builtin_choose_expr(sizeof(x) > sizeof(0UL), 0ULL, 0UL)) |
116 |
|
117 |
#define __put_user_asm_ex_u64(x, addr) \ |
118 |
asm volatile(ASM_STAC "\n" \ |
119 |
@@ -19677,7 +19705,7 @@ index 0d592e0..526f797 100644 |
120 |
"3: " ASM_CLAC "\n" \ |
121 |
_ASM_EXTABLE_EX(1b, 2b) \ |
122 |
_ASM_EXTABLE_EX(2b, 3b) \ |
123 |
-@@ -257,7 +301,8 @@ extern void __put_user_8(void); |
124 |
+@@ -257,7 +303,8 @@ extern void __put_user_8(void); |
125 |
__typeof__(*(ptr)) __pu_val; \ |
126 |
__chk_user_ptr(ptr); \ |
127 |
might_fault(); \ |
128 |
@@ -19687,7 +19715,7 @@ index 0d592e0..526f797 100644 |
129 |
switch (sizeof(*(ptr))) { \ |
130 |
case 1: \ |
131 |
__put_user_x(1, __pu_val, ptr, __ret_pu); \ |
132 |
-@@ -275,6 +320,7 @@ extern void __put_user_8(void); |
133 |
+@@ -275,6 +322,7 @@ extern void __put_user_8(void); |
134 |
__put_user_x(X, __pu_val, ptr, __ret_pu); \ |
135 |
break; \ |
136 |
} \ |
137 |
@@ -19695,7 +19723,7 @@ index 0d592e0..526f797 100644 |
138 |
__ret_pu; \ |
139 |
}) |
140 |
|
141 |
-@@ -355,8 +401,10 @@ do { \ |
142 |
+@@ -355,8 +403,10 @@ do { \ |
143 |
} while (0) |
144 |
|
145 |
#define __get_user_asm(x, addr, err, itype, rtype, ltype, errret) \ |
146 |
@@ -19707,7 +19735,7 @@ index 0d592e0..526f797 100644 |
147 |
"2: " ASM_CLAC "\n" \ |
148 |
".section .fixup,\"ax\"\n" \ |
149 |
"3: mov %3,%0\n" \ |
150 |
-@@ -364,8 +412,10 @@ do { \ |
151 |
+@@ -364,8 +414,10 @@ do { \ |
152 |
" jmp 2b\n" \ |
153 |
".previous\n" \ |
154 |
_ASM_EXTABLE(1b, 3b) \ |
155 |
@@ -19720,7 +19748,7 @@ index 0d592e0..526f797 100644 |
156 |
|
157 |
#define __get_user_size_ex(x, ptr, size) \ |
158 |
do { \ |
159 |
-@@ -389,7 +439,7 @@ do { \ |
160 |
+@@ -389,7 +441,7 @@ do { \ |
161 |
} while (0) |
162 |
|
163 |
#define __get_user_asm_ex(x, addr, itype, rtype, ltype) \ |
164 |
@@ -19729,7 +19757,7 @@ index 0d592e0..526f797 100644 |
165 |
"2:\n" \ |
166 |
_ASM_EXTABLE_EX(1b, 2b) \ |
167 |
: ltype(x) : "m" (__m(addr))) |
168 |
-@@ -406,13 +456,24 @@ do { \ |
169 |
+@@ -406,13 +458,24 @@ do { \ |
170 |
int __gu_err; \ |
171 |
unsigned long __gu_val; \ |
172 |
__get_user_size(__gu_val, (ptr), (size), __gu_err, -EFAULT); \ |
173 |
@@ -19756,7 +19784,7 @@ index 0d592e0..526f797 100644 |
174 |
|
175 |
/* |
176 |
* Tell gcc we read from memory instead of writing: this is because |
177 |
-@@ -420,8 +481,10 @@ struct __large_struct { unsigned long buf[100]; }; |
178 |
+@@ -420,8 +483,10 @@ struct __large_struct { unsigned long buf[100]; }; |
179 |
* aliasing issues. |
180 |
*/ |
181 |
#define __put_user_asm(x, addr, err, itype, rtype, ltype, errret) \ |
182 |
@@ -19768,7 +19796,7 @@ index 0d592e0..526f797 100644 |
183 |
"2: " ASM_CLAC "\n" \ |
184 |
".section .fixup,\"ax\"\n" \ |
185 |
"3: mov %3,%0\n" \ |
186 |
-@@ -429,10 +492,12 @@ struct __large_struct { unsigned long buf[100]; }; |
187 |
+@@ -429,10 +494,12 @@ struct __large_struct { unsigned long buf[100]; }; |
188 |
".previous\n" \ |
189 |
_ASM_EXTABLE(1b, 3b) \ |
190 |
: "=r"(err) \ |
191 |
@@ -19783,7 +19811,7 @@ index 0d592e0..526f797 100644 |
192 |
"2:\n" \ |
193 |
_ASM_EXTABLE_EX(1b, 2b) \ |
194 |
: : ltype(x), "m" (__m(addr))) |
195 |
-@@ -442,11 +507,13 @@ struct __large_struct { unsigned long buf[100]; }; |
196 |
+@@ -442,11 +509,13 @@ struct __large_struct { unsigned long buf[100]; }; |
197 |
*/ |
198 |
#define uaccess_try do { \ |
199 |
current_thread_info()->uaccess_err = 0; \ |
200 |
@@ -19797,7 +19825,7 @@ index 0d592e0..526f797 100644 |
201 |
(err) |= (current_thread_info()->uaccess_err ? -EFAULT : 0); \ |
202 |
} while (0) |
203 |
|
204 |
-@@ -471,8 +538,12 @@ struct __large_struct { unsigned long buf[100]; }; |
205 |
+@@ -471,8 +540,12 @@ struct __large_struct { unsigned long buf[100]; }; |
206 |
* On error, the variable @x is set to zero. |
207 |
*/ |
208 |
|
209 |
@@ -19810,7 +19838,7 @@ index 0d592e0..526f797 100644 |
210 |
|
211 |
/** |
212 |
* __put_user: - Write a simple value into user space, with less checking. |
213 |
-@@ -494,8 +565,12 @@ struct __large_struct { unsigned long buf[100]; }; |
214 |
+@@ -494,8 +567,12 @@ struct __large_struct { unsigned long buf[100]; }; |
215 |
* Returns zero on success, or -EFAULT on error. |
216 |
*/ |
217 |
|
218 |
@@ -19823,7 +19851,7 @@ index 0d592e0..526f797 100644 |
219 |
|
220 |
#define __get_user_unaligned __get_user |
221 |
#define __put_user_unaligned __put_user |
222 |
-@@ -513,7 +588,7 @@ struct __large_struct { unsigned long buf[100]; }; |
223 |
+@@ -513,7 +590,7 @@ struct __large_struct { unsigned long buf[100]; }; |
224 |
#define get_user_ex(x, ptr) do { \ |
225 |
unsigned long __gue_val; \ |
226 |
__get_user_size_ex((__gue_val), (ptr), (sizeof(*(ptr)))); \ |
227 |
@@ -19832,7 +19860,7 @@ index 0d592e0..526f797 100644 |
228 |
} while (0) |
229 |
|
230 |
#define put_user_try uaccess_try |
231 |
-@@ -542,18 +617,19 @@ extern void __cmpxchg_wrong_size(void) |
232 |
+@@ -542,18 +619,19 @@ extern void __cmpxchg_wrong_size(void) |
233 |
__typeof__(ptr) __uval = (uval); \ |
234 |
__typeof__(*(ptr)) __old = (old); \ |
235 |
__typeof__(*(ptr)) __new = (new); \ |
236 |
@@ -19854,7 +19882,7 @@ index 0d592e0..526f797 100644 |
237 |
: "i" (-EFAULT), "q" (__new), "1" (__old) \ |
238 |
: "memory" \ |
239 |
); \ |
240 |
-@@ -562,14 +638,14 @@ extern void __cmpxchg_wrong_size(void) |
241 |
+@@ -562,14 +640,14 @@ extern void __cmpxchg_wrong_size(void) |
242 |
case 2: \ |
243 |
{ \ |
244 |
asm volatile("\t" ASM_STAC "\n" \ |
245 |
@@ -19871,7 +19899,7 @@ index 0d592e0..526f797 100644 |
246 |
: "i" (-EFAULT), "r" (__new), "1" (__old) \ |
247 |
: "memory" \ |
248 |
); \ |
249 |
-@@ -578,14 +654,14 @@ extern void __cmpxchg_wrong_size(void) |
250 |
+@@ -578,14 +656,14 @@ extern void __cmpxchg_wrong_size(void) |
251 |
case 4: \ |
252 |
{ \ |
253 |
asm volatile("\t" ASM_STAC "\n" \ |
254 |
@@ -19888,7 +19916,7 @@ index 0d592e0..526f797 100644 |
255 |
: "i" (-EFAULT), "r" (__new), "1" (__old) \ |
256 |
: "memory" \ |
257 |
); \ |
258 |
-@@ -597,14 +673,14 @@ extern void __cmpxchg_wrong_size(void) |
259 |
+@@ -597,14 +675,14 @@ extern void __cmpxchg_wrong_size(void) |
260 |
__cmpxchg_wrong_size(); \ |
261 |
\ |
262 |
asm volatile("\t" ASM_STAC "\n" \ |
263 |
@@ -19905,7 +19933,7 @@ index 0d592e0..526f797 100644 |
264 |
: "i" (-EFAULT), "r" (__new), "1" (__old) \ |
265 |
: "memory" \ |
266 |
); \ |
267 |
-@@ -613,6 +689,7 @@ extern void __cmpxchg_wrong_size(void) |
268 |
+@@ -613,6 +691,7 @@ extern void __cmpxchg_wrong_size(void) |
269 |
default: \ |
270 |
__cmpxchg_wrong_size(); \ |
271 |
} \ |
272 |
@@ -19913,7 +19941,7 @@ index 0d592e0..526f797 100644 |
273 |
*__uval = __old; \ |
274 |
__ret; \ |
275 |
}) |
276 |
-@@ -636,17 +713,6 @@ extern struct movsl_mask { |
277 |
+@@ -636,17 +715,6 @@ extern struct movsl_mask { |
278 |
|
279 |
#define ARCH_HAS_NOCACHE_UACCESS 1 |
280 |
|
281 |
@@ -19931,7 +19959,7 @@ index 0d592e0..526f797 100644 |
282 |
#ifdef CONFIG_DEBUG_STRICT_USER_COPY_CHECKS |
283 |
# define copy_user_diag __compiletime_error |
284 |
#else |
285 |
-@@ -656,7 +722,7 @@ unsigned long __must_check _copy_to_user(void __user *to, const void *from, |
286 |
+@@ -656,7 +724,7 @@ unsigned long __must_check _copy_to_user(void __user *to, const void *from, |
287 |
extern void copy_user_diag("copy_from_user() buffer size is too small") |
288 |
copy_from_user_overflow(void); |
289 |
extern void copy_user_diag("copy_to_user() buffer size is too small") |
290 |
@@ -19940,7 +19968,7 @@ index 0d592e0..526f797 100644 |
291 |
|
292 |
#undef copy_user_diag |
293 |
|
294 |
-@@ -669,7 +735,7 @@ __copy_from_user_overflow(void) __asm__("copy_from_user_overflow"); |
295 |
+@@ -669,7 +737,7 @@ __copy_from_user_overflow(void) __asm__("copy_from_user_overflow"); |
296 |
|
297 |
extern void |
298 |
__compiletime_warning("copy_to_user() buffer size is not provably correct") |
299 |
@@ -19949,7 +19977,7 @@ index 0d592e0..526f797 100644 |
300 |
#define __copy_to_user_overflow(size, count) __copy_to_user_overflow() |
301 |
|
302 |
#else |
303 |
-@@ -684,10 +750,16 @@ __copy_from_user_overflow(int size, unsigned long count) |
304 |
+@@ -684,10 +752,16 @@ __copy_from_user_overflow(int size, unsigned long count) |
305 |
|
306 |
#endif |
307 |
|
308 |
@@ -19967,7 +19995,7 @@ index 0d592e0..526f797 100644 |
309 |
|
310 |
might_fault(); |
311 |
|
312 |
-@@ -709,12 +781,15 @@ copy_from_user(void *to, const void __user *from, unsigned long n) |
313 |
+@@ -709,12 +783,15 @@ copy_from_user(void *to, const void __user *from, unsigned long n) |
314 |
* case, and do only runtime checking for non-constant sizes. |
315 |
*/ |
316 |
|
317 |
@@ -19989,7 +20017,7 @@ index 0d592e0..526f797 100644 |
318 |
|
319 |
return n; |
320 |
} |
321 |
-@@ -722,17 +797,18 @@ copy_from_user(void *to, const void __user *from, unsigned long n) |
322 |
+@@ -722,17 +799,18 @@ copy_from_user(void *to, const void __user *from, unsigned long n) |
323 |
static inline unsigned long __must_check |
324 |
copy_to_user(void __user *to, const void *from, unsigned long n) |
325 |
{ |
326 |
@@ -20890,7 +20918,7 @@ index c552247..587a316 100644 |
327 |
.name = "es7000", |
328 |
.probe = probe_es7000, |
329 |
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c |
330 |
-index 6ad4658..38a7b5c 100644 |
331 |
+index 6ad4658..5450d96 100644 |
332 |
--- a/arch/x86/kernel/apic/io_apic.c |
333 |
+++ b/arch/x86/kernel/apic/io_apic.c |
334 |
@@ -1057,7 +1057,7 @@ int IO_APIC_get_PCI_irq_vector(int bus, int slot, int pin, |
335 |
@@ -20929,6 +20957,24 @@ index 6ad4658..38a7b5c 100644 |
336 |
|
337 |
eoi_ioapic_irq(irq, cfg); |
338 |
} |
339 |
+@@ -2513,7 +2513,7 @@ static void ack_apic_level(struct irq_data *data) |
340 |
+ ioapic_irqd_unmask(data, cfg, masked); |
341 |
+ } |
342 |
+ |
343 |
+-static struct irq_chip ioapic_chip __read_mostly = { |
344 |
++static struct irq_chip ioapic_chip = { |
345 |
+ .name = "IO-APIC", |
346 |
+ .irq_startup = startup_ioapic_irq, |
347 |
+ .irq_mask = mask_ioapic_irq, |
348 |
+@@ -2582,7 +2582,7 @@ static void ack_lapic_irq(struct irq_data *data) |
349 |
+ ack_APIC_irq(); |
350 |
+ } |
351 |
+ |
352 |
+-static struct irq_chip lapic_chip __read_mostly = { |
353 |
++static struct irq_chip lapic_chip = { |
354 |
+ .name = "local-APIC", |
355 |
+ .irq_mask = mask_lapic_irq, |
356 |
+ .irq_unmask = unmask_lapic_irq, |
357 |
diff --git a/arch/x86/kernel/apic/numaq_32.c b/arch/x86/kernel/apic/numaq_32.c |
358 |
index 1e42e8f..daacf44 100644 |
359 |
--- a/arch/x86/kernel/apic/numaq_32.c |
360 |
@@ -21018,7 +21064,7 @@ index d263b13..963258b 100644 |
361 |
.name = "UV large system", |
362 |
.probe = uv_probe, |
363 |
diff --git a/arch/x86/kernel/apm_32.c b/arch/x86/kernel/apm_32.c |
364 |
-index 3ab0343..814c4787 100644 |
365 |
+index 3ab0343..26bdc88 100644 |
366 |
--- a/arch/x86/kernel/apm_32.c |
367 |
+++ b/arch/x86/kernel/apm_32.c |
368 |
@@ -433,7 +433,7 @@ static DEFINE_MUTEX(apm_mutex); |
369 |
@@ -21076,6 +21122,15 @@ index 3ab0343..814c4787 100644 |
370 |
put_cpu(); |
371 |
return error; |
372 |
} |
373 |
+@@ -2052,7 +2066,7 @@ static int __init swab_apm_power_in_minutes(const struct dmi_system_id *d) |
374 |
+ return 0; |
375 |
+ } |
376 |
+ |
377 |
+-static struct dmi_system_id __initdata apm_dmi_table[] = { |
378 |
++static const struct dmi_system_id __initconst apm_dmi_table[] = { |
379 |
+ { |
380 |
+ print_if_true, |
381 |
+ KERN_WARNING "IBM T23 - BIOS 1.03b+ and controller firmware 1.02+ may be needed for Linux APM.", |
382 |
@@ -2362,12 +2376,15 @@ static int __init apm_init(void) |
383 |
* code to that CPU. |
384 |
*/ |
385 |
@@ -27011,7 +27066,7 @@ index 2f355d2..e75ed0a 100644 |
386 |
|
387 |
return ret; |
388 |
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c |
389 |
-index a6aa91f..74ba85d 100644 |
390 |
+index a6aa91f..257fea9 100644 |
391 |
--- a/arch/x86/kernel/reboot.c |
392 |
+++ b/arch/x86/kernel/reboot.c |
393 |
@@ -68,6 +68,11 @@ static int __init set_bios_reboot(const struct dmi_system_id *d) |
394 |
@@ -27057,6 +27112,15 @@ index a6aa91f..74ba85d 100644 |
395 |
"rm" (real_mode_header->machine_real_restart_asm), |
396 |
"a" (type)); |
397 |
#else |
398 |
+@@ -135,7 +162,7 @@ static int __init set_kbd_reboot(const struct dmi_system_id *d) |
399 |
+ /* |
400 |
+ * This is a single dmi_table handling all reboot quirks. |
401 |
+ */ |
402 |
+-static struct dmi_system_id __initdata reboot_dmi_table[] = { |
403 |
++static const struct dmi_system_id __initconst reboot_dmi_table[] = { |
404 |
+ |
405 |
+ /* Acer */ |
406 |
+ { /* Handle reboot issue on Acer Aspire one */ |
407 |
@@ -480,7 +507,7 @@ void __attribute__((weak)) mach_reboot_fixups(void) |
408 |
* try to force a triple fault and then cycle between hitting the keyboard |
409 |
* controller and doing that |
410 |
@@ -33821,7 +33885,7 @@ index 9f0614d..92ae64a 100644 |
411 |
p += get_opcode(p, &opcode); |
412 |
for (i = 0; i < ARRAY_SIZE(imm_wop); i++) |
413 |
diff --git a/arch/x86/mm/pgtable.c b/arch/x86/mm/pgtable.c |
414 |
-index 0004ac7..2ab49d0 100644 |
415 |
+index 0004ac7..b953d7b 100644 |
416 |
--- a/arch/x86/mm/pgtable.c |
417 |
+++ b/arch/x86/mm/pgtable.c |
418 |
@@ -97,10 +97,71 @@ static inline void pgd_list_del(pgd_t *pgd) |
419 |
@@ -33874,7 +33938,7 @@ index 0004ac7..2ab49d0 100644 |
420 |
+#define pyd_t pgd_t |
421 |
+#define paravirt_release_pxd(pfn) paravirt_release_pud(pfn) |
422 |
+#define pgtable_pxd_page_ctor(page) true |
423 |
-+#define pgtable_pxd_page_dtor(page) |
424 |
++#define pgtable_pxd_page_dtor(page) do {} while (0) |
425 |
+#define pxd_free(mm, pud) pud_free((mm), (pud)) |
426 |
+#define pyd_populate(mm, pgd, pud) pgd_populate((mm), (pgd), (pud)) |
427 |
+#define pyd_offset(mm, address) pgd_offset((mm), (address)) |
428 |
@@ -36940,6 +37004,23 @@ index 253db94..7ee5a04 100644 |
429 |
|
430 |
return 0; |
431 |
} |
432 |
+diff --git a/crypto/zlib.c b/crypto/zlib.c |
433 |
+index d980788..2422b3d 100644 |
434 |
+--- a/crypto/zlib.c |
435 |
++++ b/crypto/zlib.c |
436 |
+@@ -95,10 +95,10 @@ static int zlib_compress_setup(struct crypto_pcomp *tfm, void *params, |
437 |
+ zlib_comp_exit(ctx); |
438 |
+ |
439 |
+ window_bits = tb[ZLIB_COMP_WINDOWBITS] |
440 |
+- ? nla_get_u32(tb[ZLIB_COMP_WINDOWBITS]) |
441 |
++ ? nla_get_s32(tb[ZLIB_COMP_WINDOWBITS]) |
442 |
+ : MAX_WBITS; |
443 |
+ mem_level = tb[ZLIB_COMP_MEMLEVEL] |
444 |
+- ? nla_get_u32(tb[ZLIB_COMP_MEMLEVEL]) |
445 |
++ ? nla_get_s32(tb[ZLIB_COMP_MEMLEVEL]) |
446 |
+ : DEF_MEM_LEVEL; |
447 |
+ |
448 |
+ workspacesize = zlib_deflate_workspacesize(window_bits, mem_level); |
449 |
diff --git a/drivers/acpi/acpica/hwxfsleep.c b/drivers/acpi/acpica/hwxfsleep.c |
450 |
index 15dddc1..b61cf0c 100644 |
451 |
--- a/drivers/acpi/acpica/hwxfsleep.c |
452 |
@@ -37036,6 +37117,28 @@ index 3d8413d..95f638c 100644 |
453 |
{ |
454 |
.callback = dmi_disable_osi_vista, |
455 |
.ident = "Fujitsu Siemens", |
456 |
+diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c |
457 |
+index b48aefa..91b17ef 100644 |
458 |
+--- a/drivers/acpi/bus.c |
459 |
++++ b/drivers/acpi/bus.c |
460 |
+@@ -67,7 +67,7 @@ static int set_copy_dsdt(const struct dmi_system_id *id) |
461 |
+ } |
462 |
+ #endif |
463 |
+ |
464 |
+-static struct dmi_system_id dsdt_dmi_table[] __initdata = { |
465 |
++static const struct dmi_system_id dsdt_dmi_table[] __initconst = { |
466 |
+ /* |
467 |
+ * Invoke DSDT corruption work-around on all Toshiba Satellite. |
468 |
+ * https://bugzilla.kernel.org/show_bug.cgi?id=14679 |
469 |
+@@ -83,7 +83,7 @@ static struct dmi_system_id dsdt_dmi_table[] __initdata = { |
470 |
+ {} |
471 |
+ }; |
472 |
+ #else |
473 |
+-static struct dmi_system_id dsdt_dmi_table[] __initdata = { |
474 |
++static const struct dmi_system_id dsdt_dmi_table[] __initconst = { |
475 |
+ {} |
476 |
+ }; |
477 |
+ #endif |
478 |
diff --git a/drivers/acpi/custom_method.c b/drivers/acpi/custom_method.c |
479 |
index c68e724..e863008 100644 |
480 |
--- a/drivers/acpi/custom_method.c |
481 |
@@ -37051,6 +37154,58 @@ index c68e724..e863008 100644 |
482 |
if (!(*ppos)) { |
483 |
/* parse the table header to get the table length */ |
484 |
if (count <= sizeof(struct acpi_table_header)) |
485 |
+diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c |
486 |
+index 49d8990..500b5ffe 100644 |
487 |
+--- a/drivers/acpi/ec.c |
488 |
++++ b/drivers/acpi/ec.c |
489 |
+@@ -978,7 +978,7 @@ static int ec_clear_on_resume(const struct dmi_system_id *id) |
490 |
+ return 0; |
491 |
+ } |
492 |
+ |
493 |
+-static struct dmi_system_id ec_dmi_table[] __initdata = { |
494 |
++static const struct dmi_system_id ec_dmi_table[] __initconst = { |
495 |
+ { |
496 |
+ ec_skip_dsdt_scan, "Compal JFL92", { |
497 |
+ DMI_MATCH(DMI_BIOS_VENDOR, "COMPAL"), |
498 |
+diff --git a/drivers/acpi/pci_slot.c b/drivers/acpi/pci_slot.c |
499 |
+index 139d9e4..9a9d799 100644 |
500 |
+--- a/drivers/acpi/pci_slot.c |
501 |
++++ b/drivers/acpi/pci_slot.c |
502 |
+@@ -195,7 +195,7 @@ static int do_sta_before_sun(const struct dmi_system_id *d) |
503 |
+ return 0; |
504 |
+ } |
505 |
+ |
506 |
+-static struct dmi_system_id acpi_pci_slot_dmi_table[] __initdata = { |
507 |
++static const struct dmi_system_id acpi_pci_slot_dmi_table[] __initconst = { |
508 |
+ /* |
509 |
+ * Fujitsu Primequest machines will return 1023 to indicate an |
510 |
+ * error if the _SUN method is evaluated on SxFy objects that |
511 |
+diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c |
512 |
+index a4eea9a..1765579 100644 |
513 |
+--- a/drivers/acpi/processor_core.c |
514 |
++++ b/drivers/acpi/processor_core.c |
515 |
+@@ -27,7 +27,7 @@ static int __init set_no_mwait(const struct dmi_system_id *id) |
516 |
+ return 0; |
517 |
+ } |
518 |
+ |
519 |
+-static struct dmi_system_id processor_idle_dmi_table[] __initdata = { |
520 |
++static const struct dmi_system_id processor_idle_dmi_table[] __initconst = { |
521 |
+ { |
522 |
+ set_no_mwait, "Extensa 5220", { |
523 |
+ DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies LTD"), |
524 |
+diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c |
525 |
+index c1c3562..4c77729 100644 |
526 |
+--- a/drivers/acpi/processor_driver.c |
527 |
++++ b/drivers/acpi/processor_driver.c |
528 |
+@@ -153,7 +153,7 @@ static int acpi_cpu_soft_notify(struct notifier_block *nfb, |
529 |
+ return NOTIFY_OK; |
530 |
+ } |
531 |
+ |
532 |
+-static struct notifier_block __refdata acpi_cpu_notifier = { |
533 |
++static struct notifier_block __refconst acpi_cpu_notifier = { |
534 |
+ .notifier_call = acpi_cpu_soft_notify, |
535 |
+ }; |
536 |
+ |
537 |
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c |
538 |
index fd8496a..bd2c3e3 100644 |
539 |
--- a/drivers/acpi/processor_idle.c |
540 |
@@ -37064,6 +37219,19 @@ index fd8496a..bd2c3e3 100644 |
541 |
struct cpuidle_driver *drv = &acpi_idle_driver; |
542 |
|
543 |
if (!pr->flags.power_setup_done) |
544 |
+diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c |
545 |
+index c40fb2e..2c09959 100644 |
546 |
+--- a/drivers/acpi/sleep.c |
547 |
++++ b/drivers/acpi/sleep.c |
548 |
+@@ -145,7 +145,7 @@ static int __init init_nvs_nosave(const struct dmi_system_id *d) |
549 |
+ return 0; |
550 |
+ } |
551 |
+ |
552 |
+-static struct dmi_system_id acpisleep_dmi_table[] __initdata = { |
553 |
++static const struct dmi_system_id acpisleep_dmi_table[] __initconst = { |
554 |
+ { |
555 |
+ .callback = init_old_suspend_ordering, |
556 |
+ .ident = "Abit KN9 (nForce4 variant)", |
557 |
diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c |
558 |
index 91a32ce..d77fcaf 100644 |
559 |
--- a/drivers/acpi/sysfs.c |
560 |
@@ -37082,6 +37250,32 @@ index 91a32ce..d77fcaf 100644 |
561 |
|
562 |
static void delete_gpe_attr_array(void) |
563 |
{ |
564 |
+diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c |
565 |
+index 08626c8..e433906 100644 |
566 |
+--- a/drivers/acpi/thermal.c |
567 |
++++ b/drivers/acpi/thermal.c |
568 |
+@@ -1189,7 +1189,7 @@ static int thermal_psv(const struct dmi_system_id *d) { |
569 |
+ return 0; |
570 |
+ } |
571 |
+ |
572 |
+-static struct dmi_system_id thermal_dmi_table[] __initdata = { |
573 |
++static const struct dmi_system_id thermal_dmi_table[] __initconst = { |
574 |
+ /* |
575 |
+ * Award BIOS on this AOpen makes thermal control almost worthless. |
576 |
+ * http://bugzilla.kernel.org/show_bug.cgi?id=8842 |
577 |
+diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c |
578 |
+index 997540d..cebb4c5 100644 |
579 |
+--- a/drivers/acpi/video.c |
580 |
++++ b/drivers/acpi/video.c |
581 |
+@@ -413,7 +413,7 @@ static int __init video_set_use_native_backlight(const struct dmi_system_id *d) |
582 |
+ return 0; |
583 |
+ } |
584 |
+ |
585 |
+-static struct dmi_system_id video_dmi_table[] __initdata = { |
586 |
++static const struct dmi_system_id video_dmi_table[] __initconst = { |
587 |
+ /* |
588 |
+ * Broken _BQC workaround http://bugzilla.kernel.org/show_bug.cgi?id=13121 |
589 |
+ */ |
590 |
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c |
591 |
index 36605ab..6ef6d4b 100644 |
592 |
--- a/drivers/ata/libahci.c |
593 |
@@ -39328,6 +39522,19 @@ index 86fe45c..c0ea948 100644 |
594 |
return -EBUSY; |
595 |
} |
596 |
|
597 |
+diff --git a/drivers/char/i8k.c b/drivers/char/i8k.c |
598 |
+index 93dcad0..c6e53b1 100644 |
599 |
+--- a/drivers/char/i8k.c |
600 |
++++ b/drivers/char/i8k.c |
601 |
+@@ -659,7 +659,7 @@ static int __init i8k_init_hwmon(void) |
602 |
+ return 0; |
603 |
+ } |
604 |
+ |
605 |
+-static struct dmi_system_id i8k_dmi_table[] __initdata = { |
606 |
++static const struct dmi_system_id i8k_dmi_table[] __initconst = { |
607 |
+ { |
608 |
+ .ident = "Dell Inspiron", |
609 |
+ .matches = { |
610 |
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c |
611 |
index ec4e10f..f2a763b 100644 |
612 |
--- a/drivers/char/ipmi/ipmi_msghandler.c |
613 |
@@ -39717,7 +39924,7 @@ index 8a64dbe..58488cc 100644 |
614 |
|
615 |
entropy_count = *(int *)table->data >> ENTROPY_SHIFT; |
616 |
diff --git a/drivers/char/sonypi.c b/drivers/char/sonypi.c |
617 |
-index 7cc1fe22..b602d6b 100644 |
618 |
+index 7cc1fe22..e7bf59e 100644 |
619 |
--- a/drivers/char/sonypi.c |
620 |
+++ b/drivers/char/sonypi.c |
621 |
@@ -54,6 +54,7 @@ |
622 |
@@ -39758,6 +39965,15 @@ index 7cc1fe22..b602d6b 100644 |
623 |
mutex_unlock(&sonypi_device.lock); |
624 |
|
625 |
return 0; |
626 |
+@@ -1492,7 +1493,7 @@ static struct platform_driver sonypi_driver = { |
627 |
+ |
628 |
+ static struct platform_device *sonypi_platform_device; |
629 |
+ |
630 |
+-static struct dmi_system_id __initdata sonypi_dmi_table[] = { |
631 |
++static const struct dmi_system_id __initconst sonypi_dmi_table[] = { |
632 |
+ { |
633 |
+ .ident = "Sony Vaio", |
634 |
+ .matches = { |
635 |
diff --git a/drivers/char/tpm/tpm_acpi.c b/drivers/char/tpm/tpm_acpi.c |
636 |
index b9a57fa..5bb9e38 100644 |
637 |
--- a/drivers/char/tpm/tpm_acpi.c |
638 |
@@ -40789,10 +41005,45 @@ index 3dc2482..7bd2f61 100644 |
639 |
int error; |
640 |
|
641 |
/* new_var */ |
642 |
+diff --git a/drivers/firmware/efi/runtime-map.c b/drivers/firmware/efi/runtime-map.c |
643 |
+index c98b101..cc7bd25 100644 |
644 |
+--- a/drivers/firmware/efi/runtime-map.c |
645 |
++++ b/drivers/firmware/efi/runtime-map.c |
646 |
+@@ -97,7 +97,7 @@ static void map_release(struct kobject *kobj) |
647 |
+ kfree(entry); |
648 |
+ } |
649 |
+ |
650 |
+-static struct kobj_type __refdata map_ktype = { |
651 |
++static const struct kobj_type __refconst map_ktype = { |
652 |
+ .sysfs_ops = &map_attr_ops, |
653 |
+ .default_attrs = def_attrs, |
654 |
+ .release = map_release, |
655 |
+diff --git a/drivers/firmware/google/gsmi.c b/drivers/firmware/google/gsmi.c |
656 |
+index e5a67b2..77d6167 100644 |
657 |
+--- a/drivers/firmware/google/gsmi.c |
658 |
++++ b/drivers/firmware/google/gsmi.c |
659 |
+@@ -709,7 +709,7 @@ static u32 __init hash_oem_table_id(char s[8]) |
660 |
+ return local_hash_64(input, 32); |
661 |
+ } |
662 |
+ |
663 |
+-static struct dmi_system_id gsmi_dmi_table[] __initdata = { |
664 |
++static const struct dmi_system_id gsmi_dmi_table[] __initconst = { |
665 |
+ { |
666 |
+ .ident = "Google Board", |
667 |
+ .matches = { |
668 |
diff --git a/drivers/firmware/google/memconsole.c b/drivers/firmware/google/memconsole.c |
669 |
-index 2a90ba6..07f3733 100644 |
670 |
+index 2a90ba6..72379aa 100644 |
671 |
--- a/drivers/firmware/google/memconsole.c |
672 |
+++ b/drivers/firmware/google/memconsole.c |
673 |
+@@ -126,7 +126,7 @@ static bool found_memconsole(void) |
674 |
+ return false; |
675 |
+ } |
676 |
+ |
677 |
+-static struct dmi_system_id memconsole_dmi_table[] __initdata = { |
678 |
++static const struct dmi_system_id memconsole_dmi_table[] __initconst = { |
679 |
+ { |
680 |
+ .ident = "Google Board", |
681 |
+ .matches = { |
682 |
@@ -147,7 +147,9 @@ static int __init memconsole_init(void) |
683 |
if (!found_memconsole()) |
684 |
return -ENODEV; |
685 |
@@ -40804,6 +41055,19 @@ index 2a90ba6..07f3733 100644 |
686 |
|
687 |
ret = sysfs_create_bin_file(firmware_kobj, &memconsole_bin_attr); |
688 |
|
689 |
+diff --git a/drivers/firmware/memmap.c b/drivers/firmware/memmap.c |
690 |
+index 17cf96c..0b11581 100644 |
691 |
+--- a/drivers/firmware/memmap.c |
692 |
++++ b/drivers/firmware/memmap.c |
693 |
+@@ -124,7 +124,7 @@ static void __meminit release_firmware_map_entry(struct kobject *kobj) |
694 |
+ kfree(entry); |
695 |
+ } |
696 |
+ |
697 |
+-static struct kobj_type __refdata memmap_ktype = { |
698 |
++static const struct kobj_type __refconst memmap_ktype = { |
699 |
+ .release = release_firmware_map_entry, |
700 |
+ .sysfs_ops = &memmap_attr_ops, |
701 |
+ .default_attrs = def_attrs, |
702 |
diff --git a/drivers/gpio/gpio-em.c b/drivers/gpio/gpio-em.c |
703 |
index 1e98a98..b444372 100644 |
704 |
--- a/drivers/gpio/gpio-em.c |
705 |
@@ -42816,7 +43080,7 @@ index 077bb1b..d433d74 100644 |
706 |
child_device_obj->device.bus = &hv_bus; |
707 |
child_device_obj->device.parent = &hv_acpi_dev->dev; |
708 |
diff --git a/drivers/hwmon/acpi_power_meter.c b/drivers/hwmon/acpi_power_meter.c |
709 |
-index 579bdf9..75118b5 100644 |
710 |
+index 579bdf9..0dac21d5 100644 |
711 |
--- a/drivers/hwmon/acpi_power_meter.c |
712 |
+++ b/drivers/hwmon/acpi_power_meter.c |
713 |
@@ -116,7 +116,7 @@ struct sensor_template { |
714 |
@@ -42837,6 +43101,15 @@ index 579bdf9..75118b5 100644 |
715 |
&resource->sensors[resource->num_sensors]; |
716 |
int res = 0; |
717 |
|
718 |
+@@ -973,7 +973,7 @@ static int __init enable_cap_knobs(const struct dmi_system_id *d) |
719 |
+ return 0; |
720 |
+ } |
721 |
+ |
722 |
+-static struct dmi_system_id __initdata pm_dmi_table[] = { |
723 |
++static const struct dmi_system_id __initconst pm_dmi_table[] = { |
724 |
+ { |
725 |
+ enable_cap_knobs, "IBM Active Energy Manager", |
726 |
+ { |
727 |
diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c |
728 |
index 3288f13..71cfb4e 100644 |
729 |
--- a/drivers/hwmon/applesmc.c |
730 |
@@ -44235,6 +44508,19 @@ index c9a02fe..0debc75 100644 |
731 |
kref_init(&serio_raw->kref); |
732 |
INIT_LIST_HEAD(&serio_raw->client_list); |
733 |
init_waitqueue_head(&serio_raw->wait); |
734 |
+diff --git a/drivers/input/touchscreen/htcpen.c b/drivers/input/touchscreen/htcpen.c |
735 |
+index 92e2243..8fd9092 100644 |
736 |
+--- a/drivers/input/touchscreen/htcpen.c |
737 |
++++ b/drivers/input/touchscreen/htcpen.c |
738 |
+@@ -219,7 +219,7 @@ static struct isa_driver htcpen_isa_driver = { |
739 |
+ } |
740 |
+ }; |
741 |
+ |
742 |
+-static struct dmi_system_id htcshift_dmi_table[] __initdata = { |
743 |
++static const struct dmi_system_id htcshift_dmi_table[] __initconst = { |
744 |
+ { |
745 |
+ .ident = "Shift", |
746 |
+ .matches = { |
747 |
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c |
748 |
index 9cbef59..26db8e4 100644 |
749 |
--- a/drivers/iommu/amd_iommu.c |
750 |
@@ -45490,9 +45776,39 @@ index a46124e..caf0bd55 100644 |
751 |
|
752 |
rdev_dec_pending(rdev, mddev); |
753 |
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c |
754 |
-index 3545faf..2977207 100644 |
755 |
+index 3545faf..1431c5a 100644 |
756 |
--- a/drivers/md/raid5.c |
757 |
+++ b/drivers/md/raid5.c |
758 |
+@@ -942,23 +942,23 @@ async_copy_data(int frombio, struct bio *bio, struct page *page, |
759 |
+ struct bio_vec bvl; |
760 |
+ struct bvec_iter iter; |
761 |
+ struct page *bio_page; |
762 |
+- int page_offset; |
763 |
++ s64 page_offset; |
764 |
+ struct async_submit_ctl submit; |
765 |
+ enum async_tx_flags flags = 0; |
766 |
+ |
767 |
+ if (bio->bi_iter.bi_sector >= sector) |
768 |
+- page_offset = (signed)(bio->bi_iter.bi_sector - sector) * 512; |
769 |
++ page_offset = (s64)(bio->bi_iter.bi_sector - sector) * 512; |
770 |
+ else |
771 |
+- page_offset = (signed)(sector - bio->bi_iter.bi_sector) * -512; |
772 |
++ page_offset = (s64)(sector - bio->bi_iter.bi_sector) * -512; |
773 |
+ |
774 |
+ if (frombio) |
775 |
+ flags |= ASYNC_TX_FENCE; |
776 |
+ init_async_submit(&submit, flags, tx, NULL, NULL, NULL); |
777 |
+ |
778 |
+ bio_for_each_segment(bvl, bio, iter) { |
779 |
+- int len = bvl.bv_len; |
780 |
+- int clen; |
781 |
+- int b_offset = 0; |
782 |
++ s64 len = bvl.bv_len; |
783 |
++ s64 clen; |
784 |
++ s64 b_offset = 0; |
785 |
+ |
786 |
+ if (page_offset < 0) { |
787 |
+ b_offset = -page_offset; |
788 |
@@ -1711,6 +1711,10 @@ static int grow_one_stripe(struct r5conf *conf, int hash) |
789 |
return 1; |
790 |
} |
791 |
@@ -47110,6 +47426,19 @@ index d1a22aa..d0f7bf7 100644 |
792 |
static char **event_name; |
793 |
|
794 |
static u8 avg_sample = SAMPLE_16; |
795 |
+diff --git a/drivers/mfd/kempld-core.c b/drivers/mfd/kempld-core.c |
796 |
+index 2df3cbc..e4101dc 100644 |
797 |
+--- a/drivers/mfd/kempld-core.c |
798 |
++++ b/drivers/mfd/kempld-core.c |
799 |
+@@ -414,7 +414,7 @@ static struct platform_driver kempld_driver = { |
800 |
+ .remove = kempld_remove, |
801 |
+ }; |
802 |
+ |
803 |
+-static struct dmi_system_id __initdata kempld_dmi_table[] = { |
804 |
++static const struct dmi_system_id __initconst kempld_dmi_table[] = { |
805 |
+ { |
806 |
+ .ident = "BHL6", |
807 |
+ .matches = { |
808 |
diff --git a/drivers/mfd/max8925-i2c.c b/drivers/mfd/max8925-i2c.c |
809 |
index a83eed5..62a58a9 100644 |
810 |
--- a/drivers/mfd/max8925-i2c.c |
811 |
@@ -48279,6 +48608,19 @@ index 50617c5..b13724c 100644 |
812 |
} |
813 |
|
814 |
/* To mask all all interrupts.*/ |
815 |
+diff --git a/drivers/net/ethernet/via/via-rhine.c b/drivers/net/ethernet/via/via-rhine.c |
816 |
+index 6ac20a6..a0cbf82 100644 |
817 |
+--- a/drivers/net/ethernet/via/via-rhine.c |
818 |
++++ b/drivers/net/ethernet/via/via-rhine.c |
819 |
+@@ -2417,7 +2417,7 @@ static struct pci_driver rhine_driver = { |
820 |
+ .driver.pm = RHINE_PM_OPS, |
821 |
+ }; |
822 |
+ |
823 |
+-static struct dmi_system_id rhine_dmi_table[] __initdata = { |
824 |
++static const struct dmi_system_id rhine_dmi_table[] __initconst = { |
825 |
+ { |
826 |
+ .ident = "EPIA-M", |
827 |
+ .matches = { |
828 |
diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h |
829 |
index 7b594ce..1f6c5708 100644 |
830 |
--- a/drivers/net/hyperv/hyperv_net.h |
831 |
@@ -49984,6 +50326,19 @@ index e1e7026..d28dd33 100644 |
832 |
#define ASPM_STATE_L0S (ASPM_STATE_L0S_UP | ASPM_STATE_L0S_DW) |
833 |
#define ASPM_STATE_ALL (ASPM_STATE_L0S | ASPM_STATE_L1) |
834 |
|
835 |
+diff --git a/drivers/pci/pcie/portdrv_pci.c b/drivers/pci/pcie/portdrv_pci.c |
836 |
+index 0d8fdc4..271f09e 100644 |
837 |
+--- a/drivers/pci/pcie/portdrv_pci.c |
838 |
++++ b/drivers/pci/pcie/portdrv_pci.c |
839 |
+@@ -402,7 +402,7 @@ static int __init dmi_pcie_pme_disable_msi(const struct dmi_system_id *d) |
840 |
+ return 0; |
841 |
+ } |
842 |
+ |
843 |
+-static struct dmi_system_id __initdata pcie_portdrv_dmi_table[] = { |
844 |
++static const struct dmi_system_id __initconst pcie_portdrv_dmi_table[] = { |
845 |
+ /* |
846 |
+ * Boxes that should not use MSI for PCIe PME signaling. |
847 |
+ */ |
848 |
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c |
849 |
index 5b428db..553e4e3 100644 |
850 |
--- a/drivers/pci/probe.c |
851 |
@@ -50031,6 +50386,19 @@ index 7f3aad0..7d604bb 100644 |
852 |
{ |
853 |
.ident = "Samsung Series 5 550", |
854 |
.matches = { |
855 |
+diff --git a/drivers/platform/chrome/chromeos_pstore.c b/drivers/platform/chrome/chromeos_pstore.c |
856 |
+index e0e0e65..c086592 100644 |
857 |
+--- a/drivers/platform/chrome/chromeos_pstore.c |
858 |
++++ b/drivers/platform/chrome/chromeos_pstore.c |
859 |
+@@ -13,7 +13,7 @@ |
860 |
+ #include <linux/platform_device.h> |
861 |
+ #include <linux/pstore_ram.h> |
862 |
+ |
863 |
+-static struct dmi_system_id chromeos_pstore_dmi_table[] __initdata = { |
864 |
++static const struct dmi_system_id chromeos_pstore_dmi_table[] __initconst = { |
865 |
+ { |
866 |
+ /* |
867 |
+ * Today all Chromebooks/boxes ship with GOOGLE as vendor and |
868 |
diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c |
869 |
index c5e082f..d6307a0 100644 |
870 |
--- a/drivers/platform/x86/asus-wmi.c |
871 |
@@ -50068,10 +50436,71 @@ index c5e082f..d6307a0 100644 |
872 |
status = wmi_evaluate_method(ASUS_WMI_MGMT_GUID, |
873 |
1, asus->debug.method_id, |
874 |
&input, &output); |
875 |
+diff --git a/drivers/platform/x86/compal-laptop.c b/drivers/platform/x86/compal-laptop.c |
876 |
+index 7297df2..b832a73 100644 |
877 |
+--- a/drivers/platform/x86/compal-laptop.c |
878 |
++++ b/drivers/platform/x86/compal-laptop.c |
879 |
+@@ -767,7 +767,7 @@ static int dmi_check_cb_extra(const struct dmi_system_id *id) |
880 |
+ return 1; |
881 |
+ } |
882 |
+ |
883 |
+-static struct dmi_system_id __initdata compal_dmi_table[] = { |
884 |
++static const struct dmi_system_id __initconst compal_dmi_table[] = { |
885 |
+ { |
886 |
+ .ident = "FL90/IFL90", |
887 |
+ .matches = { |
888 |
+diff --git a/drivers/platform/x86/hdaps.c b/drivers/platform/x86/hdaps.c |
889 |
+index 777c7e3..11dcbce 100644 |
890 |
+--- a/drivers/platform/x86/hdaps.c |
891 |
++++ b/drivers/platform/x86/hdaps.c |
892 |
+@@ -515,7 +515,7 @@ static int __init hdaps_dmi_match_invert(const struct dmi_system_id *id) |
893 |
+ "ThinkPad T42p", so the order of the entries matters. |
894 |
+ If your ThinkPad is not recognized, please update to latest |
895 |
+ BIOS. This is especially the case for some R52 ThinkPads. */ |
896 |
+-static struct dmi_system_id __initdata hdaps_whitelist[] = { |
897 |
++static const struct dmi_system_id __initconst hdaps_whitelist[] = { |
898 |
+ HDAPS_DMI_MATCH_INVERT("IBM", "ThinkPad R50p", HDAPS_BOTH_AXES), |
899 |
+ HDAPS_DMI_MATCH_NORMAL("IBM", "ThinkPad R50"), |
900 |
+ HDAPS_DMI_MATCH_NORMAL("IBM", "ThinkPad R51"), |
901 |
+diff --git a/drivers/platform/x86/ibm_rtl.c b/drivers/platform/x86/ibm_rtl.c |
902 |
+index 97c2be1..2ee50ce 100644 |
903 |
+--- a/drivers/platform/x86/ibm_rtl.c |
904 |
++++ b/drivers/platform/x86/ibm_rtl.c |
905 |
+@@ -227,7 +227,7 @@ static void rtl_teardown_sysfs(void) { |
906 |
+ } |
907 |
+ |
908 |
+ |
909 |
+-static struct dmi_system_id __initdata ibm_rtl_dmi_table[] = { |
910 |
++static const struct dmi_system_id __initconst ibm_rtl_dmi_table[] = { |
911 |
+ { \ |
912 |
+ .matches = { \ |
913 |
+ DMI_MATCH(DMI_SYS_VENDOR, "IBM"), \ |
914 |
+diff --git a/drivers/platform/x86/intel_oaktrail.c b/drivers/platform/x86/intel_oaktrail.c |
915 |
+index 4bc9604..db855c0 100644 |
916 |
+--- a/drivers/platform/x86/intel_oaktrail.c |
917 |
++++ b/drivers/platform/x86/intel_oaktrail.c |
918 |
+@@ -300,7 +300,7 @@ static int dmi_check_cb(const struct dmi_system_id *id) |
919 |
+ return 0; |
920 |
+ } |
921 |
+ |
922 |
+-static struct dmi_system_id __initdata oaktrail_dmi_table[] = { |
923 |
++static const struct dmi_system_id __initconst oaktrail_dmi_table[] = { |
924 |
+ { |
925 |
+ .ident = "OakTrail platform", |
926 |
+ .matches = { |
927 |
diff --git a/drivers/platform/x86/msi-laptop.c b/drivers/platform/x86/msi-laptop.c |
928 |
-index 62f8030..c7f2a45 100644 |
929 |
+index 62f8030..02f93f0 100644 |
930 |
--- a/drivers/platform/x86/msi-laptop.c |
931 |
+++ b/drivers/platform/x86/msi-laptop.c |
932 |
+@@ -605,7 +605,7 @@ static int dmi_check_cb(const struct dmi_system_id *dmi) |
933 |
+ return 1; |
934 |
+ } |
935 |
+ |
936 |
+-static struct dmi_system_id __initdata msi_dmi_table[] = { |
937 |
++static const struct dmi_system_id __initconst msi_dmi_table[] = { |
938 |
+ { |
939 |
+ .ident = "MSI S270", |
940 |
+ .matches = { |
941 |
@@ -1000,12 +1000,14 @@ static int __init load_scm_model_init(struct platform_device *sdev) |
942 |
|
943 |
if (!quirks->ec_read_only) { |
944 |
@@ -50106,8 +50535,34 @@ index 70222f2..8c8ce66 100644 |
945 |
union acpi_object *obj; |
946 |
acpi_status status; |
947 |
|
948 |
+diff --git a/drivers/platform/x86/samsung-laptop.c b/drivers/platform/x86/samsung-laptop.c |
949 |
+index d1f03005..0695666 100644 |
950 |
+--- a/drivers/platform/x86/samsung-laptop.c |
951 |
++++ b/drivers/platform/x86/samsung-laptop.c |
952 |
+@@ -1435,7 +1435,7 @@ static int __init samsung_dmi_matched(const struct dmi_system_id *d) |
953 |
+ return 0; |
954 |
+ } |
955 |
+ |
956 |
+-static struct dmi_system_id __initdata samsung_dmi_table[] = { |
957 |
++static const struct dmi_system_id __initconst samsung_dmi_table[] = { |
958 |
+ { |
959 |
+ .matches = { |
960 |
+ DMI_MATCH(DMI_SYS_VENDOR, |
961 |
+diff --git a/drivers/platform/x86/samsung-q10.c b/drivers/platform/x86/samsung-q10.c |
962 |
+index 5413f62..79b83da 100644 |
963 |
+--- a/drivers/platform/x86/samsung-q10.c |
964 |
++++ b/drivers/platform/x86/samsung-q10.c |
965 |
+@@ -102,7 +102,7 @@ static int __init dmi_check_callback(const struct dmi_system_id *id) |
966 |
+ return 1; |
967 |
+ } |
968 |
+ |
969 |
+-static struct dmi_system_id __initdata samsungq10_dmi_table[] = { |
970 |
++static const struct dmi_system_id __initconst samsungq10_dmi_table[] = { |
971 |
+ { |
972 |
+ .ident = "Samsung Q10", |
973 |
+ .matches = { |
974 |
diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c |
975 |
-index 8f8551a..3ace3ca 100644 |
976 |
+index 8f8551a..5961446 100644 |
977 |
--- a/drivers/platform/x86/sony-laptop.c |
978 |
+++ b/drivers/platform/x86/sony-laptop.c |
979 |
@@ -2451,7 +2451,7 @@ static void sony_nc_gfx_switch_cleanup(struct platform_device *pd) |
980 |
@@ -50119,6 +50574,15 @@ index 8f8551a..3ace3ca 100644 |
981 |
|
982 |
static ssize_t sony_nc_highspeed_charging_store(struct device *dev, |
983 |
struct device_attribute *attr, |
984 |
+@@ -4434,7 +4434,7 @@ static struct acpi_driver sony_pic_driver = { |
985 |
+ .drv.pm = &sony_pic_pm, |
986 |
+ }; |
987 |
+ |
988 |
+-static struct dmi_system_id __initdata sonypi_dmi_table[] = { |
989 |
++static const struct dmi_system_id __initconst sonypi_dmi_table[] = { |
990 |
+ { |
991 |
+ .ident = "Sony Vaio", |
992 |
+ .matches = { |
993 |
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c |
994 |
index e2a91c8..986cc9f 100644 |
995 |
--- a/drivers/platform/x86/thinkpad_acpi.c |
996 |
@@ -50311,6 +50775,19 @@ index 769d265..a3a05ca 100644 |
997 |
+ |
998 |
+ pax_close_kernel(); |
999 |
} |
1000 |
+diff --git a/drivers/pnp/pnpbios/core.c b/drivers/pnp/pnpbios/core.c |
1001 |
+index 074569e..d807bef 100644 |
1002 |
+--- a/drivers/pnp/pnpbios/core.c |
1003 |
++++ b/drivers/pnp/pnpbios/core.c |
1004 |
+@@ -493,7 +493,7 @@ static int __init exploding_pnp_bios(const struct dmi_system_id *d) |
1005 |
+ return 0; |
1006 |
+ } |
1007 |
+ |
1008 |
+-static struct dmi_system_id pnpbios_dmi_table[] __initdata = { |
1009 |
++static const struct dmi_system_id pnpbios_dmi_table[] __initconst = { |
1010 |
+ { /* PnPBIOS GPF on boot */ |
1011 |
+ .callback = exploding_pnp_bios, |
1012 |
+ .ident = "Higraded P14H", |
1013 |
diff --git a/drivers/pnp/resource.c b/drivers/pnp/resource.c |
1014 |
index bacddd1..65ea100 100644 |
1015 |
--- a/drivers/pnp/resource.c |
1016 |
@@ -52844,6 +53321,19 @@ index 04b1be7..5eff86d 100644 |
1017 |
|
1018 |
tz->get_temp = NULL; |
1019 |
tz->get_trend = NULL; |
1020 |
+diff --git a/drivers/thermal/x86_pkg_temp_thermal.c b/drivers/thermal/x86_pkg_temp_thermal.c |
1021 |
+index 081fd7e..6fb58a2 100644 |
1022 |
+--- a/drivers/thermal/x86_pkg_temp_thermal.c |
1023 |
++++ b/drivers/thermal/x86_pkg_temp_thermal.c |
1024 |
+@@ -567,7 +567,7 @@ static int pkg_temp_thermal_cpu_callback(struct notifier_block *nfb, |
1025 |
+ return NOTIFY_OK; |
1026 |
+ } |
1027 |
+ |
1028 |
+-static struct notifier_block pkg_temp_thermal_notifier __refdata = { |
1029 |
++static struct notifier_block pkg_temp_thermal_notifier __refconst = { |
1030 |
+ .notifier_call = pkg_temp_thermal_cpu_callback, |
1031 |
+ }; |
1032 |
+ |
1033 |
diff --git a/drivers/tty/cyclades.c b/drivers/tty/cyclades.c |
1034 |
index a57bb5a..1f727d33 100644 |
1035 |
--- a/drivers/tty/cyclades.c |
1036 |
@@ -58381,6 +58871,37 @@ index 88714ae..16c2e11 100644 |
1037 |
|
1038 |
|
1039 |
static inline u32 get_pll_internal_frequency(u32 ref_freq, |
1040 |
+diff --git a/drivers/xen/events/events_base.c b/drivers/xen/events/events_base.c |
1041 |
+index c8860a8..9fec529 100644 |
1042 |
+--- a/drivers/xen/events/events_base.c |
1043 |
++++ b/drivers/xen/events/events_base.c |
1044 |
+@@ -1587,7 +1587,7 @@ void xen_irq_resume(void) |
1045 |
+ restore_pirqs(); |
1046 |
+ } |
1047 |
+ |
1048 |
+-static struct irq_chip xen_dynamic_chip __read_mostly = { |
1049 |
++static struct irq_chip xen_dynamic_chip = { |
1050 |
+ .name = "xen-dyn", |
1051 |
+ |
1052 |
+ .irq_disable = disable_dynirq, |
1053 |
+@@ -1601,7 +1601,7 @@ static struct irq_chip xen_dynamic_chip __read_mostly = { |
1054 |
+ .irq_retrigger = retrigger_dynirq, |
1055 |
+ }; |
1056 |
+ |
1057 |
+-static struct irq_chip xen_pirq_chip __read_mostly = { |
1058 |
++static struct irq_chip xen_pirq_chip = { |
1059 |
+ .name = "xen-pirq", |
1060 |
+ |
1061 |
+ .irq_startup = startup_pirq, |
1062 |
+@@ -1621,7 +1621,7 @@ static struct irq_chip xen_pirq_chip __read_mostly = { |
1063 |
+ .irq_retrigger = retrigger_dynirq, |
1064 |
+ }; |
1065 |
+ |
1066 |
+-static struct irq_chip xen_percpu_chip __read_mostly = { |
1067 |
++static struct irq_chip xen_percpu_chip = { |
1068 |
+ .name = "xen-percpu", |
1069 |
+ |
1070 |
+ .irq_disable = disable_dynirq, |
1071 |
diff --git a/drivers/xen/xenfs/xenstored.c b/drivers/xen/xenfs/xenstored.c |
1072 |
index fef20db..d28b1ab 100644 |
1073 |
--- a/drivers/xen/xenfs/xenstored.c |
1074 |
@@ -62596,7 +63117,7 @@ index 92567d9..fcd8cbf 100644 |
1075 |
|
1076 |
if (dot && fs && !(fs->fs_flags & FS_HAS_SUBTYPE)) { |
1077 |
diff --git a/fs/fs_struct.c b/fs/fs_struct.c |
1078 |
-index 7dca743..2f2786d 100644 |
1079 |
+index 7dca743..1ff87ae 100644 |
1080 |
--- a/fs/fs_struct.c |
1081 |
+++ b/fs/fs_struct.c |
1082 |
@@ -4,6 +4,7 @@ |
1083 |
@@ -62665,7 +63186,7 @@ index 7dca743..2f2786d 100644 |
1084 |
fs->in_exec = 0; |
1085 |
spin_lock_init(&fs->lock); |
1086 |
seqcount_init(&fs->seq); |
1087 |
-@@ -121,6 +132,9 @@ struct fs_struct *copy_fs_struct(struct fs_struct *old) |
1088 |
+@@ -121,9 +132,13 @@ struct fs_struct *copy_fs_struct(struct fs_struct *old) |
1089 |
spin_lock(&old->lock); |
1090 |
fs->root = old->root; |
1091 |
path_get(&fs->root); |
1092 |
@@ -62675,7 +63196,11 @@ index 7dca743..2f2786d 100644 |
1093 |
fs->pwd = old->pwd; |
1094 |
path_get(&fs->pwd); |
1095 |
spin_unlock(&old->lock); |
1096 |
-@@ -139,8 +153,9 @@ int unshare_fs_struct(void) |
1097 |
++ gr_inc_chroot_refcnts(fs->root.dentry, fs->root.mnt); |
1098 |
+ } |
1099 |
+ return fs; |
1100 |
+ } |
1101 |
+@@ -139,8 +154,9 @@ int unshare_fs_struct(void) |
1102 |
|
1103 |
task_lock(current); |
1104 |
spin_lock(&fs->lock); |
1105 |
@@ -62686,7 +63211,7 @@ index 7dca743..2f2786d 100644 |
1106 |
spin_unlock(&fs->lock); |
1107 |
task_unlock(current); |
1108 |
|
1109 |
-@@ -153,13 +168,13 @@ EXPORT_SYMBOL_GPL(unshare_fs_struct); |
1110 |
+@@ -153,13 +169,13 @@ EXPORT_SYMBOL_GPL(unshare_fs_struct); |
1111 |
|
1112 |
int current_umask(void) |
1113 |
{ |
1114 |
@@ -81853,7 +82378,7 @@ index cdd1cc2..2401b2e 100644 |
1115 |
* (asm goto is automatically volatile - the naming reflects this.) |
1116 |
*/ |
1117 |
diff --git a/include/linux/compiler.h b/include/linux/compiler.h |
1118 |
-index 2472740..4857634 100644 |
1119 |
+index 2472740..73ef938 100644 |
1120 |
--- a/include/linux/compiler.h |
1121 |
+++ b/include/linux/compiler.h |
1122 |
@@ -5,11 +5,14 @@ |
1123 |
@@ -81979,7 +82504,16 @@ index 2472740..4857634 100644 |
1124 |
/* Simple shorthand for a section definition */ |
1125 |
#ifndef __section |
1126 |
# define __section(S) __attribute__ ((__section__(#S))) |
1127 |
-@@ -362,7 +428,8 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect); |
1128 |
+@@ -302,6 +368,8 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect); |
1129 |
+ # define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) |
1130 |
+ #endif |
1131 |
+ |
1132 |
++#define __type_is_unsigned(t) (__same_type((t)0, 0UL) || __same_type((t)0, 0U) || __same_type((t)0, (unsigned short)0) || __same_type((t)0, (unsigned char)0)) |
1133 |
++ |
1134 |
+ /* Is this type a native word size -- useful for atomic operations */ |
1135 |
+ #ifndef __native_word |
1136 |
+ # define __native_word(t) (sizeof(t) == sizeof(int) || sizeof(t) == sizeof(long)) |
1137 |
+@@ -362,7 +430,8 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect); |
1138 |
* use is to mediate communication between process-level code and irq/NMI |
1139 |
* handlers, all running on the same CPU. |
1140 |
*/ |
1141 |
@@ -85014,6 +85548,19 @@ index 2b58d19..6378966 100644 |
1142 |
|
1143 |
static inline void mm_init_cpumask(struct mm_struct *mm) |
1144 |
{ |
1145 |
+diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h |
1146 |
+index 87079fc..7724b1f 100644 |
1147 |
+--- a/include/linux/mmc/core.h |
1148 |
++++ b/include/linux/mmc/core.h |
1149 |
+@@ -79,7 +79,7 @@ struct mmc_command { |
1150 |
+ #define mmc_cmd_type(cmd) ((cmd)->flags & MMC_CMD_MASK) |
1151 |
+ |
1152 |
+ unsigned int retries; /* max number of retries */ |
1153 |
+- unsigned int error; /* command error */ |
1154 |
++ int error; /* command error */ |
1155 |
+ |
1156 |
+ /* |
1157 |
+ * Standard errno values are used for errors, but some have specific |
1158 |
diff --git a/include/linux/mmiotrace.h b/include/linux/mmiotrace.h |
1159 |
index c5d5278..f0b68c8 100644 |
1160 |
--- a/include/linux/mmiotrace.h |
1161 |
@@ -86928,26 +87475,24 @@ index a5ffd32..0935dea 100644 |
1162 |
extern dma_addr_t swiotlb_map_page(struct device *dev, struct page *page, |
1163 |
unsigned long offset, size_t size, |
1164 |
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h |
1165 |
-index a747a77..9e14df7 100644 |
1166 |
+index a747a77..02cf063 100644 |
1167 |
--- a/include/linux/syscalls.h |
1168 |
+++ b/include/linux/syscalls.h |
1169 |
-@@ -98,8 +98,14 @@ struct sigaltstack; |
1170 |
- #define __MAP(n,...) __MAP##n(__VA_ARGS__) |
1171 |
+@@ -99,7 +99,12 @@ struct sigaltstack; |
1172 |
|
1173 |
#define __SC_DECL(t, a) t a |
1174 |
-+#define __TYPE_IS_U(t) (__same_type((t)0, 0UL) || __same_type((t)0, 0U) || __same_type((t)0, (unsigned short)0) || __same_type((t)0, (unsigned char)0)) |
1175 |
#define __TYPE_IS_LL(t) (__same_type((t)0, 0LL) || __same_type((t)0, 0ULL)) |
1176 |
-#define __SC_LONG(t, a) __typeof(__builtin_choose_expr(__TYPE_IS_LL(t), 0LL, 0L)) a |
1177 |
-+#define __SC_LONG(t, a) __typeof( \ |
1178 |
++#define __SC_LONG(t, a) __typeof__( \ |
1179 |
+ __builtin_choose_expr( \ |
1180 |
+ sizeof(t) > sizeof(int), \ |
1181 |
+ (t) 0, \ |
1182 |
-+ __builtin_choose_expr(__TYPE_IS_U(t), 0UL, 0L) \ |
1183 |
++ __builtin_choose_expr(__type_is_unsigned(t), 0UL, 0L) \ |
1184 |
+ )) a |
1185 |
#define __SC_CAST(t, a) (t) a |
1186 |
#define __SC_ARGS(t, a) a |
1187 |
#define __SC_TEST(t, a) (void)BUILD_BUG_ON_ZERO(!__TYPE_IS_LL(t) && sizeof(t) > sizeof(long)) |
1188 |
-@@ -371,11 +377,11 @@ asmlinkage long sys_sync(void); |
1189 |
+@@ -371,11 +376,11 @@ asmlinkage long sys_sync(void); |
1190 |
asmlinkage long sys_fsync(unsigned int fd); |
1191 |
asmlinkage long sys_fdatasync(unsigned int fd); |
1192 |
asmlinkage long sys_bdflush(int func, long data); |
1193 |
@@ -86963,7 +87508,7 @@ index a747a77..9e14df7 100644 |
1194 |
asmlinkage long sys_truncate(const char __user *path, long length); |
1195 |
asmlinkage long sys_ftruncate(unsigned int fd, unsigned long length); |
1196 |
asmlinkage long sys_stat(const char __user *filename, |
1197 |
-@@ -587,7 +593,7 @@ asmlinkage long sys_getsockname(int, struct sockaddr __user *, int __user *); |
1198 |
+@@ -587,7 +592,7 @@ asmlinkage long sys_getsockname(int, struct sockaddr __user *, int __user *); |
1199 |
asmlinkage long sys_getpeername(int, struct sockaddr __user *, int __user *); |
1200 |
asmlinkage long sys_send(int, void __user *, size_t, unsigned); |
1201 |
asmlinkage long sys_sendto(int, void __user *, size_t, unsigned, |
1202 |
@@ -97273,7 +97818,7 @@ index d53adf9..03a24bf 100644 |
1203 |
set_fs(old_fs); |
1204 |
|
1205 |
diff --git a/mm/madvise.c b/mm/madvise.c |
1206 |
-index a402f8f..f5e5daa 100644 |
1207 |
+index a402f8f..1851ab2 100644 |
1208 |
--- a/mm/madvise.c |
1209 |
+++ b/mm/madvise.c |
1210 |
@@ -51,6 +51,10 @@ static long madvise_behavior(struct vm_area_struct *vma, |
1211 |
@@ -97326,9 +97871,9 @@ index a402f8f..f5e5daa 100644 |
1212 |
+ .nonlinear_vma = vma_m, |
1213 |
+ .last_index = ULONG_MAX, |
1214 |
+ }; |
1215 |
-+ zap_page_range(vma, start + SEGMEXEC_TASK_SIZE, end - start, &details); |
1216 |
++ zap_page_range(vma_m, start + SEGMEXEC_TASK_SIZE, end - start, &details); |
1217 |
+ } else |
1218 |
-+ zap_page_range(vma, start + SEGMEXEC_TASK_SIZE, end - start, NULL); |
1219 |
++ zap_page_range(vma_m, start + SEGMEXEC_TASK_SIZE, end - start, NULL); |
1220 |
+ } |
1221 |
+#endif |
1222 |
+ |
1223 |
@@ -106283,6 +106828,32 @@ index 7932697..a13d158 100644 |
1224 |
} while (!res); |
1225 |
return res; |
1226 |
} |
1227 |
+diff --git a/net/l2tp/l2tp_ip.c b/net/l2tp/l2tp_ip.c |
1228 |
+index 0b44d85..94067b3 100644 |
1229 |
+--- a/net/l2tp/l2tp_ip.c |
1230 |
++++ b/net/l2tp/l2tp_ip.c |
1231 |
+@@ -609,7 +609,7 @@ static struct inet_protosw l2tp_ip_protosw = { |
1232 |
+ .no_check = 0, |
1233 |
+ }; |
1234 |
+ |
1235 |
+-static struct net_protocol l2tp_ip_protocol __read_mostly = { |
1236 |
++static const struct net_protocol l2tp_ip_protocol = { |
1237 |
+ .handler = l2tp_ip_recv, |
1238 |
+ .netns_ok = 1, |
1239 |
+ }; |
1240 |
+diff --git a/net/l2tp/l2tp_ip6.c b/net/l2tp/l2tp_ip6.c |
1241 |
+index 7704ea9..7f2b105 100644 |
1242 |
+--- a/net/l2tp/l2tp_ip6.c |
1243 |
++++ b/net/l2tp/l2tp_ip6.c |
1244 |
+@@ -764,7 +764,7 @@ static struct inet_protosw l2tp_ip6_protosw = { |
1245 |
+ .no_check = 0, |
1246 |
+ }; |
1247 |
+ |
1248 |
+-static struct inet6_protocol l2tp_ip6_protocol __read_mostly = { |
1249 |
++static const struct inet6_protocol l2tp_ip6_protocol = { |
1250 |
+ .handler = l2tp_ip6_recv, |
1251 |
+ }; |
1252 |
+ |
1253 |
diff --git a/net/llc/llc_proc.c b/net/llc/llc_proc.c |
1254 |
index 1a3c7e0..80f8b0c 100644 |
1255 |
--- a/net/llc/llc_proc.c |
1256 |
@@ -106995,7 +107566,7 @@ index 108120f..5b169db 100644 |
1257 |
queued = 0; |
1258 |
err = 0; |
1259 |
diff --git a/net/netfilter/nft_compat.c b/net/netfilter/nft_compat.c |
1260 |
-index 7350723..c58f861 100644 |
1261 |
+index 7350723..af7fa0d 100644 |
1262 |
--- a/net/netfilter/nft_compat.c |
1263 |
+++ b/net/netfilter/nft_compat.c |
1264 |
@@ -216,7 +216,7 @@ target_dump_info(struct sk_buff *skb, const struct xt_target *t, const void *in) |
1265 |
@@ -107007,7 +107578,23 @@ index 7350723..c58f861 100644 |
1266 |
set_fs(old_fs); |
1267 |
ret = nla_put(skb, NFTA_TARGET_INFO, XT_ALIGN(t->targetsize), out); |
1268 |
kfree(out); |
1269 |
-@@ -403,7 +403,7 @@ match_dump_info(struct sk_buff *skb, const struct xt_match *m, const void *in) |
1270 |
+@@ -283,14 +283,7 @@ static void nft_match_eval(const struct nft_expr *expr, |
1271 |
+ return; |
1272 |
+ } |
1273 |
+ |
1274 |
+- switch(ret) { |
1275 |
+- case true: |
1276 |
+- data[NFT_REG_VERDICT].verdict = NFT_CONTINUE; |
1277 |
+- break; |
1278 |
+- case false: |
1279 |
+- data[NFT_REG_VERDICT].verdict = NFT_BREAK; |
1280 |
+- break; |
1281 |
+- } |
1282 |
++ data[NFT_REG_VERDICT].verdict = ret ? NFT_CONTINUE : NFT_BREAK; |
1283 |
+ } |
1284 |
+ |
1285 |
+ static const struct nla_policy nft_match_policy[NFTA_MATCH_MAX + 1] = { |
1286 |
+@@ -403,7 +396,7 @@ match_dump_info(struct sk_buff *skb, const struct xt_match *m, const void *in) |
1287 |
/* We want to reuse existing compat_to_user */ |
1288 |
old_fs = get_fs(); |
1289 |
set_fs(KERNEL_DS); |
1290 |
@@ -109952,7 +110539,7 @@ index 8fac3fd..32ff38d 100644 |
1291 |
unsigned int secindex_strings; |
1292 |
|
1293 |
diff --git a/security/Kconfig b/security/Kconfig |
1294 |
-index beb86b5..4c193cc 100644 |
1295 |
+index beb86b5..86bc440 100644 |
1296 |
--- a/security/Kconfig |
1297 |
+++ b/security/Kconfig |
1298 |
@@ -4,6 +4,974 @@ |
1299 |
@@ -110270,9 +110857,9 @@ index beb86b5..4c193cc 100644 |
1300 |
+ bool 'Use filesystem extended attributes marking' |
1301 |
+ default y if GRKERNSEC_CONFIG_AUTO |
1302 |
+ select CIFS_XATTR if CIFS |
1303 |
-+ select F2FS_FS_XATTR if F2FS_FS |
1304 |
+ select EXT2_FS_XATTR if EXT2_FS |
1305 |
+ select EXT3_FS_XATTR if EXT3_FS |
1306 |
++ select F2FS_FS_XATTR if F2FS_FS |
1307 |
+ select JFFS2_FS_XATTR if JFFS2_FS |
1308 |
+ select REISERFS_FS_XATTR if REISERFS_FS |
1309 |
+ select SQUASHFS_XATTR if SQUASHFS |
1310 |
@@ -112365,7 +112952,7 @@ index 0000000..60e7af2 |
1311 |
+randomize_layout_hash.h |
1312 |
diff --git a/tools/gcc/Makefile b/tools/gcc/Makefile |
1313 |
new file mode 100644 |
1314 |
-index 0000000..7b8921f |
1315 |
+index 0000000..a51677e |
1316 |
--- /dev/null |
1317 |
+++ b/tools/gcc/Makefile |
1318 |
@@ -0,0 +1,52 @@ |
1319 |
@@ -112381,7 +112968,7 @@ index 0000000..7b8921f |
1320 |
+export HOST_EXTRACFLAGS |
1321 |
+else |
1322 |
+HOSTLIBS := hostcxxlibs |
1323 |
-+HOST_EXTRACXXFLAGS += -I$(GCCPLUGINS_DIR)/include -I$(src) -std=gnu++98 -fno-rtti -ggdb -Wno-unused-parameter -Wno-narrowing -Wno-unused-variable |
1324 |
++HOST_EXTRACXXFLAGS += -I$(GCCPLUGINS_DIR)/include -I$(src) -std=gnu++98 -fno-rtti -fno-exceptions -fasynchronous-unwind-tables -ggdb -Wno-unused-parameter -Wno-narrowing -Wno-unused-variable |
1325 |
+export HOST_EXTRACXXFLAGS |
1326 |
+endif |
1327 |
+ |
1328 |
@@ -113369,10 +113956,10 @@ index 0000000..93b181d |
1329 |
+} |
1330 |
diff --git a/tools/gcc/gcc-common.h b/tools/gcc/gcc-common.h |
1331 |
new file mode 100644 |
1332 |
-index 0000000..19fedf2 |
1333 |
+index 0000000..d8ec362 |
1334 |
--- /dev/null |
1335 |
+++ b/tools/gcc/gcc-common.h |
1336 |
-@@ -0,0 +1,540 @@ |
1337 |
+@@ -0,0 +1,666 @@ |
1338 |
+#ifndef GCC_COMMON_H_INCLUDED |
1339 |
+#define GCC_COMMON_H_INCLUDED |
1340 |
+ |
1341 |
@@ -113695,13 +114282,6 @@ index 0000000..19fedf2 |
1342 |
+} |
1343 |
+#endif |
1344 |
+ |
1345 |
-+#if BUILDING_GCC_VERSION >= 4007 |
1346 |
-+#define cgraph_create_edge(caller, callee, call_stmt, count, freq, nest) \ |
1347 |
-+ cgraph_create_edge((caller), (callee), (call_stmt), (count), (freq)) |
1348 |
-+#define cgraph_create_edge_including_clones(caller, callee, old_call_stmt, call_stmt, count, freq, nest, reason) \ |
1349 |
-+ cgraph_create_edge_including_clones((caller), (callee), (old_call_stmt), (call_stmt), (count), (freq), (reason)) |
1350 |
-+#endif |
1351 |
-+ |
1352 |
+#if BUILDING_GCC_VERSION == 4007 || BUILDING_GCC_VERSION == 4008 |
1353 |
+static inline struct cgraph_node *cgraph_alias_target(struct cgraph_node *n) |
1354 |
+{ |
1355 |
@@ -113709,6 +114289,13 @@ index 0000000..19fedf2 |
1356 |
+} |
1357 |
+#endif |
1358 |
+ |
1359 |
++#if BUILDING_GCC_VERSION >= 4007 && BUILDING_GCC_VERSION <= 4009 |
1360 |
++#define cgraph_create_edge(caller, callee, call_stmt, count, freq, nest) \ |
1361 |
++ cgraph_create_edge((caller), (callee), (call_stmt), (count), (freq)) |
1362 |
++#define cgraph_create_edge_including_clones(caller, callee, old_call_stmt, call_stmt, count, freq, nest, reason) \ |
1363 |
++ cgraph_create_edge_including_clones((caller), (callee), (old_call_stmt), (call_stmt), (count), (freq), (reason)) |
1364 |
++#endif |
1365 |
++ |
1366 |
+#if BUILDING_GCC_VERSION <= 4008 |
1367 |
+#define ENTRY_BLOCK_PTR_FOR_FN(FN) ENTRY_BLOCK_PTR_FOR_FUNCTION(FN) |
1368 |
+#define EXIT_BLOCK_PTR_FOR_FN(FN) EXIT_BLOCK_PTR_FOR_FUNCTION(FN) |
1369 |
@@ -113721,6 +114308,40 @@ index 0000000..19fedf2 |
1370 |
+#define BASIC_BLOCK_FOR_FN(FN, N) BASIC_BLOCK_FOR_FUNCTION((FN), (N)) |
1371 |
+#define NODE_IMPLICIT_ALIAS(node) (node)->same_body_alias |
1372 |
+ |
1373 |
++static inline bool tree_fits_shwi_p(const_tree t) |
1374 |
++{ |
1375 |
++ if (t == NULL_TREE || TREE_CODE(t) != INTEGER_CST) |
1376 |
++ return false; |
1377 |
++ |
1378 |
++ if (TREE_INT_CST_HIGH(t) == 0 && (HOST_WIDE_INT)TREE_INT_CST_LOW(t) >= 0) |
1379 |
++ return true; |
1380 |
++ |
1381 |
++ if (TREE_INT_CST_HIGH(t) == -1 && (HOST_WIDE_INT)TREE_INT_CST_LOW(t) < 0 && !TYPE_UNSIGNED(TREE_TYPE(t))) |
1382 |
++ return true; |
1383 |
++ |
1384 |
++ return false; |
1385 |
++} |
1386 |
++ |
1387 |
++static inline bool tree_fits_uhwi_p(const_tree t) |
1388 |
++{ |
1389 |
++ if (t == NULL_TREE || TREE_CODE(t) != INTEGER_CST) |
1390 |
++ return false; |
1391 |
++ |
1392 |
++ return TREE_INT_CST_HIGH(t) == 0; |
1393 |
++} |
1394 |
++ |
1395 |
++static inline HOST_WIDE_INT tree_to_shwi(const_tree t) |
1396 |
++{ |
1397 |
++ gcc_assert(tree_fits_shwi_p(t)); |
1398 |
++ return TREE_INT_CST_LOW(t); |
1399 |
++} |
1400 |
++ |
1401 |
++static inline unsigned HOST_WIDE_INT tree_to_uhwi(const_tree t) |
1402 |
++{ |
1403 |
++ gcc_assert(tree_fits_uhwi_p(t)); |
1404 |
++ return TREE_INT_CST_LOW(t); |
1405 |
++} |
1406 |
++ |
1407 |
+static inline const char *get_tree_code_name(enum tree_code code) |
1408 |
+{ |
1409 |
+ gcc_assert(code < MAX_TREE_CODES); |
1410 |
@@ -113731,6 +114352,7 @@ index 0000000..19fedf2 |
1411 |
+typedef union gimple_statement_d gasm; |
1412 |
+typedef union gimple_statement_d gassign; |
1413 |
+typedef union gimple_statement_d gcall; |
1414 |
++typedef union gimple_statement_d gcond; |
1415 |
+typedef union gimple_statement_d gdebug; |
1416 |
+typedef union gimple_statement_d gphi; |
1417 |
+typedef union gimple_statement_d greturn; |
1418 |
@@ -113758,6 +114380,7 @@ index 0000000..19fedf2 |
1419 |
+typedef struct gimple_statement_base gasm; |
1420 |
+typedef struct gimple_statement_base gassign; |
1421 |
+typedef struct gimple_statement_base gcall; |
1422 |
++typedef struct gimple_statement_base gcond; |
1423 |
+typedef struct gimple_statement_base gdebug; |
1424 |
+typedef struct gimple_statement_base gphi; |
1425 |
+typedef struct gimple_statement_base greturn; |
1426 |
@@ -113771,15 +114394,50 @@ index 0000000..19fedf2 |
1427 |
+ return stmt; |
1428 |
+} |
1429 |
+ |
1430 |
++static inline const gasm *as_a_const_gasm(const_gimple stmt) |
1431 |
++{ |
1432 |
++ return stmt; |
1433 |
++} |
1434 |
++ |
1435 |
++static inline gassign *as_a_gassign(gimple stmt) |
1436 |
++{ |
1437 |
++ return stmt; |
1438 |
++} |
1439 |
++ |
1440 |
++static inline const gassign *as_a_const_gassign(const_gimple stmt) |
1441 |
++{ |
1442 |
++ return stmt; |
1443 |
++} |
1444 |
++ |
1445 |
+static inline gcall *as_a_gcall(gimple stmt) |
1446 |
+{ |
1447 |
+ return stmt; |
1448 |
+} |
1449 |
+ |
1450 |
++static inline const gcall *as_a_const_gcall(const_gimple stmt) |
1451 |
++{ |
1452 |
++ return stmt; |
1453 |
++} |
1454 |
++ |
1455 |
++static inline gphi *as_a_gphi(gimple stmt) |
1456 |
++{ |
1457 |
++ return stmt; |
1458 |
++} |
1459 |
++ |
1460 |
++static inline const gphi *as_a_const_gphi(const_gimple stmt) |
1461 |
++{ |
1462 |
++ return stmt; |
1463 |
++} |
1464 |
++ |
1465 |
+static inline greturn *as_a_greturn(gimple stmt) |
1466 |
+{ |
1467 |
+ return stmt; |
1468 |
+} |
1469 |
++ |
1470 |
++static inline const greturn *as_a_const_greturn(const_gimple stmt) |
1471 |
++{ |
1472 |
++ return stmt; |
1473 |
++} |
1474 |
+#endif |
1475 |
+ |
1476 |
+#if BUILDING_GCC_VERSION >= 4009 |
1477 |
@@ -113796,17 +114454,23 @@ index 0000000..19fedf2 |
1478 |
+#define TODO_verify_stmts TODO_verify_il |
1479 |
+#define TODO_verify_rtl_sharing TODO_verify_il |
1480 |
+ |
1481 |
-+#define TREE_INT_CST_HIGH(NODE) ({ TREE_INT_CST_EXT_NUNITS(NODE) > 1 ? (unsigned HOST_WIDE_INT)TREE_INT_CST_ELT(NODE, 1) : 0; }) |
1482 |
++//#define TREE_INT_CST_HIGH(NODE) ({ TREE_INT_CST_EXT_NUNITS(NODE) > 1 ? (unsigned HOST_WIDE_INT)TREE_INT_CST_ELT(NODE, 1) : 0; }) |
1483 |
+ |
1484 |
+#define INSN_DELETED_P(insn) (insn)->deleted() |
1485 |
+ |
1486 |
+// symtab/cgraph related |
1487 |
+#define debug_cgraph_node(node) (node)->debug() |
1488 |
+#define cgraph_get_node(decl) cgraph_node::get(decl) |
1489 |
++#define cgraph_get_create_node(decl) cgraph_node::get_create(decl) |
1490 |
+#define cgraph_n_nodes symtab->cgraph_count |
1491 |
+#define cgraph_max_uid symtab->cgraph_max_uid |
1492 |
+#define varpool_get_node(decl) varpool_node::get(decl) |
1493 |
+ |
1494 |
++#define cgraph_create_edge(caller, callee, call_stmt, count, freq, nest) \ |
1495 |
++ (caller)->create_edge((callee), (call_stmt), (count), (freq)) |
1496 |
++#define cgraph_create_edge_including_clones(caller, callee, old_call_stmt, call_stmt, count, freq, nest, reason) \ |
1497 |
++ (caller)->create_edge_including_clones((callee), (old_call_stmt), (call_stmt), (count), (freq), (reason)) |
1498 |
++ |
1499 |
+typedef struct cgraph_node *cgraph_node_ptr; |
1500 |
+typedef struct cgraph_edge *cgraph_edge_p; |
1501 |
+typedef struct varpool_node *varpool_node_ptr; |
1502 |
@@ -113882,26 +114546,70 @@ index 0000000..19fedf2 |
1503 |
+ return gimple_build_assign(lhs, subcode, op1, op2 PASS_MEM_STAT); |
1504 |
+} |
1505 |
+ |
1506 |
++template <> |
1507 |
++template <> |
1508 |
++inline bool is_a_helper<const gassign *>::test(const_gimple gs) |
1509 |
++{ |
1510 |
++ return gs->code == GIMPLE_ASSIGN; |
1511 |
++} |
1512 |
++ |
1513 |
++template <> |
1514 |
++template <> |
1515 |
++inline bool is_a_helper<const greturn *>::test(const_gimple gs) |
1516 |
++{ |
1517 |
++ return gs->code == GIMPLE_RETURN; |
1518 |
++} |
1519 |
++ |
1520 |
+static inline gasm *as_a_gasm(gimple stmt) |
1521 |
+{ |
1522 |
+ return as_a<gasm *>(stmt); |
1523 |
+} |
1524 |
+ |
1525 |
-+static inline const gasm *as_a_gasm(const_gimple stmt) |
1526 |
++static inline const gasm *as_a_const_gasm(const_gimple stmt) |
1527 |
+{ |
1528 |
+ return as_a<const gasm *>(stmt); |
1529 |
+} |
1530 |
+ |
1531 |
++static inline gassign *as_a_gassign(gimple stmt) |
1532 |
++{ |
1533 |
++ return as_a<gassign *>(stmt); |
1534 |
++} |
1535 |
++ |
1536 |
++static inline const gassign *as_a_const_gassign(const_gimple stmt) |
1537 |
++{ |
1538 |
++ return as_a<const gassign *>(stmt); |
1539 |
++} |
1540 |
++ |
1541 |
+static inline gcall *as_a_gcall(gimple stmt) |
1542 |
+{ |
1543 |
+ return as_a<gcall *>(stmt); |
1544 |
+} |
1545 |
+ |
1546 |
++static inline const gcall *as_a_const_gcall(const_gimple stmt) |
1547 |
++{ |
1548 |
++ return as_a<const gcall *>(stmt); |
1549 |
++} |
1550 |
++ |
1551 |
++static inline gphi *as_a_gphi(gimple stmt) |
1552 |
++{ |
1553 |
++ return as_a<gphi *>(stmt); |
1554 |
++} |
1555 |
++ |
1556 |
++static inline const gphi *as_a_const_gphi(const_gimple stmt) |
1557 |
++{ |
1558 |
++ return as_a<const gphi *>(stmt); |
1559 |
++} |
1560 |
++ |
1561 |
+static inline greturn *as_a_greturn(gimple stmt) |
1562 |
+{ |
1563 |
+ return as_a<greturn *>(stmt); |
1564 |
+} |
1565 |
+ |
1566 |
++static inline const greturn *as_a_const_greturn(const_gimple stmt) |
1567 |
++{ |
1568 |
++ return as_a<const greturn *>(stmt); |
1569 |
++} |
1570 |
++ |
1571 |
+// IPA/LTO related |
1572 |
+#define ipa_ref_list_referring_iterate(L,I,P) (L)->referring.iterate((I), &(P)) |
1573 |
+#define ipa_ref_list_reference_iterate(L,I,P) (L)->reference.iterate((I), &(P)) |
1574 |
@@ -113910,6 +114618,11 @@ index 0000000..19fedf2 |
1575 |
+{ |
1576 |
+ return dyn_cast<cgraph_node_ptr>(ref->referring); |
1577 |
+} |
1578 |
++ |
1579 |
++static inline void ipa_remove_stmt_references(symtab_node *referring_node, gimple stmt) |
1580 |
++{ |
1581 |
++ referring_node->remove_stmt_references(stmt); |
1582 |
++} |
1583 |
+#endif |
1584 |
+ |
1585 |
+#endif |
1586 |
@@ -114123,7 +114836,7 @@ index 0000000..457d54e |
1587 |
+} |
1588 |
diff --git a/tools/gcc/kernexec_plugin.c b/tools/gcc/kernexec_plugin.c |
1589 |
new file mode 100644 |
1590 |
-index 0000000..71716e7 |
1591 |
+index 0000000..b0d8255 |
1592 |
--- /dev/null |
1593 |
+++ b/tools/gcc/kernexec_plugin.c |
1594 |
@@ -0,0 +1,547 @@ |
1595 |
@@ -114278,9 +114991,9 @@ index 0000000..71716e7 |
1596 |
+ new_fptr = make_ssa_name(new_fptr, NULL); |
1597 |
+ |
1598 |
+ // build asm volatile("orq %%r12, %0\n\t" : "=r"(new_fptr) : "0"(old_fptr)); |
1599 |
-+ input = build_tree_list(NULL_TREE, build_string(1, "0")); |
1600 |
++ input = build_tree_list(NULL_TREE, build_string(2, "0")); |
1601 |
+ input = chainon(NULL_TREE, build_tree_list(input, old_fptr)); |
1602 |
-+ output = build_tree_list(NULL_TREE, build_string(2, "=r")); |
1603 |
++ output = build_tree_list(NULL_TREE, build_string(3, "=r")); |
1604 |
+ output = chainon(NULL_TREE, build_tree_list(output, new_fptr)); |
1605 |
+#if BUILDING_GCC_VERSION <= 4007 |
1606 |
+ VEC_safe_push(tree, gc, inputs, input); |
1607 |
@@ -114676,10 +115389,10 @@ index 0000000..71716e7 |
1608 |
+} |
1609 |
diff --git a/tools/gcc/latent_entropy_plugin.c b/tools/gcc/latent_entropy_plugin.c |
1610 |
new file mode 100644 |
1611 |
-index 0000000..d383708 |
1612 |
+index 0000000..ac6f9b4 |
1613 |
--- /dev/null |
1614 |
+++ b/tools/gcc/latent_entropy_plugin.c |
1615 |
-@@ -0,0 +1,473 @@ |
1616 |
+@@ -0,0 +1,474 @@ |
1617 |
+/* |
1618 |
+ * Copyright 2012-2015 by the PaX Team <pageexec@××××××××.hu> |
1619 |
+ * Licensed under the GPL v2 |
1620 |
@@ -114698,7 +115411,7 @@ index 0000000..d383708 |
1621 |
+ * - more instrumentation control via attribute parameters |
1622 |
+ * |
1623 |
+ * BUGS: |
1624 |
-+ * - LTO needs -flto-partition=none for now |
1625 |
++ * - none known |
1626 |
+ */ |
1627 |
+ |
1628 |
+#include "gcc-common.h" |
1629 |
@@ -114708,7 +115421,7 @@ index 0000000..d383708 |
1630 |
+static GTY(()) tree latent_entropy_decl; |
1631 |
+ |
1632 |
+static struct plugin_info latent_entropy_plugin_info = { |
1633 |
-+ .version = "201409101820", |
1634 |
++ .version = "201504282240", |
1635 |
+ .help = NULL |
1636 |
+}; |
1637 |
+ |
1638 |
@@ -114986,6 +115699,8 @@ index 0000000..d383708 |
1639 |
+ FOR_EACH_VARIABLE(node) { |
1640 |
+ tree var = NODE_DECL(node); |
1641 |
+ |
1642 |
++ if (DECL_NAME_LENGTH(var) < sizeof("latent_entropy") - 1) |
1643 |
++ continue; |
1644 |
+ if (strcmp(IDENTIFIER_POINTER(DECL_NAME(var)), "latent_entropy")) |
1645 |
+ continue; |
1646 |
+ latent_entropy_decl = var; |
1647 |
@@ -115146,8 +115861,7 @@ index 0000000..d383708 |
1648 |
+ |
1649 |
+ register_callback(plugin_name, PLUGIN_INFO, NULL, &latent_entropy_plugin_info); |
1650 |
+ register_callback(plugin_name, PLUGIN_START_UNIT, &latent_entropy_start_unit, NULL); |
1651 |
-+ if (!in_lto_p) |
1652 |
-+ register_callback(plugin_name, PLUGIN_REGISTER_GGC_ROOTS, NULL, (void *)>_ggc_r_gt_latent_entropy); |
1653 |
++ register_callback(plugin_name, PLUGIN_REGISTER_GGC_ROOTS, NULL, (void *)>_ggc_r_gt_latent_entropy); |
1654 |
+ register_callback(plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &latent_entropy_pass_info); |
1655 |
+ register_callback(plugin_name, PLUGIN_ATTRIBUTES, register_attributes, NULL); |
1656 |
+ |
1657 |
@@ -120420,10 +121134,10 @@ index 0000000..4378111 |
1658 |
+} |
1659 |
diff --git a/tools/gcc/size_overflow_plugin/size_overflow_hash.data b/tools/gcc/size_overflow_plugin/size_overflow_hash.data |
1660 |
new file mode 100644 |
1661 |
-index 0000000..f48651d |
1662 |
+index 0000000..f314f81 |
1663 |
--- /dev/null |
1664 |
+++ b/tools/gcc/size_overflow_plugin/size_overflow_hash.data |
1665 |
-@@ -0,0 +1,6057 @@ |
1666 |
+@@ -0,0 +1,6058 @@ |
1667 |
+intel_fake_agp_alloc_by_type_1 intel_fake_agp_alloc_by_type 1 1 NULL |
1668 |
+ocfs2_get_refcount_tree_3 ocfs2_get_refcount_tree 0 3 NULL |
1669 |
+storvsc_connect_to_vsp_22 storvsc_connect_to_vsp 2 22 NULL |
1670 |
@@ -126406,6 +127120,7 @@ index 0000000..f48651d |
1671 |
+__apei_exec_run_64563 __apei_exec_run 0 64563 NULL |
1672 |
+kstrtoul_from_user_64569 kstrtoul_from_user 2 64569 NULL |
1673 |
+do_erase_64574 do_erase 4 64574 NULL |
1674 |
++nla_get_s32_64603 nla_get_s32 0 64603 NULL |
1675 |
+fanotify_write_64623 fanotify_write 3 64623 NULL |
1676 |
+regmap_read_debugfs_64658 regmap_read_debugfs 5 64658 NULL |
1677 |
+ocfs2_read_xattr_block_64661 ocfs2_read_xattr_block 0 64661 NULL nohasharray |
1678 |
@@ -127216,10 +127931,10 @@ index 0000000..0888f6c |
1679 |
+ |
1680 |
diff --git a/tools/gcc/stackleak_plugin.c b/tools/gcc/stackleak_plugin.c |
1681 |
new file mode 100644 |
1682 |
-index 0000000..51dc09d |
1683 |
+index 0000000..1d296ce |
1684 |
--- /dev/null |
1685 |
+++ b/tools/gcc/stackleak_plugin.c |
1686 |
-@@ -0,0 +1,408 @@ |
1687 |
+@@ -0,0 +1,432 @@ |
1688 |
+/* |
1689 |
+ * Copyright 2011-2015 by the PaX Team <pageexec@××××××××.hu> |
1690 |
+ * Licensed under the GPL v2 |
1691 |
@@ -127252,29 +127967,49 @@ index 0000000..51dc09d |
1692 |
+static bool init_locals; |
1693 |
+ |
1694 |
+static struct plugin_info stackleak_plugin_info = { |
1695 |
-+ .version = "201408011900", |
1696 |
++ .version = "201504282245", |
1697 |
+ .help = "track-lowest-sp=nn\ttrack sp in functions whose frame size is at least nn bytes\n" |
1698 |
+// "initialize-locals\t\tforcibly initialize all stack frames\n" |
1699 |
+}; |
1700 |
+ |
1701 |
+static void stackleak_check_alloca(gimple_stmt_iterator *gsi) |
1702 |
+{ |
1703 |
-+ gimple check_alloca; |
1704 |
++ gcall *check_alloca; |
1705 |
+ tree alloca_size; |
1706 |
++ cgraph_node_ptr node; |
1707 |
++ int frequency; |
1708 |
++ basic_block bb; |
1709 |
+ |
1710 |
+ // insert call to void pax_check_alloca(unsigned long size) |
1711 |
+ alloca_size = gimple_call_arg(gsi_stmt(*gsi), 0); |
1712 |
+ check_alloca = gimple_build_call(check_function_decl, 1, alloca_size); |
1713 |
+ gsi_insert_before(gsi, check_alloca, GSI_SAME_STMT); |
1714 |
++ |
1715 |
++ // update the cgraph |
1716 |
++ bb = gimple_bb(check_alloca); |
1717 |
++ node = cgraph_get_create_node(check_function_decl); |
1718 |
++ gcc_assert(node); |
1719 |
++ frequency = compute_call_stmt_bb_frequency(current_function_decl, bb); |
1720 |
++ cgraph_create_edge(cgraph_get_node(current_function_decl), node, check_alloca, bb->count, frequency, bb->loop_depth); |
1721 |
+} |
1722 |
+ |
1723 |
+static void stackleak_add_instrumentation(gimple_stmt_iterator *gsi) |
1724 |
+{ |
1725 |
-+ gimple track_stack; |
1726 |
++ gcall *track_stack; |
1727 |
++ cgraph_node_ptr node; |
1728 |
++ int frequency; |
1729 |
++ basic_block bb; |
1730 |
+ |
1731 |
+ // insert call to void pax_track_stack(void) |
1732 |
+ track_stack = gimple_build_call(track_function_decl, 0); |
1733 |
+ gsi_insert_after(gsi, track_stack, GSI_CONTINUE_LINKING); |
1734 |
++ |
1735 |
++ // update the cgraph |
1736 |
++ bb = gimple_bb(track_stack); |
1737 |
++ node = cgraph_get_create_node(track_function_decl); |
1738 |
++ gcc_assert(node); |
1739 |
++ frequency = compute_call_stmt_bb_frequency(current_function_decl, bb); |
1740 |
++ cgraph_create_edge(cgraph_get_node(current_function_decl), node, track_stack, bb->count, frequency, bb->loop_depth); |
1741 |
+} |
1742 |
+ |
1743 |
+static bool is_alloca(gimple stmt) |
1744 |
@@ -127429,16 +128164,20 @@ index 0000000..51dc09d |
1745 |
+ track_function_decl = build_fn_decl(track_function, fntype); |
1746 |
+ DECL_ASSEMBLER_NAME(track_function_decl); // for LTO |
1747 |
+ TREE_PUBLIC(track_function_decl) = 1; |
1748 |
++ TREE_USED(track_function_decl) = 1; |
1749 |
+ DECL_EXTERNAL(track_function_decl) = 1; |
1750 |
+ DECL_ARTIFICIAL(track_function_decl) = 1; |
1751 |
++ DECL_PRESERVE_P(track_function_decl) = 1; |
1752 |
+ |
1753 |
+ // void pax_check_alloca(unsigned long) |
1754 |
+ fntype = build_function_type_list(void_type_node, long_unsigned_type_node, NULL_TREE); |
1755 |
+ check_function_decl = build_fn_decl(check_function, fntype); |
1756 |
+ DECL_ASSEMBLER_NAME(check_function_decl); // for LTO |
1757 |
+ TREE_PUBLIC(check_function_decl) = 1; |
1758 |
++ TREE_USED(check_function_decl) = 1; |
1759 |
+ DECL_EXTERNAL(check_function_decl) = 1; |
1760 |
+ DECL_ARTIFICIAL(check_function_decl) = 1; |
1761 |
++ DECL_PRESERVE_P(check_function_decl) = 1; |
1762 |
+} |
1763 |
+ |
1764 |
+#if BUILDING_GCC_VERSION >= 4009 |
1765 |
|
1766 |
diff --git a/3.19.6/0000_README b/3.19.6/0000_README |
1767 |
index 725e5d4..db4d6ad 100644 |
1768 |
--- a/3.19.6/0000_README |
1769 |
+++ b/3.19.6/0000_README |
1770 |
@@ -6,7 +6,7 @@ Patch: 1005_linux-3.19.6.patch |
1771 |
From: http://www.kernel.org |
1772 |
Desc: Linux 3.19.6 |
1773 |
|
1774 |
-Patch: 4420_grsecurity-3.1-3.19.6-201504290821.patch |
1775 |
+Patch: 4420_grsecurity-3.1-3.19.6-201504302119.patch |
1776 |
From: http://www.grsecurity.net |
1777 |
Desc: hardened-sources base patch from upstream grsecurity |
1778 |
|
1779 |
|
1780 |
diff --git a/3.19.6/4420_grsecurity-3.1-3.19.6-201504290821.patch b/3.19.6/4420_grsecurity-3.1-3.19.6-201504302119.patch |
1781 |
similarity index 99% |
1782 |
rename from 3.19.6/4420_grsecurity-3.1-3.19.6-201504290821.patch |
1783 |
rename to 3.19.6/4420_grsecurity-3.1-3.19.6-201504302119.patch |
1784 |
index 68f5d26..8de6fff 100644 |
1785 |
--- a/3.19.6/4420_grsecurity-3.1-3.19.6-201504290821.patch |
1786 |
+++ b/3.19.6/4420_grsecurity-3.1-3.19.6-201504302119.patch |
1787 |
@@ -20972,7 +20972,7 @@ index c4a8d63..fe893ac 100644 |
1788 |
.name = "bigsmp", |
1789 |
.probe = probe_bigsmp, |
1790 |
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c |
1791 |
-index 3f5f604..309c0e6 100644 |
1792 |
+index 3f5f604..07a35cf 100644 |
1793 |
--- a/arch/x86/kernel/apic/io_apic.c |
1794 |
+++ b/arch/x86/kernel/apic/io_apic.c |
1795 |
@@ -1859,7 +1859,7 @@ int native_ioapic_set_affinity(struct irq_data *data, |
1796 |
@@ -20993,6 +20993,24 @@ index 3f5f604..309c0e6 100644 |
1797 |
|
1798 |
eoi_ioapic_irq(irq, cfg); |
1799 |
} |
1800 |
+@@ -2008,7 +2008,7 @@ static void ack_ioapic_level(struct irq_data *data) |
1801 |
+ ioapic_irqd_unmask(data, cfg, masked); |
1802 |
+ } |
1803 |
+ |
1804 |
+-static struct irq_chip ioapic_chip __read_mostly = { |
1805 |
++static struct irq_chip ioapic_chip = { |
1806 |
+ .name = "IO-APIC", |
1807 |
+ .irq_startup = startup_ioapic_irq, |
1808 |
+ .irq_mask = mask_ioapic_irq, |
1809 |
+@@ -2067,7 +2067,7 @@ static void ack_lapic_irq(struct irq_data *data) |
1810 |
+ ack_APIC_irq(); |
1811 |
+ } |
1812 |
+ |
1813 |
+-static struct irq_chip lapic_chip __read_mostly = { |
1814 |
++static struct irq_chip lapic_chip = { |
1815 |
+ .name = "local-APIC", |
1816 |
+ .irq_mask = mask_lapic_irq, |
1817 |
+ .irq_unmask = unmask_lapic_irq, |
1818 |
diff --git a/arch/x86/kernel/apic/probe_32.c b/arch/x86/kernel/apic/probe_32.c |
1819 |
index bda4886..f9c7195 100644 |
1820 |
--- a/arch/x86/kernel/apic/probe_32.c |
1821 |
@@ -21077,7 +21095,7 @@ index 8e9dcfd..c61b3e4 100644 |
1822 |
.name = "UV large system", |
1823 |
.probe = uv_probe, |
1824 |
diff --git a/arch/x86/kernel/apm_32.c b/arch/x86/kernel/apm_32.c |
1825 |
-index 927ec92..0dc3bd4 100644 |
1826 |
+index 927ec92..de68f32 100644 |
1827 |
--- a/arch/x86/kernel/apm_32.c |
1828 |
+++ b/arch/x86/kernel/apm_32.c |
1829 |
@@ -432,7 +432,7 @@ static DEFINE_MUTEX(apm_mutex); |
1830 |
@@ -21135,6 +21153,15 @@ index 927ec92..0dc3bd4 100644 |
1831 |
put_cpu(); |
1832 |
return error; |
1833 |
} |
1834 |
+@@ -2039,7 +2053,7 @@ static int __init swab_apm_power_in_minutes(const struct dmi_system_id *d) |
1835 |
+ return 0; |
1836 |
+ } |
1837 |
+ |
1838 |
+-static struct dmi_system_id __initdata apm_dmi_table[] = { |
1839 |
++static const struct dmi_system_id __initconst apm_dmi_table[] = { |
1840 |
+ { |
1841 |
+ print_if_true, |
1842 |
+ KERN_WARNING "IBM T23 - BIOS 1.03b+ and controller firmware 1.02+ may be needed for Linux APM.", |
1843 |
@@ -2349,12 +2363,15 @@ static int __init apm_init(void) |
1844 |
* code to that CPU. |
1845 |
*/ |
1846 |
@@ -27041,7 +27068,7 @@ index 2f355d2..e75ed0a 100644 |
1847 |
|
1848 |
return ret; |
1849 |
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c |
1850 |
-index 86db4bc..531675b 100644 |
1851 |
+index 86db4bc..a50a54a 100644 |
1852 |
--- a/arch/x86/kernel/reboot.c |
1853 |
+++ b/arch/x86/kernel/reboot.c |
1854 |
@@ -70,6 +70,11 @@ static int __init set_bios_reboot(const struct dmi_system_id *d) |
1855 |
@@ -27087,6 +27114,15 @@ index 86db4bc..531675b 100644 |
1856 |
"rm" (real_mode_header->machine_real_restart_asm), |
1857 |
"a" (type)); |
1858 |
#else |
1859 |
+@@ -137,7 +164,7 @@ static int __init set_kbd_reboot(const struct dmi_system_id *d) |
1860 |
+ /* |
1861 |
+ * This is a single dmi_table handling all reboot quirks. |
1862 |
+ */ |
1863 |
+-static struct dmi_system_id __initdata reboot_dmi_table[] = { |
1864 |
++static const struct dmi_system_id __initconst reboot_dmi_table[] = { |
1865 |
+ |
1866 |
+ /* Acer */ |
1867 |
+ { /* Handle reboot issue on Acer Aspire one */ |
1868 |
@@ -511,7 +538,7 @@ void __attribute__((weak)) mach_reboot_fixups(void) |
1869 |
* This means that this function can never return, it can misbehave |
1870 |
* by not rebooting properly and hanging. |
1871 |
@@ -36511,6 +36547,28 @@ index 9b693d5..8953d54 100644 |
1872 |
{ |
1873 |
.callback = dmi_disable_osi_vista, |
1874 |
.ident = "Fujitsu Siemens", |
1875 |
+diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c |
1876 |
+index 8b67bd0..b59593e 100644 |
1877 |
+--- a/drivers/acpi/bus.c |
1878 |
++++ b/drivers/acpi/bus.c |
1879 |
+@@ -67,7 +67,7 @@ static int set_copy_dsdt(const struct dmi_system_id *id) |
1880 |
+ } |
1881 |
+ #endif |
1882 |
+ |
1883 |
+-static struct dmi_system_id dsdt_dmi_table[] __initdata = { |
1884 |
++static const struct dmi_system_id dsdt_dmi_table[] __initconst = { |
1885 |
+ /* |
1886 |
+ * Invoke DSDT corruption work-around on all Toshiba Satellite. |
1887 |
+ * https://bugzilla.kernel.org/show_bug.cgi?id=14679 |
1888 |
+@@ -83,7 +83,7 @@ static struct dmi_system_id dsdt_dmi_table[] __initdata = { |
1889 |
+ {} |
1890 |
+ }; |
1891 |
+ #else |
1892 |
+-static struct dmi_system_id dsdt_dmi_table[] __initdata = { |
1893 |
++static const struct dmi_system_id dsdt_dmi_table[] __initconst = { |
1894 |
+ {} |
1895 |
+ }; |
1896 |
+ #endif |
1897 |
diff --git a/drivers/acpi/custom_method.c b/drivers/acpi/custom_method.c |
1898 |
index c68e724..e863008 100644 |
1899 |
--- a/drivers/acpi/custom_method.c |
1900 |
@@ -36555,6 +36613,45 @@ index c0d44d3..5ad8f9a 100644 |
1901 |
return 0; |
1902 |
} |
1903 |
EXPORT_SYMBOL_GPL(acpi_dev_pm_attach); |
1904 |
+diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c |
1905 |
+index 1b5853f..ab1808c 100644 |
1906 |
+--- a/drivers/acpi/ec.c |
1907 |
++++ b/drivers/acpi/ec.c |
1908 |
+@@ -1045,7 +1045,7 @@ static int ec_clear_on_resume(const struct dmi_system_id *id) |
1909 |
+ return 0; |
1910 |
+ } |
1911 |
+ |
1912 |
+-static struct dmi_system_id ec_dmi_table[] __initdata = { |
1913 |
++static const struct dmi_system_id ec_dmi_table[] __initconst = { |
1914 |
+ { |
1915 |
+ ec_skip_dsdt_scan, "Compal JFL92", { |
1916 |
+ DMI_MATCH(DMI_BIOS_VENDOR, "COMPAL"), |
1917 |
+diff --git a/drivers/acpi/pci_slot.c b/drivers/acpi/pci_slot.c |
1918 |
+index 139d9e4..9a9d799 100644 |
1919 |
+--- a/drivers/acpi/pci_slot.c |
1920 |
++++ b/drivers/acpi/pci_slot.c |
1921 |
+@@ -195,7 +195,7 @@ static int do_sta_before_sun(const struct dmi_system_id *d) |
1922 |
+ return 0; |
1923 |
+ } |
1924 |
+ |
1925 |
+-static struct dmi_system_id acpi_pci_slot_dmi_table[] __initdata = { |
1926 |
++static const struct dmi_system_id acpi_pci_slot_dmi_table[] __initconst = { |
1927 |
+ /* |
1928 |
+ * Fujitsu Primequest machines will return 1023 to indicate an |
1929 |
+ * error if the _SUN method is evaluated on SxFy objects that |
1930 |
+diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c |
1931 |
+index d9f7158..168e742 100644 |
1932 |
+--- a/drivers/acpi/processor_driver.c |
1933 |
++++ b/drivers/acpi/processor_driver.c |
1934 |
+@@ -159,7 +159,7 @@ static int acpi_cpu_soft_notify(struct notifier_block *nfb, |
1935 |
+ return NOTIFY_OK; |
1936 |
+ } |
1937 |
+ |
1938 |
+-static struct notifier_block __refdata acpi_cpu_notifier = { |
1939 |
++static struct notifier_block __refconst acpi_cpu_notifier = { |
1940 |
+ .notifier_call = acpi_cpu_soft_notify, |
1941 |
+ }; |
1942 |
+ |
1943 |
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c |
1944 |
index b27ab7a..275b1b6 100644 |
1945 |
--- a/drivers/acpi/processor_idle.c |
1946 |
@@ -36568,6 +36665,32 @@ index b27ab7a..275b1b6 100644 |
1947 |
struct cpuidle_driver *drv = &acpi_idle_driver; |
1948 |
|
1949 |
if (!pr->flags.power_setup_done) |
1950 |
+diff --git a/drivers/acpi/processor_pdc.c b/drivers/acpi/processor_pdc.c |
1951 |
+index e5dd808..1eceed1 100644 |
1952 |
+--- a/drivers/acpi/processor_pdc.c |
1953 |
++++ b/drivers/acpi/processor_pdc.c |
1954 |
+@@ -176,7 +176,7 @@ static int __init set_no_mwait(const struct dmi_system_id *id) |
1955 |
+ return 0; |
1956 |
+ } |
1957 |
+ |
1958 |
+-static struct dmi_system_id processor_idle_dmi_table[] __initdata = { |
1959 |
++static const struct dmi_system_id processor_idle_dmi_table[] __initconst = { |
1960 |
+ { |
1961 |
+ set_no_mwait, "Extensa 5220", { |
1962 |
+ DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies LTD"), |
1963 |
+diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c |
1964 |
+index 8aa9254..aeff570 100644 |
1965 |
+--- a/drivers/acpi/sleep.c |
1966 |
++++ b/drivers/acpi/sleep.c |
1967 |
+@@ -148,7 +148,7 @@ static int __init init_nvs_nosave(const struct dmi_system_id *d) |
1968 |
+ return 0; |
1969 |
+ } |
1970 |
+ |
1971 |
+-static struct dmi_system_id acpisleep_dmi_table[] __initdata = { |
1972 |
++static const struct dmi_system_id acpisleep_dmi_table[] __initconst = { |
1973 |
+ { |
1974 |
+ .callback = init_old_suspend_ordering, |
1975 |
+ .ident = "Abit KN9 (nForce4 variant)", |
1976 |
diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c |
1977 |
index 13e577c..cef11ee 100644 |
1978 |
--- a/drivers/acpi/sysfs.c |
1979 |
@@ -36586,6 +36709,32 @@ index 13e577c..cef11ee 100644 |
1980 |
|
1981 |
static void delete_gpe_attr_array(void) |
1982 |
{ |
1983 |
+diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c |
1984 |
+index d24fa19..782f1e6 100644 |
1985 |
+--- a/drivers/acpi/thermal.c |
1986 |
++++ b/drivers/acpi/thermal.c |
1987 |
+@@ -1209,7 +1209,7 @@ static int thermal_psv(const struct dmi_system_id *d) { |
1988 |
+ return 0; |
1989 |
+ } |
1990 |
+ |
1991 |
+-static struct dmi_system_id thermal_dmi_table[] __initdata = { |
1992 |
++static const struct dmi_system_id thermal_dmi_table[] __initconst = { |
1993 |
+ /* |
1994 |
+ * Award BIOS on this AOpen makes thermal control almost worthless. |
1995 |
+ * http://bugzilla.kernel.org/show_bug.cgi?id=8842 |
1996 |
+diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c |
1997 |
+index 3647ce7..e733107 100644 |
1998 |
+--- a/drivers/acpi/video.c |
1999 |
++++ b/drivers/acpi/video.c |
2000 |
+@@ -418,7 +418,7 @@ static int __init video_disable_native_backlight(const struct dmi_system_id *d) |
2001 |
+ return 0; |
2002 |
+ } |
2003 |
+ |
2004 |
+-static struct dmi_system_id video_dmi_table[] __initdata = { |
2005 |
++static const struct dmi_system_id video_dmi_table[] __initconst = { |
2006 |
+ /* |
2007 |
+ * Broken _BQC workaround http://bugzilla.kernel.org/show_bug.cgi?id=13121 |
2008 |
+ */ |
2009 |
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c |
2010 |
index 61a9c07..ea98fa1 100644 |
2011 |
--- a/drivers/ata/libahci.c |
2012 |
@@ -38766,6 +38915,19 @@ index d5d4cd8..22d561d 100644 |
2013 |
struct hpet_info *info) |
2014 |
{ |
2015 |
struct hpet_timer __iomem *timer; |
2016 |
+diff --git a/drivers/char/i8k.c b/drivers/char/i8k.c |
2017 |
+index e34a019..842a568 100644 |
2018 |
+--- a/drivers/char/i8k.c |
2019 |
++++ b/drivers/char/i8k.c |
2020 |
+@@ -684,7 +684,7 @@ static const struct i8k_config_data i8k_config_data[] = { |
2021 |
+ }, |
2022 |
+ }; |
2023 |
+ |
2024 |
+-static struct dmi_system_id i8k_dmi_table[] __initdata = { |
2025 |
++static const struct dmi_system_id i8k_dmi_table[] __initconst = { |
2026 |
+ { |
2027 |
+ .ident = "Dell Inspiron", |
2028 |
+ .matches = { |
2029 |
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c |
2030 |
index 6b65fa4..8ebbc99 100644 |
2031 |
--- a/drivers/char/ipmi/ipmi_msghandler.c |
2032 |
@@ -39132,7 +39294,7 @@ index 9cd6968..6416f00 100644 |
2033 |
|
2034 |
entropy_count = *(int *)table->data >> ENTROPY_SHIFT; |
2035 |
diff --git a/drivers/char/sonypi.c b/drivers/char/sonypi.c |
2036 |
-index e496dae..b793e7d 100644 |
2037 |
+index e496dae..3db53b6 100644 |
2038 |
--- a/drivers/char/sonypi.c |
2039 |
+++ b/drivers/char/sonypi.c |
2040 |
@@ -54,6 +54,7 @@ |
2041 |
@@ -39173,6 +39335,15 @@ index e496dae..b793e7d 100644 |
2042 |
mutex_unlock(&sonypi_device.lock); |
2043 |
|
2044 |
return 0; |
2045 |
+@@ -1491,7 +1492,7 @@ static struct platform_driver sonypi_driver = { |
2046 |
+ |
2047 |
+ static struct platform_device *sonypi_platform_device; |
2048 |
+ |
2049 |
+-static struct dmi_system_id __initdata sonypi_dmi_table[] = { |
2050 |
++static const struct dmi_system_id __initconst sonypi_dmi_table[] = { |
2051 |
+ { |
2052 |
+ .ident = "Sony Vaio", |
2053 |
+ .matches = { |
2054 |
diff --git a/drivers/char/tpm/tpm_acpi.c b/drivers/char/tpm/tpm_acpi.c |
2055 |
index 565a947..dcdc06e 100644 |
2056 |
--- a/drivers/char/tpm/tpm_acpi.c |
2057 |
@@ -40247,10 +40418,45 @@ index f256ecd..387dcb1 100644 |
2058 |
int error; |
2059 |
|
2060 |
/* new_var */ |
2061 |
+diff --git a/drivers/firmware/efi/runtime-map.c b/drivers/firmware/efi/runtime-map.c |
2062 |
+index 87b8e3b..c4afb35 100644 |
2063 |
+--- a/drivers/firmware/efi/runtime-map.c |
2064 |
++++ b/drivers/firmware/efi/runtime-map.c |
2065 |
+@@ -97,7 +97,7 @@ static void map_release(struct kobject *kobj) |
2066 |
+ kfree(entry); |
2067 |
+ } |
2068 |
+ |
2069 |
+-static struct kobj_type __refdata map_ktype = { |
2070 |
++static const struct kobj_type __refconst map_ktype = { |
2071 |
+ .sysfs_ops = &map_attr_ops, |
2072 |
+ .default_attrs = def_attrs, |
2073 |
+ .release = map_release, |
2074 |
+diff --git a/drivers/firmware/google/gsmi.c b/drivers/firmware/google/gsmi.c |
2075 |
+index f1ab05e..ab51228 100644 |
2076 |
+--- a/drivers/firmware/google/gsmi.c |
2077 |
++++ b/drivers/firmware/google/gsmi.c |
2078 |
+@@ -709,7 +709,7 @@ static u32 __init hash_oem_table_id(char s[8]) |
2079 |
+ return local_hash_64(input, 32); |
2080 |
+ } |
2081 |
+ |
2082 |
+-static struct dmi_system_id gsmi_dmi_table[] __initdata = { |
2083 |
++static const struct dmi_system_id gsmi_dmi_table[] __initconst = { |
2084 |
+ { |
2085 |
+ .ident = "Google Board", |
2086 |
+ .matches = { |
2087 |
diff --git a/drivers/firmware/google/memconsole.c b/drivers/firmware/google/memconsole.c |
2088 |
-index 2f569aa..c95f4fb 100644 |
2089 |
+index 2f569aa..26e4f39 100644 |
2090 |
--- a/drivers/firmware/google/memconsole.c |
2091 |
+++ b/drivers/firmware/google/memconsole.c |
2092 |
+@@ -136,7 +136,7 @@ static bool __init found_memconsole(void) |
2093 |
+ return false; |
2094 |
+ } |
2095 |
+ |
2096 |
+-static struct dmi_system_id memconsole_dmi_table[] __initdata = { |
2097 |
++static const struct dmi_system_id memconsole_dmi_table[] __initconst = { |
2098 |
+ { |
2099 |
+ .ident = "Google Board", |
2100 |
+ .matches = { |
2101 |
@@ -155,7 +155,10 @@ static int __init memconsole_init(void) |
2102 |
if (!found_memconsole()) |
2103 |
return -ENODEV; |
2104 |
@@ -40263,6 +40469,19 @@ index 2f569aa..c95f4fb 100644 |
2105 |
return sysfs_create_bin_file(firmware_kobj, &memconsole_bin_attr); |
2106 |
} |
2107 |
|
2108 |
+diff --git a/drivers/firmware/memmap.c b/drivers/firmware/memmap.c |
2109 |
+index cc016c61..d35279e 100644 |
2110 |
+--- a/drivers/firmware/memmap.c |
2111 |
++++ b/drivers/firmware/memmap.c |
2112 |
+@@ -124,7 +124,7 @@ static void __meminit release_firmware_map_entry(struct kobject *kobj) |
2113 |
+ kfree(entry); |
2114 |
+ } |
2115 |
+ |
2116 |
+-static struct kobj_type __refdata memmap_ktype = { |
2117 |
++static const struct kobj_type __refconst memmap_ktype = { |
2118 |
+ .release = release_firmware_map_entry, |
2119 |
+ .sysfs_ops = &memmap_attr_ops, |
2120 |
+ .default_attrs = def_attrs, |
2121 |
diff --git a/drivers/gpio/gpio-em.c b/drivers/gpio/gpio-em.c |
2122 |
index 3cfcfc6..09d6f117 100644 |
2123 |
--- a/drivers/gpio/gpio-em.c |
2124 |
@@ -42127,7 +42346,7 @@ index 4d6b269..2e23b86 100644 |
2125 |
child_device_obj->device.bus = &hv_bus; |
2126 |
child_device_obj->device.parent = &hv_acpi_dev->dev; |
2127 |
diff --git a/drivers/hwmon/acpi_power_meter.c b/drivers/hwmon/acpi_power_meter.c |
2128 |
-index 579bdf9..75118b5 100644 |
2129 |
+index 579bdf9..0dac21d5 100644 |
2130 |
--- a/drivers/hwmon/acpi_power_meter.c |
2131 |
+++ b/drivers/hwmon/acpi_power_meter.c |
2132 |
@@ -116,7 +116,7 @@ struct sensor_template { |
2133 |
@@ -42148,6 +42367,15 @@ index 579bdf9..75118b5 100644 |
2134 |
&resource->sensors[resource->num_sensors]; |
2135 |
int res = 0; |
2136 |
|
2137 |
+@@ -973,7 +973,7 @@ static int __init enable_cap_knobs(const struct dmi_system_id *d) |
2138 |
+ return 0; |
2139 |
+ } |
2140 |
+ |
2141 |
+-static struct dmi_system_id __initdata pm_dmi_table[] = { |
2142 |
++static const struct dmi_system_id __initconst pm_dmi_table[] = { |
2143 |
+ { |
2144 |
+ enable_cap_knobs, "IBM Active Energy Manager", |
2145 |
+ { |
2146 |
diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c |
2147 |
index 0af63da..05a183a 100644 |
2148 |
--- a/drivers/hwmon/applesmc.c |
2149 |
@@ -43530,6 +43758,19 @@ index 71ef5d6..93380a9 100644 |
2150 |
kref_init(&serio_raw->kref); |
2151 |
INIT_LIST_HEAD(&serio_raw->client_list); |
2152 |
init_waitqueue_head(&serio_raw->wait); |
2153 |
+diff --git a/drivers/input/touchscreen/htcpen.c b/drivers/input/touchscreen/htcpen.c |
2154 |
+index 92e2243..8fd9092 100644 |
2155 |
+--- a/drivers/input/touchscreen/htcpen.c |
2156 |
++++ b/drivers/input/touchscreen/htcpen.c |
2157 |
+@@ -219,7 +219,7 @@ static struct isa_driver htcpen_isa_driver = { |
2158 |
+ } |
2159 |
+ }; |
2160 |
+ |
2161 |
+-static struct dmi_system_id htcshift_dmi_table[] __initdata = { |
2162 |
++static const struct dmi_system_id htcshift_dmi_table[] __initconst = { |
2163 |
+ { |
2164 |
+ .ident = "Shift", |
2165 |
+ .matches = { |
2166 |
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c |
2167 |
index 9802485..2e9941d 100644 |
2168 |
--- a/drivers/iommu/amd_iommu.c |
2169 |
@@ -46469,6 +46710,19 @@ index 9a8e185..27ff17d 100644 |
2170 |
static char **event_name; |
2171 |
|
2172 |
static u8 avg_sample = SAMPLE_16; |
2173 |
+diff --git a/drivers/mfd/kempld-core.c b/drivers/mfd/kempld-core.c |
2174 |
+index 5615522..1eb6f3dc 100644 |
2175 |
+--- a/drivers/mfd/kempld-core.c |
2176 |
++++ b/drivers/mfd/kempld-core.c |
2177 |
+@@ -499,7 +499,7 @@ static struct platform_driver kempld_driver = { |
2178 |
+ .remove = kempld_remove, |
2179 |
+ }; |
2180 |
+ |
2181 |
+-static struct dmi_system_id kempld_dmi_table[] __initdata = { |
2182 |
++static const struct dmi_system_id kempld_dmi_table[] __initconst = { |
2183 |
+ { |
2184 |
+ .ident = "BHL6", |
2185 |
+ .matches = { |
2186 |
diff --git a/drivers/mfd/max8925-i2c.c b/drivers/mfd/max8925-i2c.c |
2187 |
index c880c89..45a7c68 100644 |
2188 |
--- a/drivers/mfd/max8925-i2c.c |
2189 |
@@ -48260,6 +48514,19 @@ index 08c483b..2c4a553 100644 |
2190 |
} |
2191 |
|
2192 |
/* To mask all all interrupts.*/ |
2193 |
+diff --git a/drivers/net/ethernet/via/via-rhine.c b/drivers/net/ethernet/via/via-rhine.c |
2194 |
+index a191afc..d218a12 100644 |
2195 |
+--- a/drivers/net/ethernet/via/via-rhine.c |
2196 |
++++ b/drivers/net/ethernet/via/via-rhine.c |
2197 |
+@@ -2513,7 +2513,7 @@ static struct platform_driver rhine_driver_platform = { |
2198 |
+ } |
2199 |
+ }; |
2200 |
+ |
2201 |
+-static struct dmi_system_id rhine_dmi_table[] __initdata = { |
2202 |
++static const struct dmi_system_id rhine_dmi_table[] __initconst = { |
2203 |
+ { |
2204 |
+ .ident = "EPIA-M", |
2205 |
+ .matches = { |
2206 |
diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h |
2207 |
index 384ca4f..dd7d4f9 100644 |
2208 |
--- a/drivers/net/hyperv/hyperv_net.h |
2209 |
@@ -49998,6 +50265,19 @@ index e1e7026..d28dd33 100644 |
2210 |
#define ASPM_STATE_L0S (ASPM_STATE_L0S_UP | ASPM_STATE_L0S_DW) |
2211 |
#define ASPM_STATE_ALL (ASPM_STATE_L0S | ASPM_STATE_L1) |
2212 |
|
2213 |
+diff --git a/drivers/pci/pcie/portdrv_pci.c b/drivers/pci/pcie/portdrv_pci.c |
2214 |
+index be35da2..ec16cdb 100644 |
2215 |
+--- a/drivers/pci/pcie/portdrv_pci.c |
2216 |
++++ b/drivers/pci/pcie/portdrv_pci.c |
2217 |
+@@ -324,7 +324,7 @@ static int __init dmi_pcie_pme_disable_msi(const struct dmi_system_id *d) |
2218 |
+ return 0; |
2219 |
+ } |
2220 |
+ |
2221 |
+-static struct dmi_system_id __initdata pcie_portdrv_dmi_table[] = { |
2222 |
++static const struct dmi_system_id __initconst pcie_portdrv_dmi_table[] = { |
2223 |
+ /* |
2224 |
+ * Boxes that should not use MSI for PCIe PME signaling. |
2225 |
+ */ |
2226 |
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c |
2227 |
index 23212f8..65e945b 100644 |
2228 |
--- a/drivers/pci/probe.c |
2229 |
@@ -50045,6 +50325,19 @@ index b84fdd6..b89d829 100644 |
2230 |
{ |
2231 |
.ident = "Samsung Series 5 550", |
2232 |
.matches = { |
2233 |
+diff --git a/drivers/platform/chrome/chromeos_pstore.c b/drivers/platform/chrome/chromeos_pstore.c |
2234 |
+index 3474920..acc9581 100644 |
2235 |
+--- a/drivers/platform/chrome/chromeos_pstore.c |
2236 |
++++ b/drivers/platform/chrome/chromeos_pstore.c |
2237 |
+@@ -13,7 +13,7 @@ |
2238 |
+ #include <linux/platform_device.h> |
2239 |
+ #include <linux/pstore_ram.h> |
2240 |
+ |
2241 |
+-static struct dmi_system_id chromeos_pstore_dmi_table[] __initdata = { |
2242 |
++static const struct dmi_system_id chromeos_pstore_dmi_table[] __initconst = { |
2243 |
+ { |
2244 |
+ /* |
2245 |
+ * Today all Chromebooks/boxes ship with Google_* as version and |
2246 |
diff --git a/drivers/platform/x86/alienware-wmi.c b/drivers/platform/x86/alienware-wmi.c |
2247 |
index 1e1e594..8fe59c5 100644 |
2248 |
--- a/drivers/platform/x86/alienware-wmi.c |
2249 |
@@ -50104,10 +50397,71 @@ index 7543a56..367ca8ed 100644 |
2250 |
status = wmi_evaluate_method(ASUS_WMI_MGMT_GUID, |
2251 |
1, asus->debug.method_id, |
2252 |
&input, &output); |
2253 |
+diff --git a/drivers/platform/x86/compal-laptop.c b/drivers/platform/x86/compal-laptop.c |
2254 |
+index 15c0fab..f674006 100644 |
2255 |
+--- a/drivers/platform/x86/compal-laptop.c |
2256 |
++++ b/drivers/platform/x86/compal-laptop.c |
2257 |
+@@ -766,7 +766,7 @@ static int dmi_check_cb_extra(const struct dmi_system_id *id) |
2258 |
+ return 1; |
2259 |
+ } |
2260 |
+ |
2261 |
+-static struct dmi_system_id __initdata compal_dmi_table[] = { |
2262 |
++static const struct dmi_system_id __initconst compal_dmi_table[] = { |
2263 |
+ { |
2264 |
+ .ident = "FL90/IFL90", |
2265 |
+ .matches = { |
2266 |
+diff --git a/drivers/platform/x86/hdaps.c b/drivers/platform/x86/hdaps.c |
2267 |
+index 458e6c9..089aee7 100644 |
2268 |
+--- a/drivers/platform/x86/hdaps.c |
2269 |
++++ b/drivers/platform/x86/hdaps.c |
2270 |
+@@ -514,7 +514,7 @@ static int __init hdaps_dmi_match_invert(const struct dmi_system_id *id) |
2271 |
+ "ThinkPad T42p", so the order of the entries matters. |
2272 |
+ If your ThinkPad is not recognized, please update to latest |
2273 |
+ BIOS. This is especially the case for some R52 ThinkPads. */ |
2274 |
+-static struct dmi_system_id __initdata hdaps_whitelist[] = { |
2275 |
++static const struct dmi_system_id __initconst hdaps_whitelist[] = { |
2276 |
+ HDAPS_DMI_MATCH_INVERT("IBM", "ThinkPad R50p", HDAPS_BOTH_AXES), |
2277 |
+ HDAPS_DMI_MATCH_NORMAL("IBM", "ThinkPad R50"), |
2278 |
+ HDAPS_DMI_MATCH_NORMAL("IBM", "ThinkPad R51"), |
2279 |
+diff --git a/drivers/platform/x86/ibm_rtl.c b/drivers/platform/x86/ibm_rtl.c |
2280 |
+index 97c2be1..2ee50ce 100644 |
2281 |
+--- a/drivers/platform/x86/ibm_rtl.c |
2282 |
++++ b/drivers/platform/x86/ibm_rtl.c |
2283 |
+@@ -227,7 +227,7 @@ static void rtl_teardown_sysfs(void) { |
2284 |
+ } |
2285 |
+ |
2286 |
+ |
2287 |
+-static struct dmi_system_id __initdata ibm_rtl_dmi_table[] = { |
2288 |
++static const struct dmi_system_id __initconst ibm_rtl_dmi_table[] = { |
2289 |
+ { \ |
2290 |
+ .matches = { \ |
2291 |
+ DMI_MATCH(DMI_SYS_VENDOR, "IBM"), \ |
2292 |
+diff --git a/drivers/platform/x86/intel_oaktrail.c b/drivers/platform/x86/intel_oaktrail.c |
2293 |
+index a4a4258..a58a04c 100644 |
2294 |
+--- a/drivers/platform/x86/intel_oaktrail.c |
2295 |
++++ b/drivers/platform/x86/intel_oaktrail.c |
2296 |
+@@ -298,7 +298,7 @@ static int dmi_check_cb(const struct dmi_system_id *id) |
2297 |
+ return 0; |
2298 |
+ } |
2299 |
+ |
2300 |
+-static struct dmi_system_id __initdata oaktrail_dmi_table[] = { |
2301 |
++static const struct dmi_system_id __initconst oaktrail_dmi_table[] = { |
2302 |
+ { |
2303 |
+ .ident = "OakTrail platform", |
2304 |
+ .matches = { |
2305 |
diff --git a/drivers/platform/x86/msi-laptop.c b/drivers/platform/x86/msi-laptop.c |
2306 |
-index 0859877..1cf7d08 100644 |
2307 |
+index 0859877..59d596d 100644 |
2308 |
--- a/drivers/platform/x86/msi-laptop.c |
2309 |
+++ b/drivers/platform/x86/msi-laptop.c |
2310 |
+@@ -604,7 +604,7 @@ static int dmi_check_cb(const struct dmi_system_id *dmi) |
2311 |
+ return 1; |
2312 |
+ } |
2313 |
+ |
2314 |
+-static struct dmi_system_id __initdata msi_dmi_table[] = { |
2315 |
++static const struct dmi_system_id __initconst msi_dmi_table[] = { |
2316 |
+ { |
2317 |
+ .ident = "MSI S270", |
2318 |
+ .matches = { |
2319 |
@@ -999,12 +999,14 @@ static int __init load_scm_model_init(struct platform_device *sdev) |
2320 |
|
2321 |
if (!quirks->ec_read_only) { |
2322 |
@@ -50142,8 +50496,34 @@ index 6d2bac0..ec2b029 100644 |
2323 |
union acpi_object *obj; |
2324 |
acpi_status status; |
2325 |
|
2326 |
+diff --git a/drivers/platform/x86/samsung-laptop.c b/drivers/platform/x86/samsung-laptop.c |
2327 |
+index ce364a4..5074643 100644 |
2328 |
+--- a/drivers/platform/x86/samsung-laptop.c |
2329 |
++++ b/drivers/platform/x86/samsung-laptop.c |
2330 |
+@@ -1465,7 +1465,7 @@ static int __init samsung_dmi_matched(const struct dmi_system_id *d) |
2331 |
+ return 0; |
2332 |
+ } |
2333 |
+ |
2334 |
+-static struct dmi_system_id __initdata samsung_dmi_table[] = { |
2335 |
++static const struct dmi_system_id __initconst samsung_dmi_table[] = { |
2336 |
+ { |
2337 |
+ .matches = { |
2338 |
+ DMI_MATCH(DMI_SYS_VENDOR, |
2339 |
+diff --git a/drivers/platform/x86/samsung-q10.c b/drivers/platform/x86/samsung-q10.c |
2340 |
+index e6aac72..e11ff24 100644 |
2341 |
+--- a/drivers/platform/x86/samsung-q10.c |
2342 |
++++ b/drivers/platform/x86/samsung-q10.c |
2343 |
+@@ -95,7 +95,7 @@ static int __init dmi_check_callback(const struct dmi_system_id *id) |
2344 |
+ return 1; |
2345 |
+ } |
2346 |
+ |
2347 |
+-static struct dmi_system_id __initdata samsungq10_dmi_table[] = { |
2348 |
++static const struct dmi_system_id __initconst samsungq10_dmi_table[] = { |
2349 |
+ { |
2350 |
+ .ident = "Samsung Q10", |
2351 |
+ .matches = { |
2352 |
diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c |
2353 |
-index 6dd1c0e..5d602c7 100644 |
2354 |
+index 6dd1c0e..78b9f0a 100644 |
2355 |
--- a/drivers/platform/x86/sony-laptop.c |
2356 |
+++ b/drivers/platform/x86/sony-laptop.c |
2357 |
@@ -2526,7 +2526,7 @@ static void sony_nc_gfx_switch_cleanup(struct platform_device *pd) |
2358 |
@@ -50200,6 +50580,15 @@ index 6dd1c0e..5d602c7 100644 |
2359 |
|
2360 |
static ssize_t sony_nc_smart_conn_store(struct device *dev, |
2361 |
struct device_attribute *attr, |
2362 |
+@@ -4854,7 +4854,7 @@ static struct acpi_driver sony_pic_driver = { |
2363 |
+ .drv.pm = &sony_pic_pm, |
2364 |
+ }; |
2365 |
+ |
2366 |
+-static struct dmi_system_id __initdata sonypi_dmi_table[] = { |
2367 |
++static const struct dmi_system_id __initconst sonypi_dmi_table[] = { |
2368 |
+ { |
2369 |
+ .ident = "Sony Vaio", |
2370 |
+ .matches = { |
2371 |
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c |
2372 |
index c3d11fa..f83cded 100644 |
2373 |
--- a/drivers/platform/x86/thinkpad_acpi.c |
2374 |
@@ -50285,6 +50674,19 @@ index 438d4c7..ca8a2fb 100644 |
2375 |
+ |
2376 |
+ pax_close_kernel(); |
2377 |
} |
2378 |
+diff --git a/drivers/pnp/pnpbios/core.c b/drivers/pnp/pnpbios/core.c |
2379 |
+index 074569e..d807bef 100644 |
2380 |
+--- a/drivers/pnp/pnpbios/core.c |
2381 |
++++ b/drivers/pnp/pnpbios/core.c |
2382 |
+@@ -493,7 +493,7 @@ static int __init exploding_pnp_bios(const struct dmi_system_id *d) |
2383 |
+ return 0; |
2384 |
+ } |
2385 |
+ |
2386 |
+-static struct dmi_system_id pnpbios_dmi_table[] __initdata = { |
2387 |
++static const struct dmi_system_id pnpbios_dmi_table[] __initconst = { |
2388 |
+ { /* PnPBIOS GPF on boot */ |
2389 |
+ .callback = exploding_pnp_bios, |
2390 |
+ .ident = "Higraded P14H", |
2391 |
diff --git a/drivers/power/pda_power.c b/drivers/power/pda_power.c |
2392 |
index 0c52e2a..3421ab7 100644 |
2393 |
--- a/drivers/power/pda_power.c |
2394 |
@@ -52527,6 +52929,19 @@ index d717f3d..cae1cc3e 100644 |
2395 |
|
2396 |
tz->ops = NULL; |
2397 |
tz->sensor_data = NULL; |
2398 |
+diff --git a/drivers/thermal/x86_pkg_temp_thermal.c b/drivers/thermal/x86_pkg_temp_thermal.c |
2399 |
+index 9ea3d9d..53e8792 100644 |
2400 |
+--- a/drivers/thermal/x86_pkg_temp_thermal.c |
2401 |
++++ b/drivers/thermal/x86_pkg_temp_thermal.c |
2402 |
+@@ -567,7 +567,7 @@ static int pkg_temp_thermal_cpu_callback(struct notifier_block *nfb, |
2403 |
+ return NOTIFY_OK; |
2404 |
+ } |
2405 |
+ |
2406 |
+-static struct notifier_block pkg_temp_thermal_notifier __refdata = { |
2407 |
++static struct notifier_block pkg_temp_thermal_notifier __refconst = { |
2408 |
+ .notifier_call = pkg_temp_thermal_cpu_callback, |
2409 |
+ }; |
2410 |
+ |
2411 |
diff --git a/drivers/tty/cyclades.c b/drivers/tty/cyclades.c |
2412 |
index fd66f57..48e6376 100644 |
2413 |
--- a/drivers/tty/cyclades.c |
2414 |
@@ -58114,6 +58529,37 @@ index 3c14e43..2630570 100644 |
2415 |
+4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 |
2416 |
+4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 |
2417 |
+4 4 4 4 4 4 |
2418 |
+diff --git a/drivers/xen/events/events_base.c b/drivers/xen/events/events_base.c |
2419 |
+index 70fba97..8ec7f86 100644 |
2420 |
+--- a/drivers/xen/events/events_base.c |
2421 |
++++ b/drivers/xen/events/events_base.c |
2422 |
+@@ -1563,7 +1563,7 @@ void xen_irq_resume(void) |
2423 |
+ restore_pirqs(); |
2424 |
+ } |
2425 |
+ |
2426 |
+-static struct irq_chip xen_dynamic_chip __read_mostly = { |
2427 |
++static struct irq_chip xen_dynamic_chip = { |
2428 |
+ .name = "xen-dyn", |
2429 |
+ |
2430 |
+ .irq_disable = disable_dynirq, |
2431 |
+@@ -1577,7 +1577,7 @@ static struct irq_chip xen_dynamic_chip __read_mostly = { |
2432 |
+ .irq_retrigger = retrigger_dynirq, |
2433 |
+ }; |
2434 |
+ |
2435 |
+-static struct irq_chip xen_pirq_chip __read_mostly = { |
2436 |
++static struct irq_chip xen_pirq_chip = { |
2437 |
+ .name = "xen-pirq", |
2438 |
+ |
2439 |
+ .irq_startup = startup_pirq, |
2440 |
+@@ -1597,7 +1597,7 @@ static struct irq_chip xen_pirq_chip __read_mostly = { |
2441 |
+ .irq_retrigger = retrigger_dynirq, |
2442 |
+ }; |
2443 |
+ |
2444 |
+-static struct irq_chip xen_percpu_chip __read_mostly = { |
2445 |
++static struct irq_chip xen_percpu_chip = { |
2446 |
+ .name = "xen-percpu", |
2447 |
+ |
2448 |
+ .irq_disable = disable_dynirq, |
2449 |
diff --git a/drivers/xen/xenfs/xenstored.c b/drivers/xen/xenfs/xenstored.c |
2450 |
index fef20db..d28b1ab 100644 |
2451 |
--- a/drivers/xen/xenfs/xenstored.c |
2452 |
@@ -62052,7 +62498,7 @@ index 5797d45..7d7d79a 100644 |
2453 |
|
2454 |
if (dot && fs && !(fs->fs_flags & FS_HAS_SUBTYPE)) { |
2455 |
diff --git a/fs/fs_struct.c b/fs/fs_struct.c |
2456 |
-index 7dca743..2f2786d 100644 |
2457 |
+index 7dca743..1ff87ae 100644 |
2458 |
--- a/fs/fs_struct.c |
2459 |
+++ b/fs/fs_struct.c |
2460 |
@@ -4,6 +4,7 @@ |
2461 |
@@ -62121,7 +62567,7 @@ index 7dca743..2f2786d 100644 |
2462 |
fs->in_exec = 0; |
2463 |
spin_lock_init(&fs->lock); |
2464 |
seqcount_init(&fs->seq); |
2465 |
-@@ -121,6 +132,9 @@ struct fs_struct *copy_fs_struct(struct fs_struct *old) |
2466 |
+@@ -121,9 +132,13 @@ struct fs_struct *copy_fs_struct(struct fs_struct *old) |
2467 |
spin_lock(&old->lock); |
2468 |
fs->root = old->root; |
2469 |
path_get(&fs->root); |
2470 |
@@ -62131,7 +62577,11 @@ index 7dca743..2f2786d 100644 |
2471 |
fs->pwd = old->pwd; |
2472 |
path_get(&fs->pwd); |
2473 |
spin_unlock(&old->lock); |
2474 |
-@@ -139,8 +153,9 @@ int unshare_fs_struct(void) |
2475 |
++ gr_inc_chroot_refcnts(fs->root.dentry, fs->root.mnt); |
2476 |
+ } |
2477 |
+ return fs; |
2478 |
+ } |
2479 |
+@@ -139,8 +154,9 @@ int unshare_fs_struct(void) |
2480 |
|
2481 |
task_lock(current); |
2482 |
spin_lock(&fs->lock); |
2483 |
@@ -62142,7 +62592,7 @@ index 7dca743..2f2786d 100644 |
2484 |
spin_unlock(&fs->lock); |
2485 |
task_unlock(current); |
2486 |
|
2487 |
-@@ -153,13 +168,13 @@ EXPORT_SYMBOL_GPL(unshare_fs_struct); |
2488 |
+@@ -153,13 +169,13 @@ EXPORT_SYMBOL_GPL(unshare_fs_struct); |
2489 |
|
2490 |
int current_umask(void) |
2491 |
{ |
2492 |
@@ -80455,10 +80905,10 @@ index d1a5582..4424efa 100644 |
2493 |
* Mark a position in code as unreachable. This can be used to |
2494 |
* suppress control flow warnings after asm blocks that transfer |
2495 |
diff --git a/include/linux/compiler-gcc5.h b/include/linux/compiler-gcc5.h |
2496 |
-index c8c5659..2401b2e 100644 |
2497 |
+index c8c5659..9b20f4e 100644 |
2498 |
--- a/include/linux/compiler-gcc5.h |
2499 |
+++ b/include/linux/compiler-gcc5.h |
2500 |
-@@ -28,6 +28,26 @@ |
2501 |
+@@ -28,6 +28,25 @@ |
2502 |
# define __compiletime_error(message) __attribute__((error(message))) |
2503 |
#endif /* __CHECKER__ */ |
2504 |
|
2505 |
@@ -80473,7 +80923,6 @@ index c8c5659..2401b2e 100644 |
2506 |
+#endif |
2507 |
+ |
2508 |
+#ifdef SIZE_OVERFLOW_PLUGIN |
2509 |
-+#error not yet |
2510 |
+#define __size_overflow(...) __attribute__((size_overflow(__VA_ARGS__))) |
2511 |
+#define __intentional_overflow(...) __attribute__((intentional_overflow(__VA_ARGS__))) |
2512 |
+#endif |
2513 |
@@ -104662,6 +105111,32 @@ index 781b3a2..73a7434 100644 |
2514 |
kfree_skb(skb); |
2515 |
} |
2516 |
|
2517 |
+diff --git a/net/l2tp/l2tp_ip.c b/net/l2tp/l2tp_ip.c |
2518 |
+index 05dfc8aa..df6cfd7 100644 |
2519 |
+--- a/net/l2tp/l2tp_ip.c |
2520 |
++++ b/net/l2tp/l2tp_ip.c |
2521 |
+@@ -608,7 +608,7 @@ static struct inet_protosw l2tp_ip_protosw = { |
2522 |
+ .ops = &l2tp_ip_ops, |
2523 |
+ }; |
2524 |
+ |
2525 |
+-static struct net_protocol l2tp_ip_protocol __read_mostly = { |
2526 |
++static const struct net_protocol l2tp_ip_protocol = { |
2527 |
+ .handler = l2tp_ip_recv, |
2528 |
+ .netns_ok = 1, |
2529 |
+ }; |
2530 |
+diff --git a/net/l2tp/l2tp_ip6.c b/net/l2tp/l2tp_ip6.c |
2531 |
+index 8611f1b..bc60a2d 100644 |
2532 |
+--- a/net/l2tp/l2tp_ip6.c |
2533 |
++++ b/net/l2tp/l2tp_ip6.c |
2534 |
+@@ -757,7 +757,7 @@ static struct inet_protosw l2tp_ip6_protosw = { |
2535 |
+ .ops = &l2tp_ip6_ops, |
2536 |
+ }; |
2537 |
+ |
2538 |
+-static struct inet6_protocol l2tp_ip6_protocol __read_mostly = { |
2539 |
++static const struct inet6_protocol l2tp_ip6_protocol = { |
2540 |
+ .handler = l2tp_ip6_recv, |
2541 |
+ }; |
2542 |
+ |
2543 |
diff --git a/net/llc/llc_proc.c b/net/llc/llc_proc.c |
2544 |
index 1a3c7e0..80f8b0c 100644 |
2545 |
--- a/net/llc/llc_proc.c |
2546 |
@@ -110456,7 +110931,7 @@ index 0000000..de92ed9 |
2547 |
+randomize_layout_seed.h |
2548 |
diff --git a/tools/gcc/Makefile b/tools/gcc/Makefile |
2549 |
new file mode 100644 |
2550 |
-index 0000000..7b8921f |
2551 |
+index 0000000..a51677e |
2552 |
--- /dev/null |
2553 |
+++ b/tools/gcc/Makefile |
2554 |
@@ -0,0 +1,52 @@ |
2555 |
@@ -110472,7 +110947,7 @@ index 0000000..7b8921f |
2556 |
+export HOST_EXTRACFLAGS |
2557 |
+else |
2558 |
+HOSTLIBS := hostcxxlibs |
2559 |
-+HOST_EXTRACXXFLAGS += -I$(GCCPLUGINS_DIR)/include -I$(src) -std=gnu++98 -fno-rtti -ggdb -Wno-unused-parameter -Wno-narrowing -Wno-unused-variable |
2560 |
++HOST_EXTRACXXFLAGS += -I$(GCCPLUGINS_DIR)/include -I$(src) -std=gnu++98 -fno-rtti -fno-exceptions -fasynchronous-unwind-tables -ggdb -Wno-unused-parameter -Wno-narrowing -Wno-unused-variable |
2561 |
+export HOST_EXTRACXXFLAGS |
2562 |
+endif |
2563 |
+ |
2564 |
@@ -111460,10 +111935,10 @@ index 0000000..93b181d |
2565 |
+} |
2566 |
diff --git a/tools/gcc/gcc-common.h b/tools/gcc/gcc-common.h |
2567 |
new file mode 100644 |
2568 |
-index 0000000..19fedf2 |
2569 |
+index 0000000..d8ec362 |
2570 |
--- /dev/null |
2571 |
+++ b/tools/gcc/gcc-common.h |
2572 |
-@@ -0,0 +1,540 @@ |
2573 |
+@@ -0,0 +1,666 @@ |
2574 |
+#ifndef GCC_COMMON_H_INCLUDED |
2575 |
+#define GCC_COMMON_H_INCLUDED |
2576 |
+ |
2577 |
@@ -111786,13 +112261,6 @@ index 0000000..19fedf2 |
2578 |
+} |
2579 |
+#endif |
2580 |
+ |
2581 |
-+#if BUILDING_GCC_VERSION >= 4007 |
2582 |
-+#define cgraph_create_edge(caller, callee, call_stmt, count, freq, nest) \ |
2583 |
-+ cgraph_create_edge((caller), (callee), (call_stmt), (count), (freq)) |
2584 |
-+#define cgraph_create_edge_including_clones(caller, callee, old_call_stmt, call_stmt, count, freq, nest, reason) \ |
2585 |
-+ cgraph_create_edge_including_clones((caller), (callee), (old_call_stmt), (call_stmt), (count), (freq), (reason)) |
2586 |
-+#endif |
2587 |
-+ |
2588 |
+#if BUILDING_GCC_VERSION == 4007 || BUILDING_GCC_VERSION == 4008 |
2589 |
+static inline struct cgraph_node *cgraph_alias_target(struct cgraph_node *n) |
2590 |
+{ |
2591 |
@@ -111800,6 +112268,13 @@ index 0000000..19fedf2 |
2592 |
+} |
2593 |
+#endif |
2594 |
+ |
2595 |
++#if BUILDING_GCC_VERSION >= 4007 && BUILDING_GCC_VERSION <= 4009 |
2596 |
++#define cgraph_create_edge(caller, callee, call_stmt, count, freq, nest) \ |
2597 |
++ cgraph_create_edge((caller), (callee), (call_stmt), (count), (freq)) |
2598 |
++#define cgraph_create_edge_including_clones(caller, callee, old_call_stmt, call_stmt, count, freq, nest, reason) \ |
2599 |
++ cgraph_create_edge_including_clones((caller), (callee), (old_call_stmt), (call_stmt), (count), (freq), (reason)) |
2600 |
++#endif |
2601 |
++ |
2602 |
+#if BUILDING_GCC_VERSION <= 4008 |
2603 |
+#define ENTRY_BLOCK_PTR_FOR_FN(FN) ENTRY_BLOCK_PTR_FOR_FUNCTION(FN) |
2604 |
+#define EXIT_BLOCK_PTR_FOR_FN(FN) EXIT_BLOCK_PTR_FOR_FUNCTION(FN) |
2605 |
@@ -111812,6 +112287,40 @@ index 0000000..19fedf2 |
2606 |
+#define BASIC_BLOCK_FOR_FN(FN, N) BASIC_BLOCK_FOR_FUNCTION((FN), (N)) |
2607 |
+#define NODE_IMPLICIT_ALIAS(node) (node)->same_body_alias |
2608 |
+ |
2609 |
++static inline bool tree_fits_shwi_p(const_tree t) |
2610 |
++{ |
2611 |
++ if (t == NULL_TREE || TREE_CODE(t) != INTEGER_CST) |
2612 |
++ return false; |
2613 |
++ |
2614 |
++ if (TREE_INT_CST_HIGH(t) == 0 && (HOST_WIDE_INT)TREE_INT_CST_LOW(t) >= 0) |
2615 |
++ return true; |
2616 |
++ |
2617 |
++ if (TREE_INT_CST_HIGH(t) == -1 && (HOST_WIDE_INT)TREE_INT_CST_LOW(t) < 0 && !TYPE_UNSIGNED(TREE_TYPE(t))) |
2618 |
++ return true; |
2619 |
++ |
2620 |
++ return false; |
2621 |
++} |
2622 |
++ |
2623 |
++static inline bool tree_fits_uhwi_p(const_tree t) |
2624 |
++{ |
2625 |
++ if (t == NULL_TREE || TREE_CODE(t) != INTEGER_CST) |
2626 |
++ return false; |
2627 |
++ |
2628 |
++ return TREE_INT_CST_HIGH(t) == 0; |
2629 |
++} |
2630 |
++ |
2631 |
++static inline HOST_WIDE_INT tree_to_shwi(const_tree t) |
2632 |
++{ |
2633 |
++ gcc_assert(tree_fits_shwi_p(t)); |
2634 |
++ return TREE_INT_CST_LOW(t); |
2635 |
++} |
2636 |
++ |
2637 |
++static inline unsigned HOST_WIDE_INT tree_to_uhwi(const_tree t) |
2638 |
++{ |
2639 |
++ gcc_assert(tree_fits_uhwi_p(t)); |
2640 |
++ return TREE_INT_CST_LOW(t); |
2641 |
++} |
2642 |
++ |
2643 |
+static inline const char *get_tree_code_name(enum tree_code code) |
2644 |
+{ |
2645 |
+ gcc_assert(code < MAX_TREE_CODES); |
2646 |
@@ -111822,6 +112331,7 @@ index 0000000..19fedf2 |
2647 |
+typedef union gimple_statement_d gasm; |
2648 |
+typedef union gimple_statement_d gassign; |
2649 |
+typedef union gimple_statement_d gcall; |
2650 |
++typedef union gimple_statement_d gcond; |
2651 |
+typedef union gimple_statement_d gdebug; |
2652 |
+typedef union gimple_statement_d gphi; |
2653 |
+typedef union gimple_statement_d greturn; |
2654 |
@@ -111849,6 +112359,7 @@ index 0000000..19fedf2 |
2655 |
+typedef struct gimple_statement_base gasm; |
2656 |
+typedef struct gimple_statement_base gassign; |
2657 |
+typedef struct gimple_statement_base gcall; |
2658 |
++typedef struct gimple_statement_base gcond; |
2659 |
+typedef struct gimple_statement_base gdebug; |
2660 |
+typedef struct gimple_statement_base gphi; |
2661 |
+typedef struct gimple_statement_base greturn; |
2662 |
@@ -111862,15 +112373,50 @@ index 0000000..19fedf2 |
2663 |
+ return stmt; |
2664 |
+} |
2665 |
+ |
2666 |
++static inline const gasm *as_a_const_gasm(const_gimple stmt) |
2667 |
++{ |
2668 |
++ return stmt; |
2669 |
++} |
2670 |
++ |
2671 |
++static inline gassign *as_a_gassign(gimple stmt) |
2672 |
++{ |
2673 |
++ return stmt; |
2674 |
++} |
2675 |
++ |
2676 |
++static inline const gassign *as_a_const_gassign(const_gimple stmt) |
2677 |
++{ |
2678 |
++ return stmt; |
2679 |
++} |
2680 |
++ |
2681 |
+static inline gcall *as_a_gcall(gimple stmt) |
2682 |
+{ |
2683 |
+ return stmt; |
2684 |
+} |
2685 |
+ |
2686 |
++static inline const gcall *as_a_const_gcall(const_gimple stmt) |
2687 |
++{ |
2688 |
++ return stmt; |
2689 |
++} |
2690 |
++ |
2691 |
++static inline gphi *as_a_gphi(gimple stmt) |
2692 |
++{ |
2693 |
++ return stmt; |
2694 |
++} |
2695 |
++ |
2696 |
++static inline const gphi *as_a_const_gphi(const_gimple stmt) |
2697 |
++{ |
2698 |
++ return stmt; |
2699 |
++} |
2700 |
++ |
2701 |
+static inline greturn *as_a_greturn(gimple stmt) |
2702 |
+{ |
2703 |
+ return stmt; |
2704 |
+} |
2705 |
++ |
2706 |
++static inline const greturn *as_a_const_greturn(const_gimple stmt) |
2707 |
++{ |
2708 |
++ return stmt; |
2709 |
++} |
2710 |
+#endif |
2711 |
+ |
2712 |
+#if BUILDING_GCC_VERSION >= 4009 |
2713 |
@@ -111887,17 +112433,23 @@ index 0000000..19fedf2 |
2714 |
+#define TODO_verify_stmts TODO_verify_il |
2715 |
+#define TODO_verify_rtl_sharing TODO_verify_il |
2716 |
+ |
2717 |
-+#define TREE_INT_CST_HIGH(NODE) ({ TREE_INT_CST_EXT_NUNITS(NODE) > 1 ? (unsigned HOST_WIDE_INT)TREE_INT_CST_ELT(NODE, 1) : 0; }) |
2718 |
++//#define TREE_INT_CST_HIGH(NODE) ({ TREE_INT_CST_EXT_NUNITS(NODE) > 1 ? (unsigned HOST_WIDE_INT)TREE_INT_CST_ELT(NODE, 1) : 0; }) |
2719 |
+ |
2720 |
+#define INSN_DELETED_P(insn) (insn)->deleted() |
2721 |
+ |
2722 |
+// symtab/cgraph related |
2723 |
+#define debug_cgraph_node(node) (node)->debug() |
2724 |
+#define cgraph_get_node(decl) cgraph_node::get(decl) |
2725 |
++#define cgraph_get_create_node(decl) cgraph_node::get_create(decl) |
2726 |
+#define cgraph_n_nodes symtab->cgraph_count |
2727 |
+#define cgraph_max_uid symtab->cgraph_max_uid |
2728 |
+#define varpool_get_node(decl) varpool_node::get(decl) |
2729 |
+ |
2730 |
++#define cgraph_create_edge(caller, callee, call_stmt, count, freq, nest) \ |
2731 |
++ (caller)->create_edge((callee), (call_stmt), (count), (freq)) |
2732 |
++#define cgraph_create_edge_including_clones(caller, callee, old_call_stmt, call_stmt, count, freq, nest, reason) \ |
2733 |
++ (caller)->create_edge_including_clones((callee), (old_call_stmt), (call_stmt), (count), (freq), (reason)) |
2734 |
++ |
2735 |
+typedef struct cgraph_node *cgraph_node_ptr; |
2736 |
+typedef struct cgraph_edge *cgraph_edge_p; |
2737 |
+typedef struct varpool_node *varpool_node_ptr; |
2738 |
@@ -111973,26 +112525,70 @@ index 0000000..19fedf2 |
2739 |
+ return gimple_build_assign(lhs, subcode, op1, op2 PASS_MEM_STAT); |
2740 |
+} |
2741 |
+ |
2742 |
++template <> |
2743 |
++template <> |
2744 |
++inline bool is_a_helper<const gassign *>::test(const_gimple gs) |
2745 |
++{ |
2746 |
++ return gs->code == GIMPLE_ASSIGN; |
2747 |
++} |
2748 |
++ |
2749 |
++template <> |
2750 |
++template <> |
2751 |
++inline bool is_a_helper<const greturn *>::test(const_gimple gs) |
2752 |
++{ |
2753 |
++ return gs->code == GIMPLE_RETURN; |
2754 |
++} |
2755 |
++ |
2756 |
+static inline gasm *as_a_gasm(gimple stmt) |
2757 |
+{ |
2758 |
+ return as_a<gasm *>(stmt); |
2759 |
+} |
2760 |
+ |
2761 |
-+static inline const gasm *as_a_gasm(const_gimple stmt) |
2762 |
++static inline const gasm *as_a_const_gasm(const_gimple stmt) |
2763 |
+{ |
2764 |
+ return as_a<const gasm *>(stmt); |
2765 |
+} |
2766 |
+ |
2767 |
++static inline gassign *as_a_gassign(gimple stmt) |
2768 |
++{ |
2769 |
++ return as_a<gassign *>(stmt); |
2770 |
++} |
2771 |
++ |
2772 |
++static inline const gassign *as_a_const_gassign(const_gimple stmt) |
2773 |
++{ |
2774 |
++ return as_a<const gassign *>(stmt); |
2775 |
++} |
2776 |
++ |
2777 |
+static inline gcall *as_a_gcall(gimple stmt) |
2778 |
+{ |
2779 |
+ return as_a<gcall *>(stmt); |
2780 |
+} |
2781 |
+ |
2782 |
++static inline const gcall *as_a_const_gcall(const_gimple stmt) |
2783 |
++{ |
2784 |
++ return as_a<const gcall *>(stmt); |
2785 |
++} |
2786 |
++ |
2787 |
++static inline gphi *as_a_gphi(gimple stmt) |
2788 |
++{ |
2789 |
++ return as_a<gphi *>(stmt); |
2790 |
++} |
2791 |
++ |
2792 |
++static inline const gphi *as_a_const_gphi(const_gimple stmt) |
2793 |
++{ |
2794 |
++ return as_a<const gphi *>(stmt); |
2795 |
++} |
2796 |
++ |
2797 |
+static inline greturn *as_a_greturn(gimple stmt) |
2798 |
+{ |
2799 |
+ return as_a<greturn *>(stmt); |
2800 |
+} |
2801 |
+ |
2802 |
++static inline const greturn *as_a_const_greturn(const_gimple stmt) |
2803 |
++{ |
2804 |
++ return as_a<const greturn *>(stmt); |
2805 |
++} |
2806 |
++ |
2807 |
+// IPA/LTO related |
2808 |
+#define ipa_ref_list_referring_iterate(L,I,P) (L)->referring.iterate((I), &(P)) |
2809 |
+#define ipa_ref_list_reference_iterate(L,I,P) (L)->reference.iterate((I), &(P)) |
2810 |
@@ -112001,6 +112597,11 @@ index 0000000..19fedf2 |
2811 |
+{ |
2812 |
+ return dyn_cast<cgraph_node_ptr>(ref->referring); |
2813 |
+} |
2814 |
++ |
2815 |
++static inline void ipa_remove_stmt_references(symtab_node *referring_node, gimple stmt) |
2816 |
++{ |
2817 |
++ referring_node->remove_stmt_references(stmt); |
2818 |
++} |
2819 |
+#endif |
2820 |
+ |
2821 |
+#endif |
2822 |
@@ -112214,7 +112815,7 @@ index 0000000..457d54e |
2823 |
+} |
2824 |
diff --git a/tools/gcc/kernexec_plugin.c b/tools/gcc/kernexec_plugin.c |
2825 |
new file mode 100644 |
2826 |
-index 0000000..71716e7 |
2827 |
+index 0000000..b0d8255 |
2828 |
--- /dev/null |
2829 |
+++ b/tools/gcc/kernexec_plugin.c |
2830 |
@@ -0,0 +1,547 @@ |
2831 |
@@ -112369,9 +112970,9 @@ index 0000000..71716e7 |
2832 |
+ new_fptr = make_ssa_name(new_fptr, NULL); |
2833 |
+ |
2834 |
+ // build asm volatile("orq %%r12, %0\n\t" : "=r"(new_fptr) : "0"(old_fptr)); |
2835 |
-+ input = build_tree_list(NULL_TREE, build_string(1, "0")); |
2836 |
++ input = build_tree_list(NULL_TREE, build_string(2, "0")); |
2837 |
+ input = chainon(NULL_TREE, build_tree_list(input, old_fptr)); |
2838 |
-+ output = build_tree_list(NULL_TREE, build_string(2, "=r")); |
2839 |
++ output = build_tree_list(NULL_TREE, build_string(3, "=r")); |
2840 |
+ output = chainon(NULL_TREE, build_tree_list(output, new_fptr)); |
2841 |
+#if BUILDING_GCC_VERSION <= 4007 |
2842 |
+ VEC_safe_push(tree, gc, inputs, input); |
2843 |
@@ -112767,10 +113368,10 @@ index 0000000..71716e7 |
2844 |
+} |
2845 |
diff --git a/tools/gcc/latent_entropy_plugin.c b/tools/gcc/latent_entropy_plugin.c |
2846 |
new file mode 100644 |
2847 |
-index 0000000..d383708 |
2848 |
+index 0000000..ac6f9b4 |
2849 |
--- /dev/null |
2850 |
+++ b/tools/gcc/latent_entropy_plugin.c |
2851 |
-@@ -0,0 +1,473 @@ |
2852 |
+@@ -0,0 +1,474 @@ |
2853 |
+/* |
2854 |
+ * Copyright 2012-2015 by the PaX Team <pageexec@××××××××.hu> |
2855 |
+ * Licensed under the GPL v2 |
2856 |
@@ -112789,7 +113390,7 @@ index 0000000..d383708 |
2857 |
+ * - more instrumentation control via attribute parameters |
2858 |
+ * |
2859 |
+ * BUGS: |
2860 |
-+ * - LTO needs -flto-partition=none for now |
2861 |
++ * - none known |
2862 |
+ */ |
2863 |
+ |
2864 |
+#include "gcc-common.h" |
2865 |
@@ -112799,7 +113400,7 @@ index 0000000..d383708 |
2866 |
+static GTY(()) tree latent_entropy_decl; |
2867 |
+ |
2868 |
+static struct plugin_info latent_entropy_plugin_info = { |
2869 |
-+ .version = "201409101820", |
2870 |
++ .version = "201504282240", |
2871 |
+ .help = NULL |
2872 |
+}; |
2873 |
+ |
2874 |
@@ -113077,6 +113678,8 @@ index 0000000..d383708 |
2875 |
+ FOR_EACH_VARIABLE(node) { |
2876 |
+ tree var = NODE_DECL(node); |
2877 |
+ |
2878 |
++ if (DECL_NAME_LENGTH(var) < sizeof("latent_entropy") - 1) |
2879 |
++ continue; |
2880 |
+ if (strcmp(IDENTIFIER_POINTER(DECL_NAME(var)), "latent_entropy")) |
2881 |
+ continue; |
2882 |
+ latent_entropy_decl = var; |
2883 |
@@ -113237,8 +113840,7 @@ index 0000000..d383708 |
2884 |
+ |
2885 |
+ register_callback(plugin_name, PLUGIN_INFO, NULL, &latent_entropy_plugin_info); |
2886 |
+ register_callback(plugin_name, PLUGIN_START_UNIT, &latent_entropy_start_unit, NULL); |
2887 |
-+ if (!in_lto_p) |
2888 |
-+ register_callback(plugin_name, PLUGIN_REGISTER_GGC_ROOTS, NULL, (void *)>_ggc_r_gt_latent_entropy); |
2889 |
++ register_callback(plugin_name, PLUGIN_REGISTER_GGC_ROOTS, NULL, (void *)>_ggc_r_gt_latent_entropy); |
2890 |
+ register_callback(plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &latent_entropy_pass_info); |
2891 |
+ register_callback(plugin_name, PLUGIN_ATTRIBUTES, register_attributes, NULL); |
2892 |
+ |
2893 |
@@ -114312,10 +114914,10 @@ index 0000000..12b1e3b |
2894 |
+exit 0 |
2895 |
diff --git a/tools/gcc/size_overflow_plugin/insert_size_overflow_asm.c b/tools/gcc/size_overflow_plugin/insert_size_overflow_asm.c |
2896 |
new file mode 100644 |
2897 |
-index 0000000..493fe76 |
2898 |
+index 0000000..0b508b1 |
2899 |
--- /dev/null |
2900 |
+++ b/tools/gcc/size_overflow_plugin/insert_size_overflow_asm.c |
2901 |
-@@ -0,0 +1,404 @@ |
2902 |
+@@ -0,0 +1,409 @@ |
2903 |
+/* |
2904 |
+ * Copyright 2011-2015 by Emese Revfy <re.emese@×××××.com> |
2905 |
+ * Licensed under the GPL v2, or (at your option) v3 |
2906 |
@@ -114426,7 +115028,7 @@ index 0000000..493fe76 |
2907 |
+{ |
2908 |
+ char *asm_comment; |
2909 |
+ const char *mark_str; |
2910 |
-+ gimple asm_stmt; |
2911 |
++ gasm *asm_stmt; |
2912 |
+ gimple_stmt_iterator gsi; |
2913 |
+ tree str_input, str_output; |
2914 |
+#if BUILDING_GCC_VERSION <= 4007 |
2915 |
@@ -114476,7 +115078,7 @@ index 0000000..493fe76 |
2916 |
+ switch (gimple_code(stmt)) { |
2917 |
+ case GIMPLE_RETURN: |
2918 |
+ gcc_assert(argnum == 0); |
2919 |
-+ return gimple_return_retval(stmt); |
2920 |
++ return gimple_return_retval(as_a_greturn(stmt)); |
2921 |
+ case GIMPLE_CALL: |
2922 |
+ gcc_assert(argnum != 0); |
2923 |
+ gcc_assert(gimple_call_num_args(stmt) >= argnum); |
2924 |
@@ -114489,7 +115091,7 @@ index 0000000..493fe76 |
2925 |
+ |
2926 |
+static tree get_so_asm_input(struct asm_data *asm_data) |
2927 |
+{ |
2928 |
-+ gimple assign; |
2929 |
++ gassign *assign; |
2930 |
+ tree output_type, new_var; |
2931 |
+ gimple_stmt_iterator gsi; |
2932 |
+ |
2933 |
@@ -114517,7 +115119,7 @@ index 0000000..493fe76 |
2934 |
+ gimple_call_set_arg(asm_data->target_stmt, asm_data->argnum - 1, asm_data->output); |
2935 |
+ break; |
2936 |
+ case GIMPLE_RETURN: |
2937 |
-+ gimple_return_set_retval(asm_data->target_stmt, asm_data->output); |
2938 |
++ gimple_return_set_retval(as_a_greturn(asm_data->target_stmt), asm_data->output); |
2939 |
+ break; |
2940 |
+ default: |
2941 |
+ debug_gimple_stmt(asm_data->target_stmt); |
2942 |
@@ -114583,7 +115185,7 @@ index 0000000..493fe76 |
2943 |
+ |
2944 |
+ gcc_assert(attr); |
2945 |
+ for (attr_value = TREE_VALUE(attr); attr_value; attr_value = TREE_CHAIN(attr_value)) { |
2946 |
-+ argnum = TREE_INT_CST_LOW(TREE_VALUE(attr_value)); |
2947 |
++ argnum = (unsigned int)tree_to_uhwi(TREE_VALUE(attr_value)); |
2948 |
+ argnums[argnum] = true; |
2949 |
+ } |
2950 |
+} |
2951 |
@@ -114609,7 +115211,7 @@ index 0000000..493fe76 |
2952 |
+ return mark; |
2953 |
+} |
2954 |
+ |
2955 |
-+static void handle_size_overflow_attr_ret(gimple stmt) |
2956 |
++static void handle_size_overflow_attr_ret(greturn *stmt) |
2957 |
+{ |
2958 |
+ enum intentional_mark mark; |
2959 |
+ bool orig_argnums[MAX_PARAM + 1] = {false}; |
2960 |
@@ -114622,7 +115224,7 @@ index 0000000..493fe76 |
2961 |
+} |
2962 |
+ |
2963 |
+// If the argument(s) of the callee function are marked by an attribute then mark the call stmt with an asm stmt |
2964 |
-+static void handle_size_overflow_attr_call(gimple stmt) |
2965 |
++static void handle_size_overflow_attr_call(gcall *stmt) |
2966 |
+{ |
2967 |
+ tree fndecl; |
2968 |
+ unsigned int argnum; |
2969 |
@@ -114656,9 +115258,9 @@ index 0000000..493fe76 |
2970 |
+ gimple stmt = gsi_stmt(gsi); |
2971 |
+ |
2972 |
+ if (is_gimple_call(stmt)) |
2973 |
-+ handle_size_overflow_attr_call(stmt); |
2974 |
++ handle_size_overflow_attr_call(as_a_gcall(stmt)); |
2975 |
+ else if (gimple_code(stmt) == GIMPLE_RETURN) |
2976 |
-+ handle_size_overflow_attr_ret(stmt); |
2977 |
++ handle_size_overflow_attr_ret(as_a_greturn(stmt)); |
2978 |
+ } |
2979 |
+ } |
2980 |
+ return 0; |
2981 |
@@ -114680,7 +115282,8 @@ index 0000000..493fe76 |
2982 |
+#if BUILDING_GCC_VERSION >= 4008 |
2983 |
+ .optinfo_flags = OPTGROUP_NONE, |
2984 |
+#endif |
2985 |
-+#if BUILDING_GCC_VERSION >= 4009 |
2986 |
++#if BUILDING_GCC_VERSION >= 5000 |
2987 |
++#elif BUILDING_GCC_VERSION >= 4009 |
2988 |
+ .has_gate = false, |
2989 |
+ .has_execute = true, |
2990 |
+#else |
2991 |
@@ -114706,7 +115309,11 @@ index 0000000..493fe76 |
2992 |
+class insert_size_overflow_asm_pass : public gimple_opt_pass { |
2993 |
+public: |
2994 |
+ insert_size_overflow_asm_pass() : gimple_opt_pass(insert_size_overflow_asm_pass_data, g) {} |
2995 |
++#if BUILDING_GCC_VERSION >= 5000 |
2996 |
++ virtual unsigned int execute(function *) { return search_interesting_functions(); } |
2997 |
++#else |
2998 |
+ unsigned int execute() { return search_interesting_functions(); } |
2999 |
++#endif |
3000 |
+}; |
3001 |
+} |
3002 |
+ |
3003 |
@@ -114722,10 +115329,10 @@ index 0000000..493fe76 |
3004 |
+#endif |
3005 |
diff --git a/tools/gcc/size_overflow_plugin/intentional_overflow.c b/tools/gcc/size_overflow_plugin/intentional_overflow.c |
3006 |
new file mode 100644 |
3007 |
-index 0000000..7f645dc |
3008 |
+index 0000000..d96cef2 |
3009 |
--- /dev/null |
3010 |
+++ b/tools/gcc/size_overflow_plugin/intentional_overflow.c |
3011 |
-@@ -0,0 +1,951 @@ |
3012 |
+@@ -0,0 +1,955 @@ |
3013 |
+/* |
3014 |
+ * Copyright 2011-2015 by Emese Revfy <re.emese@×××××.com> |
3015 |
+ * Licensed under the GPL v2, or (at your option) v3 |
3016 |
@@ -114747,25 +115354,22 @@ index 0000000..7f645dc |
3017 |
+ |
3018 |
+#include "size_overflow.h" |
3019 |
+ |
3020 |
-+static enum intentional_mark walk_use_def(struct pointer_set_t *visited, const_tree lhs); |
3021 |
++static enum intentional_mark walk_use_def(gimple_set *visited, const_tree lhs); |
3022 |
+ |
3023 |
-+static const char *get_asm_string(const_gimple stmt) |
3024 |
++static const char *get_asm_string(const gasm *stmt) |
3025 |
+{ |
3026 |
-+ if (!stmt) |
3027 |
-+ return NULL; |
3028 |
-+ if (gimple_code(stmt) != GIMPLE_ASM) |
3029 |
-+ return NULL; |
3030 |
-+ |
3031 |
-+ return gimple_asm_string(stmt); |
3032 |
++ if (stmt) |
3033 |
++ return gimple_asm_string(stmt); |
3034 |
++ return NULL; |
3035 |
+} |
3036 |
+ |
3037 |
-+tree get_size_overflow_asm_input(const_gimple stmt) |
3038 |
++tree get_size_overflow_asm_input(const gasm *stmt) |
3039 |
+{ |
3040 |
+ gcc_assert(gimple_asm_ninputs(stmt) != 0); |
3041 |
+ return TREE_VALUE(gimple_asm_input_op(stmt, 0)); |
3042 |
+} |
3043 |
+ |
3044 |
-+bool is_size_overflow_insert_check_asm(const_gimple stmt) |
3045 |
++bool is_size_overflow_insert_check_asm(const gasm *stmt) |
3046 |
+{ |
3047 |
+ const char *str; |
3048 |
+ |
3049 |
@@ -114787,13 +115391,13 @@ index 0000000..7f645dc |
3050 |
+ if (gimple_code(stmt) != GIMPLE_ASM) |
3051 |
+ return false; |
3052 |
+ |
3053 |
-+ str = get_asm_string(stmt); |
3054 |
++ str = get_asm_string(as_a_const_gasm(stmt)); |
3055 |
+ if (!str) |
3056 |
+ return false; |
3057 |
+ return !strncmp(str, SO_ASM_STR, sizeof(SO_ASM_STR) - 1); |
3058 |
+} |
3059 |
+ |
3060 |
-+static bool is_size_overflow_intentional_asm_turn_off(const_gimple stmt) |
3061 |
++static bool is_size_overflow_intentional_asm_turn_off(const gasm *stmt) |
3062 |
+{ |
3063 |
+ const char *str; |
3064 |
+ |
3065 |
@@ -114806,7 +115410,7 @@ index 0000000..7f645dc |
3066 |
+ return !strncmp(str, TURN_OFF_ASM_STR, sizeof(TURN_OFF_ASM_STR) - 1); |
3067 |
+} |
3068 |
+ |
3069 |
-+static bool is_size_overflow_intentional_asm_end(const_gimple stmt) |
3070 |
++static bool is_size_overflow_intentional_asm_end(const gasm *stmt) |
3071 |
+{ |
3072 |
+ const char *str; |
3073 |
+ |
3074 |
@@ -114846,7 +115450,7 @@ index 0000000..7f645dc |
3075 |
+ if (param_head == NULL_TREE) |
3076 |
+ return false; |
3077 |
+ |
3078 |
-+ if (TREE_INT_CST_HIGH(TREE_VALUE(param_head)) == -1) |
3079 |
++ if (tree_to_shwi(TREE_VALUE(param_head)) == -1) |
3080 |
+ return true; |
3081 |
+ return false; |
3082 |
+} |
3083 |
@@ -114860,7 +115464,7 @@ index 0000000..7f645dc |
3084 |
+ if (param_head == NULL_TREE) |
3085 |
+ return false; |
3086 |
+ |
3087 |
-+ if (!TREE_INT_CST_LOW(TREE_VALUE(param_head))) |
3088 |
++ if (tree_to_shwi(TREE_VALUE(param_head)) == 0) |
3089 |
+ return true; |
3090 |
+ return false; |
3091 |
+} |
3092 |
@@ -114874,9 +115478,14 @@ index 0000000..7f645dc |
3093 |
+ return false; |
3094 |
+ |
3095 |
+ param_head = get_attribute_param(decl); |
3096 |
-+ for (param = param_head; param; param = TREE_CHAIN(param)) |
3097 |
-+ if (argnum == TREE_INT_CST_LOW(TREE_VALUE(param))) |
3098 |
++ for (param = param_head; param; param = TREE_CHAIN(param)) { |
3099 |
++ int argval = tree_to_shwi(TREE_VALUE(param)); |
3100 |
++ |
3101 |
++ if (argval <= 0) |
3102 |
++ continue; |
3103 |
++ if (argnum == (unsigned int)argval) |
3104 |
+ return true; |
3105 |
++ } |
3106 |
+ return false; |
3107 |
+} |
3108 |
+ |
3109 |
@@ -114962,10 +115571,10 @@ index 0000000..7f645dc |
3110 |
+ return MARK_NO; |
3111 |
+} |
3112 |
+ |
3113 |
-+static enum intentional_mark walk_use_def_phi(struct pointer_set_t *visited, const_tree result) |
3114 |
++static enum intentional_mark walk_use_def_phi(gimple_set *visited, const_tree result) |
3115 |
+{ |
3116 |
+ enum intentional_mark mark = MARK_NO; |
3117 |
-+ gimple phi = get_def_stmt(result); |
3118 |
++ gphi *phi = as_a_gphi(get_def_stmt(result)); |
3119 |
+ unsigned int i, n = gimple_phi_num_args(phi); |
3120 |
+ |
3121 |
+ pointer_set_insert(visited, phi); |
3122 |
@@ -114980,11 +115589,11 @@ index 0000000..7f645dc |
3123 |
+ return mark; |
3124 |
+} |
3125 |
+ |
3126 |
-+static enum intentional_mark walk_use_def_binary(struct pointer_set_t *visited, const_tree lhs) |
3127 |
++static enum intentional_mark walk_use_def_binary(gimple_set *visited, const_tree lhs) |
3128 |
+{ |
3129 |
+ enum intentional_mark mark; |
3130 |
+ tree rhs1, rhs2; |
3131 |
-+ gimple def_stmt = get_def_stmt(lhs); |
3132 |
++ gassign *def_stmt = as_a_gassign(get_def_stmt(lhs)); |
3133 |
+ |
3134 |
+ rhs1 = gimple_assign_rhs1(def_stmt); |
3135 |
+ rhs2 = gimple_assign_rhs2(def_stmt); |
3136 |
@@ -114997,20 +115606,24 @@ index 0000000..7f645dc |
3137 |
+ |
3138 |
+enum intentional_mark get_so_asm_type(const_gimple stmt) |
3139 |
+{ |
3140 |
++ const gasm *asm_stmt; |
3141 |
++ |
3142 |
+ if (!stmt) |
3143 |
+ return MARK_NO; |
3144 |
+ if (!is_size_overflow_asm(stmt)) |
3145 |
+ return MARK_NO; |
3146 |
-+ if (is_size_overflow_insert_check_asm(stmt)) |
3147 |
++ |
3148 |
++ asm_stmt = as_a_const_gasm(stmt); |
3149 |
++ if (is_size_overflow_insert_check_asm(asm_stmt)) |
3150 |
+ return MARK_NO; |
3151 |
-+ if (is_size_overflow_intentional_asm_turn_off(stmt)) |
3152 |
++ if (is_size_overflow_intentional_asm_turn_off(asm_stmt)) |
3153 |
+ return MARK_TURN_OFF; |
3154 |
-+ if (is_size_overflow_intentional_asm_end(stmt)) |
3155 |
++ if (is_size_overflow_intentional_asm_end(asm_stmt)) |
3156 |
+ return MARK_END_INTENTIONAL; |
3157 |
+ return MARK_YES; |
3158 |
+} |
3159 |
+ |
3160 |
-+static enum intentional_mark walk_use_def(struct pointer_set_t *visited, const_tree lhs) |
3161 |
++static enum intentional_mark walk_use_def(gimple_set *visited, const_tree lhs) |
3162 |
+{ |
3163 |
+ const_gimple def_stmt; |
3164 |
+ |
3165 |
@@ -115030,7 +115643,7 @@ index 0000000..7f645dc |
3166 |
+ case GIMPLE_NOP: |
3167 |
+ return walk_use_def(visited, SSA_NAME_VAR(lhs)); |
3168 |
+ case GIMPLE_ASM: |
3169 |
-+ return get_so_asm_type(def_stmt); |
3170 |
++ return get_so_asm_type(as_a_const_gasm(def_stmt)); |
3171 |
+ case GIMPLE_PHI: |
3172 |
+ return walk_use_def_phi(visited, lhs); |
3173 |
+ case GIMPLE_ASSIGN: |
3174 |
@@ -115050,7 +115663,7 @@ index 0000000..7f645dc |
3175 |
+static enum intentional_mark check_intentional_size_overflow_asm_and_attribute(const_tree var) |
3176 |
+{ |
3177 |
+ enum intentional_mark mark; |
3178 |
-+ struct pointer_set_t *visited; |
3179 |
++ gimple_set *visited; |
3180 |
+ |
3181 |
+ visited = pointer_set_create(); |
3182 |
+ mark = walk_use_def(visited, var); |
3183 |
@@ -115098,7 +115711,7 @@ index 0000000..7f645dc |
3184 |
+ if (is_end_intentional_intentional_attr(orig_cur_fndecl)) |
3185 |
+ return MARK_END_INTENTIONAL; |
3186 |
+ |
3187 |
-+ fndecl = get_interesting_orig_fndecl_from_stmt(stmt); |
3188 |
++ fndecl = get_interesting_orig_fndecl_from_stmt(as_a_const_gcall(stmt)); |
3189 |
+ // handle MARK_TURN_OFF on the callee |
3190 |
+ if (is_turn_off_intentional_attr(fndecl)) |
3191 |
+ return MARK_TURN_OFF; |
3192 |
@@ -115154,7 +115767,7 @@ index 0000000..7f645dc |
3193 |
+ switch (gimple_code(stmt)) { |
3194 |
+ case GIMPLE_RETURN: |
3195 |
+ gcc_assert(argnum == 0); |
3196 |
-+ arg = gimple_return_retval(stmt); |
3197 |
++ arg = gimple_return_retval(as_a_const_greturn(stmt)); |
3198 |
+ break; |
3199 |
+ case GIMPLE_CALL: |
3200 |
+ gcc_assert(argnum != 0); |
3201 |
@@ -115162,8 +115775,8 @@ index 0000000..7f645dc |
3202 |
+ arg = gimple_call_arg(stmt, argnum - 1); |
3203 |
+ break; |
3204 |
+ case GIMPLE_ASM: |
3205 |
-+ gcc_assert(is_size_overflow_insert_check_asm(stmt)); |
3206 |
-+ arg = get_size_overflow_asm_input(stmt); |
3207 |
++ gcc_assert(is_size_overflow_insert_check_asm(as_a_const_gasm(stmt))); |
3208 |
++ arg = get_size_overflow_asm_input(as_a_const_gasm(stmt)); |
3209 |
+ break; |
3210 |
+ default: |
3211 |
+ debug_gimple_stmt((gimple)stmt); |
3212 |
@@ -115302,7 +115915,7 @@ index 0000000..7f645dc |
3213 |
+ return false; |
3214 |
+} |
3215 |
+ |
3216 |
-+bool is_a_constant_overflow(const_gimple stmt, const_tree rhs) |
3217 |
++bool is_a_constant_overflow(const gassign *stmt, const_tree rhs) |
3218 |
+{ |
3219 |
+ if (gimple_assign_rhs_code(stmt) == MIN_EXPR) |
3220 |
+ return false; |
3221 |
@@ -115316,20 +115929,18 @@ index 0000000..7f645dc |
3222 |
+ return true; |
3223 |
+} |
3224 |
+ |
3225 |
-+static tree change_assign_rhs(struct visited *visited, gimple stmt, const_tree orig_rhs, tree new_rhs) |
3226 |
++static tree change_assign_rhs(struct visited *visited, gassign *stmt, const_tree orig_rhs, tree new_rhs) |
3227 |
+{ |
3228 |
-+ gimple assign; |
3229 |
++ const_gimple assign; |
3230 |
+ gimple_stmt_iterator gsi = gsi_for_stmt(stmt); |
3231 |
+ tree origtype = TREE_TYPE(orig_rhs); |
3232 |
+ |
3233 |
-+ gcc_assert(is_gimple_assign(stmt)); |
3234 |
-+ |
3235 |
+ assign = build_cast_stmt(visited, origtype, new_rhs, CREATE_NEW_VAR, &gsi, BEFORE_STMT, false); |
3236 |
+ pointer_set_insert(visited->my_stmts, assign); |
3237 |
-+ return gimple_assign_lhs(assign); |
3238 |
++ return get_lhs(assign); |
3239 |
+} |
3240 |
+ |
3241 |
-+tree handle_intentional_overflow(struct visited *visited, bool check_overflow, gimple stmt, tree change_rhs, tree new_rhs2) |
3242 |
++tree handle_intentional_overflow(struct visited *visited, bool check_overflow, gassign *stmt, tree change_rhs, tree new_rhs2) |
3243 |
+{ |
3244 |
+ tree new_rhs, orig_rhs; |
3245 |
+ void (*gimple_assign_set_rhs)(gimple, tree); |
3246 |
@@ -115360,7 +115971,7 @@ index 0000000..7f645dc |
3247 |
+ return create_assign(visited, stmt, lhs, AFTER_STMT); |
3248 |
+} |
3249 |
+ |
3250 |
-+static bool is_subtraction_special(struct visited *visited, const_gimple stmt) |
3251 |
++static bool is_subtraction_special(struct visited *visited, const gassign *stmt) |
3252 |
+{ |
3253 |
+ gimple rhs1_def_stmt, rhs2_def_stmt; |
3254 |
+ const_tree rhs1_def_stmt_rhs1, rhs2_def_stmt_rhs1, rhs1_def_stmt_lhs, rhs2_def_stmt_lhs; |
3255 |
@@ -115399,15 +116010,15 @@ index 0000000..7f645dc |
3256 |
+ return true; |
3257 |
+} |
3258 |
+ |
3259 |
-+static gimple create_binary_assign(struct visited *visited, enum tree_code code, gimple stmt, tree rhs1, tree rhs2) |
3260 |
++static gassign *create_binary_assign(struct visited *visited, enum tree_code code, gassign *stmt, tree rhs1, tree rhs2) |
3261 |
+{ |
3262 |
-+ gimple assign; |
3263 |
++ gassign *assign; |
3264 |
+ gimple_stmt_iterator gsi = gsi_for_stmt(stmt); |
3265 |
+ tree type = TREE_TYPE(rhs1); |
3266 |
+ tree lhs = create_new_var(type); |
3267 |
+ |
3268 |
+ gcc_assert(types_compatible_p(type, TREE_TYPE(rhs2))); |
3269 |
-+ assign = gimple_build_assign_with_ops(code, lhs, rhs1, rhs2); |
3270 |
++ assign = as_a_gassign(gimple_build_assign_with_ops(code, lhs, rhs1, rhs2)); |
3271 |
+ gimple_assign_set_lhs(assign, make_ssa_name(lhs, assign)); |
3272 |
+ |
3273 |
+ gsi_insert_before(&gsi, assign, GSI_NEW_STMT); |
3274 |
@@ -115416,10 +116027,10 @@ index 0000000..7f645dc |
3275 |
+ return assign; |
3276 |
+} |
3277 |
+ |
3278 |
-+static tree cast_to_TI_type(struct visited *visited, gimple stmt, tree node) |
3279 |
++static tree cast_to_TI_type(struct visited *visited, gassign *stmt, tree node) |
3280 |
+{ |
3281 |
+ gimple_stmt_iterator gsi; |
3282 |
-+ gimple cast_stmt; |
3283 |
++ const_gimple cast_stmt; |
3284 |
+ tree type = TREE_TYPE(node); |
3285 |
+ |
3286 |
+ if (types_compatible_p(type, intTI_type_node)) |
3287 |
@@ -115428,7 +116039,7 @@ index 0000000..7f645dc |
3288 |
+ gsi = gsi_for_stmt(stmt); |
3289 |
+ cast_stmt = build_cast_stmt(visited, intTI_type_node, node, CREATE_NEW_VAR, &gsi, BEFORE_STMT, false); |
3290 |
+ pointer_set_insert(visited->my_stmts, cast_stmt); |
3291 |
-+ return gimple_assign_lhs(cast_stmt); |
3292 |
++ return get_lhs(cast_stmt); |
3293 |
+} |
3294 |
+ |
3295 |
+static tree get_def_stmt_rhs(struct visited *visited, const_tree var) |
3296 |
@@ -115467,7 +116078,7 @@ index 0000000..7f645dc |
3297 |
+{ |
3298 |
+ tree new_rhs1, new_rhs2; |
3299 |
+ tree new_rhs1_def_stmt_rhs1, new_rhs2_def_stmt_rhs1, new_lhs; |
3300 |
-+ gimple assign, stmt = get_def_stmt(lhs); |
3301 |
++ gassign *assign, *stmt = as_a_gassign(get_def_stmt(lhs)); |
3302 |
+ tree rhs1 = gimple_assign_rhs1(stmt); |
3303 |
+ tree rhs2 = gimple_assign_rhs2(stmt); |
3304 |
+ |
3305 |
@@ -115495,7 +116106,7 @@ index 0000000..7f645dc |
3306 |
+ return dup_assign(visited, stmt, lhs, new_rhs1, new_rhs2, NULL_TREE); |
3307 |
+} |
3308 |
+ |
3309 |
-+bool is_a_neg_overflow(const_gimple stmt, const_tree rhs) |
3310 |
++bool is_a_neg_overflow(const gassign *stmt, const_tree rhs) |
3311 |
+{ |
3312 |
+ const_gimple def_stmt; |
3313 |
+ |
3314 |
@@ -115561,7 +116172,7 @@ index 0000000..7f645dc |
3315 |
+ return true; |
3316 |
+} |
3317 |
+ |
3318 |
-+enum intentional_overflow_type add_mul_intentional_overflow(const_gimple stmt) |
3319 |
++enum intentional_overflow_type add_mul_intentional_overflow(const gassign *stmt) |
3320 |
+{ |
3321 |
+ const_gimple def_stmt_1, def_stmt_2; |
3322 |
+ const_tree rhs1, rhs2; |
3323 |
@@ -115582,13 +116193,13 @@ index 0000000..7f645dc |
3324 |
+ return NO_INTENTIONAL_OVERFLOW; |
3325 |
+} |
3326 |
+ |
3327 |
-+static gimple get_dup_stmt(struct visited *visited, gimple stmt) |
3328 |
++static gassign *get_dup_stmt(struct visited *visited, gassign *stmt) |
3329 |
+{ |
3330 |
-+ gimple my_stmt; |
3331 |
++ gassign *my_stmt; |
3332 |
+ gimple_stmt_iterator gsi = gsi_for_stmt(stmt); |
3333 |
+ |
3334 |
+ gsi_next(&gsi); |
3335 |
-+ my_stmt = gsi_stmt(gsi); |
3336 |
++ my_stmt = as_a_gassign(gsi_stmt(gsi)); |
3337 |
+ |
3338 |
+ gcc_assert(pointer_set_contains(visited->my_stmts, my_stmt)); |
3339 |
+ if (gimple_assign_rhs_code(stmt) != gimple_assign_rhs_code(my_stmt)) { |
3340 |
@@ -115639,10 +116250,10 @@ index 0000000..7f645dc |
3341 |
+ return is_call_or_cast(def_stmt); |
3342 |
+} |
3343 |
+ |
3344 |
-+void unsigned_signed_cast_intentional_overflow(struct visited *visited, gimple stmt) |
3345 |
++void unsigned_signed_cast_intentional_overflow(struct visited *visited, gassign *stmt) |
3346 |
+{ |
3347 |
+ unsigned int use_num; |
3348 |
-+ gimple so_stmt; |
3349 |
++ gassign *so_stmt; |
3350 |
+ const_gimple def_stmt; |
3351 |
+ const_tree rhs1, rhs2; |
3352 |
+ tree rhs = gimple_assign_rhs1(stmt); |
3353 |
@@ -115679,10 +116290,10 @@ index 0000000..7f645dc |
3354 |
+ |
3355 |
diff --git a/tools/gcc/size_overflow_plugin/misc.c b/tools/gcc/size_overflow_plugin/misc.c |
3356 |
new file mode 100644 |
3357 |
-index 0000000..69059ca |
3358 |
+index 0000000..c1b4773 |
3359 |
--- /dev/null |
3360 |
+++ b/tools/gcc/size_overflow_plugin/misc.c |
3361 |
-@@ -0,0 +1,426 @@ |
3362 |
+@@ -0,0 +1,441 @@ |
3363 |
+/* |
3364 |
+ * Copyright 2011-2015 by Emese Revfy <re.emese@×××××.com> |
3365 |
+ * Licensed under the GPL v2, or (at your option) v3 |
3366 |
@@ -115832,7 +116443,8 @@ index 0000000..69059ca |
3367 |
+ |
3368 |
+gimple build_cast_stmt(struct visited *visited, tree dst_type, tree rhs, tree lhs, gimple_stmt_iterator *gsi, bool before, bool force) |
3369 |
+{ |
3370 |
-+ gimple assign, def_stmt; |
3371 |
++ gassign *assign; |
3372 |
++ gimple def_stmt; |
3373 |
+ |
3374 |
+ gcc_assert(dst_type != NULL_TREE && rhs != NULL_TREE); |
3375 |
+ gcc_assert(!is_gimple_constant(rhs)); |
3376 |
@@ -116051,14 +116663,14 @@ index 0000000..69059ca |
3377 |
+ return (tree)clone_fndecl; |
3378 |
+} |
3379 |
+ |
3380 |
-+static tree get_interesting_fndecl_from_stmt(const_gimple stmt) |
3381 |
++static tree get_interesting_fndecl_from_stmt(const gcall *stmt) |
3382 |
+{ |
3383 |
+ if (gimple_call_num_args(stmt) == 0) |
3384 |
+ return NULL_TREE; |
3385 |
+ return gimple_call_fndecl(stmt); |
3386 |
+} |
3387 |
+ |
3388 |
-+tree get_interesting_orig_fndecl_from_stmt(const_gimple stmt) |
3389 |
++tree get_interesting_orig_fndecl_from_stmt(const gcall *stmt) |
3390 |
+{ |
3391 |
+ tree fndecl; |
3392 |
+ |
3393 |
@@ -116109,9 +116721,23 @@ index 0000000..69059ca |
3394 |
+ return true; |
3395 |
+} |
3396 |
+ |
3397 |
++tree get_lhs(const_gimple stmt) |
3398 |
++{ |
3399 |
++ switch (gimple_code(stmt)) { |
3400 |
++ case GIMPLE_ASSIGN: |
3401 |
++ case GIMPLE_CALL: |
3402 |
++ return gimple_get_lhs(stmt); |
3403 |
++ case GIMPLE_PHI: |
3404 |
++ return gimple_phi_result(stmt); |
3405 |
++ default: |
3406 |
++ debug_gimple_stmt((gimple)stmt); |
3407 |
++ gcc_unreachable(); |
3408 |
++ } |
3409 |
++} |
3410 |
++ |
3411 |
diff --git a/tools/gcc/size_overflow_plugin/remove_unnecessary_dup.c b/tools/gcc/size_overflow_plugin/remove_unnecessary_dup.c |
3412 |
new file mode 100644 |
3413 |
-index 0000000..c955c6b |
3414 |
+index 0000000..5622b51 |
3415 |
--- /dev/null |
3416 |
+++ b/tools/gcc/size_overflow_plugin/remove_unnecessary_dup.c |
3417 |
@@ -0,0 +1,137 @@ |
3418 |
@@ -116136,7 +116762,7 @@ index 0000000..c955c6b |
3419 |
+ |
3420 |
+#include "size_overflow.h" |
3421 |
+ |
3422 |
-+bool skip_expr_on_double_type(const_gimple stmt) |
3423 |
++bool skip_expr_on_double_type(const gassign *stmt) |
3424 |
+{ |
3425 |
+ enum tree_code code = gimple_assign_rhs_code(stmt); |
3426 |
+ |
3427 |
@@ -116158,19 +116784,19 @@ index 0000000..c955c6b |
3428 |
+ } |
3429 |
+} |
3430 |
+ |
3431 |
-+void create_up_and_down_cast(struct visited *visited, gimple use_stmt, tree orig_type, tree rhs) |
3432 |
++void create_up_and_down_cast(struct visited *visited, gassign *use_stmt, tree orig_type, tree rhs) |
3433 |
+{ |
3434 |
+ const_tree orig_rhs1; |
3435 |
+ tree down_lhs, new_lhs, dup_type = TREE_TYPE(rhs); |
3436 |
-+ gimple down_cast, up_cast; |
3437 |
++ const_gimple down_cast, up_cast; |
3438 |
+ gimple_stmt_iterator gsi = gsi_for_stmt(use_stmt); |
3439 |
+ |
3440 |
+ down_cast = build_cast_stmt(visited, orig_type, rhs, CREATE_NEW_VAR, &gsi, BEFORE_STMT, false); |
3441 |
-+ down_lhs = gimple_assign_lhs(down_cast); |
3442 |
++ down_lhs = get_lhs(down_cast); |
3443 |
+ |
3444 |
+ gsi = gsi_for_stmt(use_stmt); |
3445 |
+ up_cast = build_cast_stmt(visited, dup_type, down_lhs, CREATE_NEW_VAR, &gsi, BEFORE_STMT, false); |
3446 |
-+ new_lhs = gimple_assign_lhs(up_cast); |
3447 |
++ new_lhs = get_lhs(up_cast); |
3448 |
+ |
3449 |
+ orig_rhs1 = gimple_assign_rhs1(use_stmt); |
3450 |
+ if (operand_equal_p(orig_rhs1, rhs, 0)) |
3451 |
@@ -116214,7 +116840,7 @@ index 0000000..c955c6b |
3452 |
+ return new_type; |
3453 |
+} |
3454 |
+ |
3455 |
-+static void insert_cast_rhs(struct visited *visited, gimple stmt, tree rhs) |
3456 |
++static void insert_cast_rhs(struct visited *visited, gassign *stmt, tree rhs) |
3457 |
+{ |
3458 |
+ tree type; |
3459 |
+ |
3460 |
@@ -116229,7 +116855,7 @@ index 0000000..c955c6b |
3461 |
+ create_up_and_down_cast(visited, stmt, type, rhs); |
3462 |
+} |
3463 |
+ |
3464 |
-+static void insert_cast(struct visited *visited, gimple stmt, tree rhs) |
3465 |
++static void insert_cast(struct visited *visited, gassign *stmt, tree rhs) |
3466 |
+{ |
3467 |
+ if (LONG_TYPE_SIZE == GET_MODE_BITSIZE(SImode) && !is_size_overflow_type(rhs)) |
3468 |
+ return; |
3469 |
@@ -116237,7 +116863,7 @@ index 0000000..c955c6b |
3470 |
+ insert_cast_rhs(visited, stmt, rhs); |
3471 |
+} |
3472 |
+ |
3473 |
-+void insert_cast_expr(struct visited *visited, gimple stmt, enum intentional_overflow_type type) |
3474 |
++void insert_cast_expr(struct visited *visited, gassign *stmt, enum intentional_overflow_type type) |
3475 |
+{ |
3476 |
+ tree rhs1, rhs2; |
3477 |
+ |
3478 |
@@ -116254,10 +116880,10 @@ index 0000000..c955c6b |
3479 |
+ |
3480 |
diff --git a/tools/gcc/size_overflow_plugin/size_overflow.h b/tools/gcc/size_overflow_plugin/size_overflow.h |
3481 |
new file mode 100644 |
3482 |
-index 0000000..516289f |
3483 |
+index 0000000..07e2ba7 |
3484 |
--- /dev/null |
3485 |
+++ b/tools/gcc/size_overflow_plugin/size_overflow.h |
3486 |
-@@ -0,0 +1,226 @@ |
3487 |
+@@ -0,0 +1,281 @@ |
3488 |
+#ifndef SIZE_OVERFLOW_H |
3489 |
+#define SIZE_OVERFLOW_H |
3490 |
+ |
3491 |
@@ -116308,13 +116934,6 @@ index 0000000..516289f |
3492 |
+ const char *fn_name; |
3493 |
+}; |
3494 |
+ |
3495 |
-+struct visited { |
3496 |
-+ struct pointer_set_t *stmts; |
3497 |
-+ struct pointer_set_t *my_stmts; |
3498 |
-+ struct pointer_set_t *skip_expr_casts; |
3499 |
-+ struct pointer_set_t *no_cast_check; |
3500 |
-+}; |
3501 |
-+ |
3502 |
+struct next_interesting_function; |
3503 |
+typedef struct next_interesting_function * next_interesting_function_t; |
3504 |
+ |
3505 |
@@ -116323,6 +116942,67 @@ index 0000000..516289f |
3506 |
+DEF_VEC_ALLOC_P(next_interesting_function_t, heap); |
3507 |
+#endif |
3508 |
+ |
3509 |
++#if BUILDING_GCC_VERSION >= 5000 |
3510 |
++typedef struct hash_set<const_gimple> gimple_set; |
3511 |
++ |
3512 |
++static inline bool pointer_set_insert(gimple_set *visited, const_gimple stmt) |
3513 |
++{ |
3514 |
++ return visited->add(stmt); |
3515 |
++} |
3516 |
++ |
3517 |
++static inline bool pointer_set_contains(gimple_set *visited, const_gimple stmt) |
3518 |
++{ |
3519 |
++ return visited->contains(stmt); |
3520 |
++} |
3521 |
++ |
3522 |
++static inline gimple_set* pointer_set_create(void) |
3523 |
++{ |
3524 |
++ return new hash_set<const_gimple>; |
3525 |
++} |
3526 |
++ |
3527 |
++static inline void pointer_set_destroy(gimple_set *visited) |
3528 |
++{ |
3529 |
++ delete visited; |
3530 |
++} |
3531 |
++ |
3532 |
++typedef struct hash_set<next_interesting_function_t> next_interesting_function_set; |
3533 |
++ |
3534 |
++static inline bool pointer_set_insert(next_interesting_function_set *visited, next_interesting_function_t node) |
3535 |
++{ |
3536 |
++ return visited->add(node); |
3537 |
++} |
3538 |
++ |
3539 |
++static inline bool pointer_set_contains(next_interesting_function_set *visited, next_interesting_function_t node) |
3540 |
++{ |
3541 |
++ return visited->contains(node); |
3542 |
++} |
3543 |
++ |
3544 |
++static inline next_interesting_function_set *next_interesting_function_pointer_set_create(void) |
3545 |
++{ |
3546 |
++ return new hash_set<next_interesting_function_t>; |
3547 |
++} |
3548 |
++ |
3549 |
++static inline void pointer_set_destroy(next_interesting_function_set *visited) |
3550 |
++{ |
3551 |
++ delete visited; |
3552 |
++} |
3553 |
++#else |
3554 |
++typedef struct pointer_set_t gimple_set; |
3555 |
++typedef struct pointer_set_t next_interesting_function_set; |
3556 |
++ |
3557 |
++static inline next_interesting_function_set *next_interesting_function_pointer_set_create(void) |
3558 |
++{ |
3559 |
++ return pointer_set_create(); |
3560 |
++} |
3561 |
++#endif |
3562 |
++ |
3563 |
++struct visited { |
3564 |
++ gimple_set *stmts; |
3565 |
++ gimple_set *my_stmts; |
3566 |
++ gimple_set *skip_expr_casts; |
3567 |
++ gimple_set *no_cast_check; |
3568 |
++}; |
3569 |
++ |
3570 |
+/* |
3571 |
+ * * children: callers with data flow into the integer parameter of decl |
3572 |
+ * * decl_name: name of the function or the field |
3573 |
@@ -116348,11 +117028,11 @@ index 0000000..516289f |
3574 |
+}; |
3575 |
+ |
3576 |
+// size_overflow_plugin.c |
3577 |
-+extern GTY(()) tree report_size_overflow_decl; |
3578 |
-+extern GTY(()) tree size_overflow_type_HI; |
3579 |
-+extern GTY(()) tree size_overflow_type_SI; |
3580 |
-+extern GTY(()) tree size_overflow_type_DI; |
3581 |
-+extern GTY(()) tree size_overflow_type_TI; |
3582 |
++extern tree report_size_overflow_decl; |
3583 |
++extern tree size_overflow_type_HI; |
3584 |
++extern tree size_overflow_type_SI; |
3585 |
++extern tree size_overflow_type_DI; |
3586 |
++extern tree size_overflow_type_TI; |
3587 |
+ |
3588 |
+ |
3589 |
+// size_overflow_plugin_hash.c |
3590 |
@@ -116372,20 +117052,20 @@ index 0000000..516289f |
3591 |
+ |
3592 |
+ |
3593 |
+// intentional_overflow.c |
3594 |
-+extern tree get_size_overflow_asm_input(const_gimple stmt); |
3595 |
++extern tree get_size_overflow_asm_input(const gasm *stmt); |
3596 |
+extern enum intentional_mark check_intentional_asm(const_gimple stmt, unsigned int argnum); |
3597 |
-+extern bool is_size_overflow_insert_check_asm(const_gimple stmt); |
3598 |
++extern bool is_size_overflow_insert_check_asm(const gasm *stmt); |
3599 |
+extern enum intentional_mark check_intentional_attribute(const_gimple stmt, unsigned int argnum); |
3600 |
+extern enum intentional_mark get_so_asm_type(const_gimple stmt); |
3601 |
+extern const_tree get_attribute(const char* attr_name, const_tree decl); |
3602 |
+extern bool is_a_cast_and_const_overflow(const_tree no_const_rhs); |
3603 |
+extern bool is_const_plus_unsigned_signed_truncation(const_tree lhs); |
3604 |
-+extern bool is_a_constant_overflow(const_gimple stmt, const_tree rhs); |
3605 |
-+extern tree handle_intentional_overflow(struct visited *visited, bool check_overflow, gimple stmt, tree change_rhs, tree new_rhs2); |
3606 |
++extern bool is_a_constant_overflow(const gassign *stmt, const_tree rhs); |
3607 |
++extern tree handle_intentional_overflow(struct visited *visited, bool check_overflow, gassign *stmt, tree change_rhs, tree new_rhs2); |
3608 |
+extern tree handle_integer_truncation(struct visited *visited, const_tree lhs); |
3609 |
-+extern bool is_a_neg_overflow(const_gimple stmt, const_tree rhs); |
3610 |
-+extern enum intentional_overflow_type add_mul_intentional_overflow(const_gimple def_stmt); |
3611 |
-+extern void unsigned_signed_cast_intentional_overflow(struct visited *visited, gimple stmt); |
3612 |
++extern bool is_a_neg_overflow(const gassign *stmt, const_tree rhs); |
3613 |
++extern enum intentional_overflow_type add_mul_intentional_overflow(const gassign *stmt); |
3614 |
++extern void unsigned_signed_cast_intentional_overflow(struct visited *visited, gassign *stmt); |
3615 |
+ |
3616 |
+ |
3617 |
+// insert_size_overflow_asm.c |
3618 |
@@ -116402,7 +117082,7 @@ index 0000000..516289f |
3619 |
+extern const char *get_type_name_from_field(const_tree field_decl); |
3620 |
+extern void set_dominance_info(void); |
3621 |
+extern void unset_dominance_info(void); |
3622 |
-+extern tree get_interesting_orig_fndecl_from_stmt(const_gimple stmt); |
3623 |
++extern tree get_interesting_orig_fndecl_from_stmt(const gcall *stmt); |
3624 |
+extern tree get_orig_fndecl(const_tree clone_fndecl); |
3625 |
+extern unsigned int get_correct_argnum(const_tree decl, const_tree correct_argnum_of_decl, unsigned int argnum); |
3626 |
+extern bool is_valid_cgraph_node(struct cgraph_node *node); |
3627 |
@@ -116416,6 +117096,7 @@ index 0000000..516289f |
3628 |
+extern bool is_size_overflow_type(const_tree var); |
3629 |
+extern bool made_by_compiler(const_tree decl); |
3630 |
+extern gimple get_fnptr_def_stmt(const_tree fn_ptr); |
3631 |
++extern tree get_lhs(const_gimple stmt); |
3632 |
+ |
3633 |
+ |
3634 |
+// size_overflow_transform.c |
3635 |
@@ -116426,15 +117107,15 @@ index 0000000..516289f |
3636 |
+// size_overflow_transform_core.c |
3637 |
+extern tree expand(struct visited *visited, tree lhs); |
3638 |
+extern void check_size_overflow(gimple stmt, tree size_overflow_type, tree cast_rhs, tree rhs, bool before); |
3639 |
-+extern tree dup_assign(struct visited *visited, gimple oldstmt, const_tree node, tree rhs1, tree rhs2, tree __unused rhs3); |
3640 |
++extern tree dup_assign(struct visited *visited, gassign *oldstmt, const_tree node, tree rhs1, tree rhs2, tree __unused rhs3); |
3641 |
+extern tree create_assign(struct visited *visited, gimple oldstmt, tree rhs1, bool before); |
3642 |
+ |
3643 |
+ |
3644 |
+// remove_unnecessary_dup.c |
3645 |
+extern struct opt_pass *make_remove_unnecessary_dup_pass(void); |
3646 |
-+extern void insert_cast_expr(struct visited *visited, gimple stmt, enum intentional_overflow_type type); |
3647 |
-+extern bool skip_expr_on_double_type(const_gimple stmt); |
3648 |
-+extern void create_up_and_down_cast(struct visited *visited, gimple use_stmt, tree orig_type, tree rhs); |
3649 |
++extern void insert_cast_expr(struct visited *visited, gassign *stmt, enum intentional_overflow_type type); |
3650 |
++extern bool skip_expr_on_double_type(const gassign *stmt); |
3651 |
++extern void create_up_and_down_cast(struct visited *visited, gassign *use_stmt, tree orig_type, tree rhs); |
3652 |
+ |
3653 |
+ |
3654 |
+// size_overflow_ipa.c |
3655 |
@@ -116468,7 +117149,7 @@ index 0000000..516289f |
3656 |
+#endif |
3657 |
+ |
3658 |
+// size_overflow_fnptrs.c |
3659 |
-+extern next_interesting_function_t handle_function_ptr_ret(struct pointer_set_t *visited, next_interesting_function_t next_cnodes_head, const_tree fn_ptr); |
3660 |
++extern next_interesting_function_t handle_function_ptr_ret(gimple_set *visited, next_interesting_function_t next_cnodes_head, const_tree fn_ptr); |
3661 |
+extern void check_local_variables(next_interesting_function_t next_node); |
3662 |
+extern void check_global_variables(next_interesting_function_t cur_global); |
3663 |
+extern next_interesting_function_t get_and_create_next_node_from_global_next_nodes_fnptr(const_tree fn_ptr, unsigned int num, enum size_overflow_mark marked); |
3664 |
@@ -144476,10 +145157,10 @@ index 0000000..560cd7b |
3665 |
+zpios_read_64734 zpios_read 3 64734 NULL |
3666 |
diff --git a/tools/gcc/size_overflow_plugin/size_overflow_ipa.c b/tools/gcc/size_overflow_plugin/size_overflow_ipa.c |
3667 |
new file mode 100644 |
3668 |
-index 0000000..f888b36 |
3669 |
+index 0000000..9846ab0 |
3670 |
--- /dev/null |
3671 |
+++ b/tools/gcc/size_overflow_plugin/size_overflow_ipa.c |
3672 |
-@@ -0,0 +1,908 @@ |
3673 |
+@@ -0,0 +1,913 @@ |
3674 |
+/* |
3675 |
+ * Copyright 2011-2015 by Emese Revfy <re.emese@×××××.com> |
3676 |
+ * Licensed under the GPL v2, or (at your option) v3 |
3677 |
@@ -144501,7 +145182,7 @@ index 0000000..f888b36 |
3678 |
+ |
3679 |
+#include "size_overflow.h" |
3680 |
+ |
3681 |
-+static next_interesting_function_t walk_use_def_next_functions(struct pointer_set_t *visited, next_interesting_function_t next_cnodes_head, const_tree lhs); |
3682 |
++static next_interesting_function_t walk_use_def_next_functions(gimple_set *visited, next_interesting_function_t next_cnodes_head, const_tree lhs); |
3683 |
+ |
3684 |
+next_interesting_function_t global_next_interesting_function[GLOBAL_NIFN_LEN]; |
3685 |
+ |
3686 |
@@ -144789,9 +145470,9 @@ index 0000000..f888b36 |
3687 |
+ return new_node; |
3688 |
+} |
3689 |
+ |
3690 |
-+static next_interesting_function_t walk_use_def_next_functions_phi(struct pointer_set_t *visited, next_interesting_function_t next_cnodes_head, const_tree result) |
3691 |
++static next_interesting_function_t walk_use_def_next_functions_phi(gimple_set *visited, next_interesting_function_t next_cnodes_head, const_tree result) |
3692 |
+{ |
3693 |
-+ gimple phi = get_def_stmt(result); |
3694 |
++ gphi *phi = as_a_gphi(get_def_stmt(result)); |
3695 |
+ unsigned int i, n = gimple_phi_num_args(phi); |
3696 |
+ |
3697 |
+ pointer_set_insert(visited, phi); |
3698 |
@@ -144804,9 +145485,9 @@ index 0000000..f888b36 |
3699 |
+ return next_cnodes_head; |
3700 |
+} |
3701 |
+ |
3702 |
-+static next_interesting_function_t walk_use_def_next_functions_binary(struct pointer_set_t *visited, next_interesting_function_t next_cnodes_head, const_tree lhs) |
3703 |
++static next_interesting_function_t walk_use_def_next_functions_binary(gimple_set *visited, next_interesting_function_t next_cnodes_head, const_tree lhs) |
3704 |
+{ |
3705 |
-+ gimple def_stmt = get_def_stmt(lhs); |
3706 |
++ gassign *def_stmt = as_a_gassign(get_def_stmt(lhs)); |
3707 |
+ tree rhs1, rhs2; |
3708 |
+ |
3709 |
+ rhs1 = gimple_assign_rhs1(def_stmt); |
3710 |
@@ -144816,7 +145497,7 @@ index 0000000..f888b36 |
3711 |
+ return walk_use_def_next_functions(visited, next_cnodes_head, rhs2); |
3712 |
+} |
3713 |
+ |
3714 |
-+next_interesting_function_t __attribute__((weak)) handle_function_ptr_ret(struct pointer_set_t *visited __unused, next_interesting_function_t next_cnodes_head, const_tree fn_ptr __unused) |
3715 |
++next_interesting_function_t __attribute__((weak)) handle_function_ptr_ret(gimple_set *visited __unused, next_interesting_function_t next_cnodes_head, const_tree fn_ptr __unused) |
3716 |
+{ |
3717 |
+ return next_cnodes_head; |
3718 |
+} |
3719 |
@@ -144825,7 +145506,7 @@ index 0000000..f888b36 |
3720 |
+ * |
3721 |
+ * Encountered functions are added to the children vector (next_interesting_function_t). |
3722 |
+ */ |
3723 |
-+static next_interesting_function_t walk_use_def_next_functions(struct pointer_set_t *visited, next_interesting_function_t next_cnodes_head, const_tree lhs) |
3724 |
++static next_interesting_function_t walk_use_def_next_functions(gimple_set *visited, next_interesting_function_t next_cnodes_head, const_tree lhs) |
3725 |
+{ |
3726 |
+ const_gimple def_stmt; |
3727 |
+ |
3728 |
@@ -144850,7 +145531,7 @@ index 0000000..f888b36 |
3729 |
+ return walk_use_def_next_functions(visited, next_cnodes_head, SSA_NAME_VAR(lhs)); |
3730 |
+ case GIMPLE_ASM: |
3731 |
+ if (is_size_overflow_asm(def_stmt)) |
3732 |
-+ return walk_use_def_next_functions(visited, next_cnodes_head, get_size_overflow_asm_input(def_stmt)); |
3733 |
++ return walk_use_def_next_functions(visited, next_cnodes_head, get_size_overflow_asm_input(as_a_const_gasm(def_stmt))); |
3734 |
+ return next_cnodes_head; |
3735 |
+ case GIMPLE_CALL: { |
3736 |
+ tree fndecl = gimple_call_fndecl(def_stmt); |
3737 |
@@ -144879,7 +145560,7 @@ index 0000000..f888b36 |
3738 |
+// Start the search for next_interesting_function_t children based on the (next_interesting_function_t) parent node |
3739 |
+static next_interesting_function_t search_next_functions(const_tree node) |
3740 |
+{ |
3741 |
-+ struct pointer_set_t *visited; |
3742 |
++ gimple_set *visited; |
3743 |
+ next_interesting_function_t next_cnodes_head; |
3744 |
+ |
3745 |
+ visited = pointer_set_create(); |
3746 |
@@ -144988,16 +145669,16 @@ index 0000000..f888b36 |
3747 |
+ |
3748 |
+ switch (gimple_code(stmt)) { |
3749 |
+ case GIMPLE_ASM: |
3750 |
-+ if (!is_size_overflow_insert_check_asm(stmt)) |
3751 |
++ if (!is_size_overflow_insert_check_asm(as_a_const_gasm(stmt))) |
3752 |
+ return; |
3753 |
-+ start_var = get_size_overflow_asm_input(stmt); |
3754 |
++ start_var = get_size_overflow_asm_input(as_a_const_gasm(stmt)); |
3755 |
+ gcc_assert(start_var != NULL_TREE); |
3756 |
+ break; |
3757 |
+ case GIMPLE_CALL: |
3758 |
+ start_var = gimple_call_arg(stmt, num - 1); |
3759 |
+ break; |
3760 |
+ case GIMPLE_RETURN: |
3761 |
-+ start_var = gimple_return_retval(stmt); |
3762 |
++ start_var = gimple_return_retval(as_a_const_greturn(stmt)); |
3763 |
+ if (start_var == NULL_TREE) |
3764 |
+ return; |
3765 |
+ break; |
3766 |
@@ -145253,7 +145934,7 @@ index 0000000..f888b36 |
3767 |
+} |
3768 |
+ |
3769 |
+// Do a depth-first recursive dump of the next_interesting_function_t children vector |
3770 |
-+static void print_missing_functions(struct pointer_set_t *visited, next_interesting_function_t parent) |
3771 |
++static void print_missing_functions(next_interesting_function_set *visited, next_interesting_function_t parent) |
3772 |
+{ |
3773 |
+ unsigned int i; |
3774 |
+ next_interesting_function_t child; |
3775 |
@@ -145283,10 +145964,10 @@ index 0000000..f888b36 |
3776 |
+static unsigned int size_overflow_execute(void) |
3777 |
+{ |
3778 |
+ unsigned int i; |
3779 |
-+ struct pointer_set_t *visited; |
3780 |
++ next_interesting_function_set *visited; |
3781 |
+ next_interesting_function_t cur_global; |
3782 |
+ |
3783 |
-+ visited = pointer_set_create(); |
3784 |
++ visited = next_interesting_function_pointer_set_create(); |
3785 |
+ |
3786 |
+ for (i = 0; i < GLOBAL_NIFN_LEN; i++) { |
3787 |
+ for (cur_global = global_next_interesting_function[i]; cur_global; cur_global = cur_global->next) { |
3788 |
@@ -145327,7 +146008,8 @@ index 0000000..f888b36 |
3789 |
+#if BUILDING_GCC_VERSION >= 4008 |
3790 |
+ .optinfo_flags = OPTGROUP_NONE, |
3791 |
+#endif |
3792 |
-+#if BUILDING_GCC_VERSION >= 4009 |
3793 |
++#if BUILDING_GCC_VERSION >= 5000 |
3794 |
++#elif BUILDING_GCC_VERSION >= 4009 |
3795 |
+ .has_gate = false, |
3796 |
+ .has_execute = true, |
3797 |
+#else |
3798 |
@@ -145374,7 +146056,11 @@ index 0000000..f888b36 |
3799 |
+ 0, |
3800 |
+ size_overflow_transform, |
3801 |
+ NULL) {} |
3802 |
++#if BUILDING_GCC_VERSION >= 5000 |
3803 |
++ virtual unsigned int execute(function *) { return size_overflow_execute(); } |
3804 |
++#else |
3805 |
+ unsigned int execute() { return size_overflow_execute(); } |
3806 |
++#endif |
3807 |
+}; |
3808 |
+} |
3809 |
+ |
3810 |
@@ -145390,10 +146076,10 @@ index 0000000..f888b36 |
3811 |
+#endif |
3812 |
diff --git a/tools/gcc/size_overflow_plugin/size_overflow_plugin.c b/tools/gcc/size_overflow_plugin/size_overflow_plugin.c |
3813 |
new file mode 100644 |
3814 |
-index 0000000..036dc3f |
3815 |
+index 0000000..cf8320d |
3816 |
--- /dev/null |
3817 |
+++ b/tools/gcc/size_overflow_plugin/size_overflow_plugin.c |
3818 |
-@@ -0,0 +1,231 @@ |
3819 |
+@@ -0,0 +1,256 @@ |
3820 |
+/* |
3821 |
+ * Copyright 2011-2015 by Emese Revfy <re.emese@×××××.com> |
3822 |
+ * Licensed under the GPL v2, or (at your option) v3 |
3823 |
@@ -145425,7 +146111,7 @@ index 0000000..036dc3f |
3824 |
+tree size_overflow_type_TI; |
3825 |
+ |
3826 |
+static struct plugin_info size_overflow_plugin_info = { |
3827 |
-+ .version = "20150311", |
3828 |
++ .version = "20150429", |
3829 |
+ .help = "no-size-overflow\tturn off size overflow checking\n", |
3830 |
+}; |
3831 |
+ |
3832 |
@@ -145449,10 +146135,21 @@ index 0000000..036dc3f |
3833 |
+ } |
3834 |
+ |
3835 |
+ for (; args; args = TREE_CHAIN(args)) { |
3836 |
++ int cur_val; |
3837 |
+ tree position = TREE_VALUE(args); |
3838 |
-+ if (TREE_CODE(position) != INTEGER_CST || TREE_INT_CST_LOW(position) > arg_count ) { |
3839 |
-+ error("%s: parameter %u is outside range.", __func__, (unsigned int)TREE_INT_CST_LOW(position)); |
3840 |
++ |
3841 |
++ if (TREE_CODE(position) != INTEGER_CST) { |
3842 |
++ error("%s: parameter isn't an integer", __func__); |
3843 |
++ debug_tree(args); |
3844 |
++ *no_add_attrs = true; |
3845 |
++ return NULL_TREE; |
3846 |
++ } |
3847 |
++ |
3848 |
++ cur_val = tree_to_shwi(position); |
3849 |
++ if (cur_val < 0 || arg_count < (unsigned int)cur_val) { |
3850 |
++ error("%s: parameter %d is outside range.", __func__, cur_val); |
3851 |
+ *no_add_attrs = true; |
3852 |
++ return NULL_TREE; |
3853 |
+ } |
3854 |
+ } |
3855 |
+ return NULL_TREE; |
3856 |
@@ -145461,6 +146158,7 @@ index 0000000..036dc3f |
3857 |
+static tree handle_intentional_overflow_attribute(tree *node, tree __unused name, tree args, int __unused flags, bool *no_add_attrs) |
3858 |
+{ |
3859 |
+ unsigned int arg_count; |
3860 |
++ HOST_WIDE_INT s_first_arg; |
3861 |
+ enum tree_code code = TREE_CODE(*node); |
3862 |
+ |
3863 |
+ switch (code) { |
3864 |
@@ -145479,14 +146177,27 @@ index 0000000..036dc3f |
3865 |
+ return NULL_TREE; |
3866 |
+ } |
3867 |
+ |
3868 |
-+ if (TREE_INT_CST_HIGH(TREE_VALUE(args)) != 0) |
3869 |
++ s_first_arg = tree_to_shwi(TREE_VALUE(args)); |
3870 |
++ if (s_first_arg == -1) |
3871 |
+ return NULL_TREE; |
3872 |
++ if (s_first_arg < -1) |
3873 |
++ error("%s: parameter %d is outside range.", __func__, (int)s_first_arg); |
3874 |
+ |
3875 |
+ for (; args; args = TREE_CHAIN(args)) { |
3876 |
-+ tree position = TREE_VALUE(args); |
3877 |
-+ if (TREE_CODE(position) != INTEGER_CST || TREE_INT_CST_LOW(position) > arg_count ) { |
3878 |
-+ error("%s: parameter %u is outside range.", __func__, (unsigned int)TREE_INT_CST_LOW(position)); |
3879 |
++ unsigned int cur_val; |
3880 |
++ |
3881 |
++ if (TREE_CODE(TREE_VALUE(args)) != INTEGER_CST) { |
3882 |
++ error("%s: parameter isn't an integer", __func__); |
3883 |
++ debug_tree(args); |
3884 |
++ *no_add_attrs = true; |
3885 |
++ return NULL_TREE; |
3886 |
++ } |
3887 |
++ |
3888 |
++ cur_val = (unsigned int)tree_to_uhwi(TREE_VALUE(args)); |
3889 |
++ if (cur_val > arg_count ) { |
3890 |
++ error("%s: parameter %u is outside range. (arg_count: %u)", __func__, cur_val, arg_count); |
3891 |
+ *no_add_attrs = true; |
3892 |
++ return NULL_TREE; |
3893 |
+ } |
3894 |
+ } |
3895 |
+ return NULL_TREE; |
3896 |
@@ -145627,7 +146338,7 @@ index 0000000..036dc3f |
3897 |
+} |
3898 |
diff --git a/tools/gcc/size_overflow_plugin/size_overflow_plugin_hash.c b/tools/gcc/size_overflow_plugin/size_overflow_plugin_hash.c |
3899 |
new file mode 100644 |
3900 |
-index 0000000..2384252 |
3901 |
+index 0000000..1d9ddb6 |
3902 |
--- /dev/null |
3903 |
+++ b/tools/gcc/size_overflow_plugin/size_overflow_plugin_hash.c |
3904 |
@@ -0,0 +1,345 @@ |
3905 |
@@ -145832,13 +146543,13 @@ index 0000000..2384252 |
3906 |
+ struct decl_hash decl_hash_data; |
3907 |
+ enum tree_code code = TREE_CODE(decl); |
3908 |
+ |
3909 |
-+ decl_hash_data.fn_name = decl_name; |
3910 |
+ gcc_assert(code == FIELD_DECL || code == FUNCTION_DECL || code == VAR_DECL); |
3911 |
+ |
3912 |
+ // skip builtins __builtin_constant_p |
3913 |
+ if (code == FUNCTION_DECL && DECL_BUILT_IN(decl)) |
3914 |
+ return NO_HASH; |
3915 |
+ |
3916 |
++ decl_hash_data.fn_name = decl_name; |
3917 |
+ decl_hash_data.decl = decl; |
3918 |
+ decl_hash_data.tree_codes_len = 0; |
3919 |
+ |
3920 |
@@ -145978,10 +146689,10 @@ index 0000000..2384252 |
3921 |
+ |
3922 |
diff --git a/tools/gcc/size_overflow_plugin/size_overflow_transform.c b/tools/gcc/size_overflow_plugin/size_overflow_transform.c |
3923 |
new file mode 100644 |
3924 |
-index 0000000..b02158b |
3925 |
+index 0000000..13c610e |
3926 |
--- /dev/null |
3927 |
+++ b/tools/gcc/size_overflow_plugin/size_overflow_transform.c |
3928 |
-@@ -0,0 +1,430 @@ |
3929 |
+@@ -0,0 +1,431 @@ |
3930 |
+/* |
3931 |
+ * Copyright 2011-2015 by Emese Revfy <re.emese@×××××.com> |
3932 |
+ * Licensed under the GPL v2, or (at your option) v3 |
3933 |
@@ -146010,10 +146721,10 @@ index 0000000..b02158b |
3934 |
+ gimple_stmt_iterator gsi = gsi_for_stmt(stmt); |
3935 |
+ |
3936 |
+ assign = build_cast_stmt(visited, orig_type, new_node, CREATE_NEW_VAR, &gsi, BEFORE_STMT, false); |
3937 |
-+ return gimple_assign_lhs(assign); |
3938 |
++ return get_lhs(assign); |
3939 |
+} |
3940 |
+ |
3941 |
-+static void change_size_overflow_asm_input(gimple stmt, tree new_input) |
3942 |
++static void change_size_overflow_asm_input(gasm *stmt, tree new_input) |
3943 |
+{ |
3944 |
+ tree list; |
3945 |
+ |
3946 |
@@ -146030,13 +146741,13 @@ index 0000000..b02158b |
3947 |
+ |
3948 |
+ switch (gimple_code(stmt)) { |
3949 |
+ case GIMPLE_RETURN: |
3950 |
-+ gimple_return_set_retval(stmt, cast_lhs); |
3951 |
++ gimple_return_set_retval(as_a_greturn(stmt), cast_lhs); |
3952 |
+ break; |
3953 |
+ case GIMPLE_CALL: |
3954 |
+ gimple_call_set_arg(stmt, num - 1, cast_lhs); |
3955 |
+ break; |
3956 |
+ case GIMPLE_ASM: |
3957 |
-+ change_size_overflow_asm_input(stmt, cast_lhs); |
3958 |
++ change_size_overflow_asm_input(as_a_gasm(stmt), cast_lhs); |
3959 |
+ break; |
3960 |
+ default: |
3961 |
+ debug_gimple_stmt(stmt); |
3962 |
@@ -146221,7 +146932,7 @@ index 0000000..b02158b |
3963 |
+ return field; |
3964 |
+} |
3965 |
+ |
3966 |
-+static tree get_fn_or_fnptr_decl(const_gimple call_stmt) |
3967 |
++static tree get_fn_or_fnptr_decl(const gcall *call_stmt) |
3968 |
+{ |
3969 |
+ const_tree fnptr; |
3970 |
+ const_gimple def_stmt; |
3971 |
@@ -146239,7 +146950,7 @@ index 0000000..b02158b |
3972 |
+} |
3973 |
+ |
3974 |
+// Start stmt duplication on marked function parameters |
3975 |
-+static struct interesting_stmts *search_interesting_calls(struct interesting_stmts *head, gimple call_stmt) |
3976 |
++static struct interesting_stmts *search_interesting_calls(struct interesting_stmts *head, gcall *call_stmt) |
3977 |
+{ |
3978 |
+ tree decl; |
3979 |
+ unsigned int i, len; |
3980 |
@@ -146285,21 +146996,21 @@ index 0000000..b02158b |
3981 |
+ |
3982 |
+ switch (gimple_code(stmt)) { |
3983 |
+ case GIMPLE_ASM: |
3984 |
-+ if (!is_size_overflow_insert_check_asm(stmt)) |
3985 |
++ if (!is_size_overflow_insert_check_asm(as_a_gasm(stmt))) |
3986 |
+ continue; |
3987 |
-+ first_node = get_size_overflow_asm_input(stmt); |
3988 |
++ first_node = get_size_overflow_asm_input(as_a_gasm(stmt)); |
3989 |
+ head = search_interesting_stmt(head, stmt, first_node, 0); |
3990 |
+ break; |
3991 |
+ case GIMPLE_RETURN: |
3992 |
+ if (!search_ret) |
3993 |
+ continue; |
3994 |
-+ first_node = gimple_return_retval(stmt); |
3995 |
++ first_node = gimple_return_retval(as_a_greturn(stmt)); |
3996 |
+ if (first_node == NULL_TREE) |
3997 |
+ break; |
3998 |
+ head = search_interesting_stmt(head, stmt, first_node, 0); |
3999 |
+ break; |
4000 |
+ case GIMPLE_CALL: |
4001 |
-+ head = search_interesting_calls(head, stmt); |
4002 |
++ head = search_interesting_calls(head, as_a_gcall(stmt)); |
4003 |
+ break; |
4004 |
+ default: |
4005 |
+ break; |
4006 |
@@ -146334,9 +147045,9 @@ index 0000000..b02158b |
4007 |
+} |
4008 |
+ |
4009 |
+// Remove the size_overflow asm stmt and create an assignment from the input and output of the asm |
4010 |
-+static void replace_size_overflow_asm_with_assign(gimple asm_stmt, tree lhs, tree rhs) |
4011 |
++static void replace_size_overflow_asm_with_assign(gasm *asm_stmt, tree lhs, tree rhs) |
4012 |
+{ |
4013 |
-+ gimple assign; |
4014 |
++ gassign *assign; |
4015 |
+ gimple_stmt_iterator gsi; |
4016 |
+ |
4017 |
+ // already removed |
4018 |
@@ -146360,16 +147071,17 @@ index 0000000..b02158b |
4019 |
+ if (!is_size_overflow_asm(stmt)) |
4020 |
+ return; |
4021 |
+ |
4022 |
-+ if (gimple_asm_noutputs(stmt) == 0) { |
4023 |
++ if (gimple_asm_noutputs(as_a_gasm(stmt)) == 0) { |
4024 |
+ gsi = gsi_for_stmt(stmt); |
4025 |
-+ ipa_remove_stmt_references(cgraph_get_create_node(current_function_decl), stmt); |
4026 |
++ |
4027 |
++ ipa_remove_stmt_references(cgraph_get_node(current_function_decl), stmt); |
4028 |
+ gsi_remove(&gsi, true); |
4029 |
+ return; |
4030 |
+ } |
4031 |
+ |
4032 |
-+ input = gimple_asm_input_op(stmt, 0); |
4033 |
-+ output = gimple_asm_output_op(stmt, 0); |
4034 |
-+ replace_size_overflow_asm_with_assign(stmt, TREE_VALUE(output), TREE_VALUE(input)); |
4035 |
++ input = gimple_asm_input_op(as_a_gasm(stmt), 0); |
4036 |
++ output = gimple_asm_output_op(as_a_gasm(stmt), 0); |
4037 |
++ replace_size_overflow_asm_with_assign(as_a_gasm(stmt), TREE_VALUE(output), TREE_VALUE(input)); |
4038 |
+} |
4039 |
+ |
4040 |
+static void remove_all_size_overflow_asm(void) |
4041 |
@@ -146414,10 +147126,10 @@ index 0000000..b02158b |
4042 |
+} |
4043 |
diff --git a/tools/gcc/size_overflow_plugin/size_overflow_transform_core.c b/tools/gcc/size_overflow_plugin/size_overflow_transform_core.c |
4044 |
new file mode 100644 |
4045 |
-index 0000000..fd4aa92 |
4046 |
+index 0000000..ec1596a |
4047 |
--- /dev/null |
4048 |
+++ b/tools/gcc/size_overflow_plugin/size_overflow_transform_core.c |
4049 |
-@@ -0,0 +1,956 @@ |
4050 |
+@@ -0,0 +1,941 @@ |
4051 |
+/* |
4052 |
+ * Copyright 2011-2015 by Emese Revfy <re.emese@×××××.com> |
4053 |
+ * Licensed under the GPL v2, or (at your option) v3 |
4054 |
@@ -146487,23 +147199,9 @@ index 0000000..fd4aa92 |
4055 |
+ return new_type; |
4056 |
+} |
4057 |
+ |
4058 |
-+static tree get_lhs(const_gimple stmt) |
4059 |
-+{ |
4060 |
-+ switch (gimple_code(stmt)) { |
4061 |
-+ case GIMPLE_ASSIGN: |
4062 |
-+ case GIMPLE_CALL: |
4063 |
-+ return gimple_get_lhs(stmt); |
4064 |
-+ case GIMPLE_PHI: |
4065 |
-+ return gimple_phi_result(stmt); |
4066 |
-+ default: |
4067 |
-+ return NULL_TREE; |
4068 |
-+ } |
4069 |
-+} |
4070 |
-+ |
4071 |
+static tree cast_to_new_size_overflow_type(struct visited *visited, gimple stmt, tree rhs, tree size_overflow_type, bool before) |
4072 |
+{ |
4073 |
+ gimple_stmt_iterator gsi; |
4074 |
-+ tree lhs; |
4075 |
+ gimple new_stmt; |
4076 |
+ |
4077 |
+ if (rhs == NULL_TREE) |
4078 |
@@ -146515,9 +147213,7 @@ index 0000000..fd4aa92 |
4079 |
+ gimple_assign_set_rhs_code(new_stmt, CONVERT_EXPR); |
4080 |
+ pointer_set_insert(visited->my_stmts, new_stmt); |
4081 |
+ |
4082 |
-+ lhs = get_lhs(new_stmt); |
4083 |
-+ gcc_assert(lhs != NULL_TREE); |
4084 |
-+ return lhs; |
4085 |
++ return get_lhs(new_stmt); |
4086 |
+} |
4087 |
+ |
4088 |
+tree create_assign(struct visited *visited, gimple oldstmt, tree rhs1, bool before) |
4089 |
@@ -146578,9 +147274,9 @@ index 0000000..fd4aa92 |
4090 |
+ return cast_to_new_size_overflow_type(visited, oldstmt, rhs1, dst_type, before); |
4091 |
+} |
4092 |
+ |
4093 |
-+tree dup_assign(struct visited *visited, gimple oldstmt, const_tree node, tree rhs1, tree rhs2, tree __unused rhs3) |
4094 |
++tree dup_assign(struct visited *visited, gassign *oldstmt, const_tree node, tree rhs1, tree rhs2, tree __unused rhs3) |
4095 |
+{ |
4096 |
-+ gimple stmt; |
4097 |
++ gassign *stmt; |
4098 |
+ gimple_stmt_iterator gsi; |
4099 |
+ tree size_overflow_type, new_var, lhs = gimple_assign_lhs(oldstmt); |
4100 |
+ |
4101 |
@@ -146596,7 +147292,7 @@ index 0000000..fd4aa92 |
4102 |
+ rhs2 = create_assign(visited, oldstmt, rhs2, BEFORE_STMT); |
4103 |
+ } |
4104 |
+ |
4105 |
-+ stmt = gimple_copy(oldstmt); |
4106 |
++ stmt = as_a_gassign(gimple_copy(oldstmt)); |
4107 |
+ gimple_set_location(stmt, gimple_location(oldstmt)); |
4108 |
+ pointer_set_insert(visited->my_stmts, stmt); |
4109 |
+ |
4110 |
@@ -146630,7 +147326,7 @@ index 0000000..fd4aa92 |
4111 |
+ |
4112 |
+static tree cast_parm_decl(struct visited *visited, tree phi_ssa_name, tree arg, tree size_overflow_type, basic_block bb) |
4113 |
+{ |
4114 |
-+ gimple assign; |
4115 |
++ const_gimple assign; |
4116 |
+ gimple_stmt_iterator gsi; |
4117 |
+ basic_block first_bb; |
4118 |
+ |
4119 |
@@ -146646,14 +147342,14 @@ index 0000000..fd4aa92 |
4120 |
+ gsi = gsi_after_labels(bb); |
4121 |
+ assign = build_cast_stmt(visited, size_overflow_type, arg, phi_ssa_name, &gsi, BEFORE_STMT, false); |
4122 |
+ pointer_set_insert(visited->my_stmts, assign); |
4123 |
-+ |
4124 |
-+ return gimple_assign_lhs(assign); |
4125 |
++ return get_lhs(assign); |
4126 |
+} |
4127 |
+ |
4128 |
+static tree use_phi_ssa_name(struct visited *visited, tree ssa_name_var, tree new_arg) |
4129 |
+{ |
4130 |
+ gimple_stmt_iterator gsi; |
4131 |
-+ gimple assign, def_stmt = get_def_stmt(new_arg); |
4132 |
++ const_gimple assign; |
4133 |
++ gimple def_stmt = get_def_stmt(new_arg); |
4134 |
+ |
4135 |
+ if (gimple_code(def_stmt) == GIMPLE_PHI) { |
4136 |
+ gsi = gsi_after_labels(gimple_bb(def_stmt)); |
4137 |
@@ -146664,7 +147360,7 @@ index 0000000..fd4aa92 |
4138 |
+ } |
4139 |
+ |
4140 |
+ pointer_set_insert(visited->my_stmts, assign); |
4141 |
-+ return gimple_assign_lhs(assign); |
4142 |
++ return get_lhs(assign); |
4143 |
+} |
4144 |
+ |
4145 |
+static tree cast_visited_phi_arg(struct visited *visited, tree ssa_name_var, tree arg, tree size_overflow_type) |
4146 |
@@ -146672,7 +147368,7 @@ index 0000000..fd4aa92 |
4147 |
+ basic_block bb; |
4148 |
+ gimple_stmt_iterator gsi; |
4149 |
+ const_gimple def_stmt; |
4150 |
-+ gimple assign; |
4151 |
++ const_gimple assign; |
4152 |
+ |
4153 |
+ def_stmt = get_def_stmt(arg); |
4154 |
+ bb = gimple_bb(def_stmt); |
4155 |
@@ -146681,10 +147377,10 @@ index 0000000..fd4aa92 |
4156 |
+ |
4157 |
+ assign = build_cast_stmt(visited, size_overflow_type, arg, ssa_name_var, &gsi, BEFORE_STMT, false); |
4158 |
+ pointer_set_insert(visited->my_stmts, assign); |
4159 |
-+ return gimple_assign_lhs(assign); |
4160 |
++ return get_lhs(assign); |
4161 |
+} |
4162 |
+ |
4163 |
-+static tree create_new_phi_arg(struct visited *visited, tree ssa_name_var, tree new_arg, gimple oldstmt, unsigned int i) |
4164 |
++static tree create_new_phi_arg(struct visited *visited, tree ssa_name_var, tree new_arg, gphi *oldstmt, unsigned int i) |
4165 |
+{ |
4166 |
+ tree size_overflow_type; |
4167 |
+ tree arg; |
4168 |
@@ -146709,12 +147405,13 @@ index 0000000..fd4aa92 |
4169 |
+ } |
4170 |
+ case GIMPLE_ASM: { |
4171 |
+ gimple_stmt_iterator gsi; |
4172 |
-+ gimple assign, stmt = get_def_stmt(arg); |
4173 |
++ const_gimple assign; |
4174 |
++ gimple stmt = get_def_stmt(arg); |
4175 |
+ |
4176 |
+ gsi = gsi_for_stmt(stmt); |
4177 |
+ assign = build_cast_stmt(visited, size_overflow_type, arg, ssa_name_var, &gsi, AFTER_STMT, false); |
4178 |
+ pointer_set_insert(visited->my_stmts, assign); |
4179 |
-+ return gimple_assign_lhs(assign); |
4180 |
++ return get_lhs(assign); |
4181 |
+ } |
4182 |
+ default: |
4183 |
+ gcc_assert(new_arg != NULL_TREE); |
4184 |
@@ -146723,10 +147420,10 @@ index 0000000..fd4aa92 |
4185 |
+ } |
4186 |
+} |
4187 |
+ |
4188 |
-+static gimple overflow_create_phi_node(struct visited *visited, gimple oldstmt, tree result) |
4189 |
++static gphi *overflow_create_phi_node(struct visited *visited, gphi *oldstmt, tree result) |
4190 |
+{ |
4191 |
+ basic_block bb; |
4192 |
-+ gimple phi; |
4193 |
++ gphi *phi; |
4194 |
+ gimple_seq seq; |
4195 |
+ gimple_stmt_iterator gsi = gsi_for_stmt(oldstmt); |
4196 |
+ |
4197 |
@@ -146754,10 +147451,10 @@ index 0000000..fd4aa92 |
4198 |
+#if BUILDING_GCC_VERSION <= 4007 |
4199 |
+static tree create_new_phi_node(struct visited *visited, VEC(tree, heap) **args, tree ssa_name_var, gimple oldstmt) |
4200 |
+#else |
4201 |
-+static tree create_new_phi_node(struct visited *visited, vec<tree, va_heap, vl_embed> *&args, tree ssa_name_var, gimple oldstmt) |
4202 |
++static tree create_new_phi_node(struct visited *visited, vec<tree, va_heap, vl_embed> *&args, tree ssa_name_var, gphi *oldstmt) |
4203 |
+#endif |
4204 |
+{ |
4205 |
-+ gimple new_phi; |
4206 |
++ gphi *new_phi; |
4207 |
+ unsigned int i; |
4208 |
+ tree arg, result; |
4209 |
+ location_t loc = gimple_location(oldstmt); |
4210 |
@@ -146799,7 +147496,7 @@ index 0000000..fd4aa92 |
4211 |
+#else |
4212 |
+ vec<tree, va_heap, vl_embed> *args = NULL; |
4213 |
+#endif |
4214 |
-+ gimple oldstmt = get_def_stmt(orig_result); |
4215 |
++ gphi *oldstmt = as_a_gphi(get_def_stmt(orig_result)); |
4216 |
+ unsigned int i, len = gimple_phi_num_args(oldstmt); |
4217 |
+ |
4218 |
+ pointer_set_insert(visited->stmts, oldstmt); |
4219 |
@@ -146832,7 +147529,7 @@ index 0000000..fd4aa92 |
4220 |
+#endif |
4221 |
+} |
4222 |
+ |
4223 |
-+static tree create_cast_assign(struct visited *visited, gimple stmt) |
4224 |
++static tree create_cast_assign(struct visited *visited, gassign *stmt) |
4225 |
+{ |
4226 |
+ tree rhs1 = gimple_assign_rhs1(stmt); |
4227 |
+ tree lhs = gimple_assign_lhs(stmt); |
4228 |
@@ -146845,7 +147542,7 @@ index 0000000..fd4aa92 |
4229 |
+ return create_assign(visited, stmt, rhs1, AFTER_STMT); |
4230 |
+} |
4231 |
+ |
4232 |
-+static bool skip_lhs_cast_check(const_gimple stmt) |
4233 |
++static bool skip_lhs_cast_check(const gassign *stmt) |
4234 |
+{ |
4235 |
+ const_tree rhs = gimple_assign_rhs1(stmt); |
4236 |
+ const_gimple def_stmt = get_def_stmt(rhs); |
4237 |
@@ -146879,7 +147576,7 @@ index 0000000..fd4aa92 |
4238 |
+ |
4239 |
+static void insert_cond(basic_block cond_bb, tree arg, enum tree_code cond_code, tree type_value) |
4240 |
+{ |
4241 |
-+ gimple cond_stmt; |
4242 |
++ gcond *cond_stmt; |
4243 |
+ gimple_stmt_iterator gsi = gsi_last_bb(cond_bb); |
4244 |
+ |
4245 |
+ cond_stmt = gimple_build_cond(cond_code, arg, type_value, NULL_TREE, NULL_TREE); |
4246 |
@@ -146889,7 +147586,7 @@ index 0000000..fd4aa92 |
4247 |
+ |
4248 |
+static void insert_cond_result(basic_block bb_true, const_gimple stmt, const_tree arg, bool min) |
4249 |
+{ |
4250 |
-+ gimple func_stmt; |
4251 |
++ gcall *func_stmt; |
4252 |
+ const_gimple def_stmt; |
4253 |
+ const_tree loc_line; |
4254 |
+ tree loc_file, ssa_name, current_func; |
4255 |
@@ -147012,7 +147709,7 @@ index 0000000..fd4aa92 |
4256 |
+ insert_check_size_overflow(stmt, LT_EXPR, cast_rhs, type_min, before, MIN_CHECK); |
4257 |
+} |
4258 |
+ |
4259 |
-+static tree create_cast_overflow_check(struct visited *visited, tree new_rhs1, gimple stmt) |
4260 |
++static tree create_cast_overflow_check(struct visited *visited, tree new_rhs1, gassign *stmt) |
4261 |
+{ |
4262 |
+ bool cast_lhs, cast_rhs; |
4263 |
+ tree lhs = gimple_assign_lhs(stmt); |
4264 |
@@ -147065,7 +147762,7 @@ index 0000000..fd4aa92 |
4265 |
+ return dup_assign(visited, stmt, lhs, new_rhs1, NULL_TREE, NULL_TREE); |
4266 |
+} |
4267 |
+ |
4268 |
-+static tree handle_unary_rhs(struct visited *visited, gimple stmt) |
4269 |
++static tree handle_unary_rhs(struct visited *visited, gassign *stmt) |
4270 |
+{ |
4271 |
+ enum tree_code rhs_code; |
4272 |
+ tree rhs1, new_rhs1, lhs = gimple_assign_lhs(stmt); |
4273 |
@@ -147100,7 +147797,7 @@ index 0000000..fd4aa92 |
4274 |
+ return create_cast_overflow_check(visited, new_rhs1, stmt); |
4275 |
+} |
4276 |
+ |
4277 |
-+static tree handle_unary_ops(struct visited *visited, gimple stmt) |
4278 |
++static tree handle_unary_ops(struct visited *visited, gassign *stmt) |
4279 |
+{ |
4280 |
+ tree rhs1, lhs = gimple_assign_lhs(stmt); |
4281 |
+ gimple def_stmt = get_def_stmt(lhs); |
4282 |
@@ -147113,7 +147810,7 @@ index 0000000..fd4aa92 |
4283 |
+ |
4284 |
+ switch (TREE_CODE(rhs1)) { |
4285 |
+ case SSA_NAME: { |
4286 |
-+ tree ret = handle_unary_rhs(visited, def_stmt); |
4287 |
++ tree ret = handle_unary_rhs(visited, as_a_gassign(def_stmt)); |
4288 |
+ |
4289 |
+ if (gimple_assign_cast_p(stmt)) |
4290 |
+ unsigned_signed_cast_intentional_overflow(visited, stmt); |
4291 |
@@ -147162,7 +147859,7 @@ index 0000000..fd4aa92 |
4292 |
+} |
4293 |
+ |
4294 |
+// Skip duplication when there is a minus expr and the type of rhs1 or rhs2 is a pointer_type. |
4295 |
-+static bool is_ptr_diff(gimple stmt) |
4296 |
++static bool is_ptr_diff(gassign *stmt) |
4297 |
+{ |
4298 |
+ const_tree rhs1, rhs2, ptr1_rhs, ptr2_rhs; |
4299 |
+ |
4300 |
@@ -147190,7 +147887,7 @@ index 0000000..fd4aa92 |
4301 |
+{ |
4302 |
+ enum intentional_overflow_type res; |
4303 |
+ tree rhs1, rhs2, new_lhs; |
4304 |
-+ gimple def_stmt = get_def_stmt(lhs); |
4305 |
++ gassign *def_stmt = as_a_gassign(get_def_stmt(lhs)); |
4306 |
+ tree new_rhs1 = NULL_TREE; |
4307 |
+ tree new_rhs2 = NULL_TREE; |
4308 |
+ |
4309 |
@@ -147231,13 +147928,13 @@ index 0000000..fd4aa92 |
4310 |
+ res = add_mul_intentional_overflow(def_stmt); |
4311 |
+ if (res != NO_INTENTIONAL_OVERFLOW) { |
4312 |
+ new_lhs = dup_assign(visited, def_stmt, lhs, new_rhs1, new_rhs2, NULL_TREE); |
4313 |
-+ insert_cast_expr(visited, get_def_stmt(new_lhs), res); |
4314 |
++ insert_cast_expr(visited, as_a_gassign(get_def_stmt(new_lhs)), res); |
4315 |
+ return new_lhs; |
4316 |
+ } |
4317 |
+ |
4318 |
+ if (skip_expr_on_double_type(def_stmt)) { |
4319 |
+ new_lhs = dup_assign(visited, def_stmt, lhs, new_rhs1, new_rhs2, NULL_TREE); |
4320 |
-+ insert_cast_expr(visited, get_def_stmt(new_lhs), NO_INTENTIONAL_OVERFLOW); |
4321 |
++ insert_cast_expr(visited, as_a_gassign(get_def_stmt(new_lhs)), NO_INTENTIONAL_OVERFLOW); |
4322 |
+ return new_lhs; |
4323 |
+ } |
4324 |
+ |
4325 |
@@ -147274,7 +147971,7 @@ index 0000000..fd4aa92 |
4326 |
+static tree handle_ternary_ops(struct visited *visited, tree lhs) |
4327 |
+{ |
4328 |
+ tree rhs1, rhs2, rhs3, new_rhs1, new_rhs2, new_rhs3, size_overflow_type; |
4329 |
-+ gimple def_stmt = get_def_stmt(lhs); |
4330 |
++ gassign *def_stmt = as_a_gassign(get_def_stmt(lhs)); |
4331 |
+ |
4332 |
+ size_overflow_type = get_size_overflow_type(visited, def_stmt, lhs); |
4333 |
+ |
4334 |
@@ -147355,12 +148052,12 @@ index 0000000..fd4aa92 |
4335 |
+ case GIMPLE_CALL: |
4336 |
+ case GIMPLE_ASM: |
4337 |
+ if (is_size_overflow_asm(def_stmt)) |
4338 |
-+ return expand(visited, get_size_overflow_asm_input(def_stmt)); |
4339 |
++ return expand(visited, get_size_overflow_asm_input(as_a_gasm(def_stmt))); |
4340 |
+ return create_assign(visited, def_stmt, lhs, AFTER_STMT); |
4341 |
+ case GIMPLE_ASSIGN: |
4342 |
+ switch (gimple_num_ops(def_stmt)) { |
4343 |
+ case 2: |
4344 |
-+ return handle_unary_ops(visited, def_stmt); |
4345 |
++ return handle_unary_ops(visited, as_a_gassign(def_stmt)); |
4346 |
+ case 3: |
4347 |
+ return handle_binary_ops(visited, lhs); |
4348 |
+#if BUILDING_GCC_VERSION >= 4006 |
4349 |
@@ -147376,10 +148073,10 @@ index 0000000..fd4aa92 |
4350 |
+} |
4351 |
diff --git a/tools/gcc/stackleak_plugin.c b/tools/gcc/stackleak_plugin.c |
4352 |
new file mode 100644 |
4353 |
-index 0000000..51dc09d |
4354 |
+index 0000000..1d296ce |
4355 |
--- /dev/null |
4356 |
+++ b/tools/gcc/stackleak_plugin.c |
4357 |
-@@ -0,0 +1,408 @@ |
4358 |
+@@ -0,0 +1,432 @@ |
4359 |
+/* |
4360 |
+ * Copyright 2011-2015 by the PaX Team <pageexec@××××××××.hu> |
4361 |
+ * Licensed under the GPL v2 |
4362 |
@@ -147412,29 +148109,49 @@ index 0000000..51dc09d |
4363 |
+static bool init_locals; |
4364 |
+ |
4365 |
+static struct plugin_info stackleak_plugin_info = { |
4366 |
-+ .version = "201408011900", |
4367 |
++ .version = "201504282245", |
4368 |
+ .help = "track-lowest-sp=nn\ttrack sp in functions whose frame size is at least nn bytes\n" |
4369 |
+// "initialize-locals\t\tforcibly initialize all stack frames\n" |
4370 |
+}; |
4371 |
+ |
4372 |
+static void stackleak_check_alloca(gimple_stmt_iterator *gsi) |
4373 |
+{ |
4374 |
-+ gimple check_alloca; |
4375 |
++ gcall *check_alloca; |
4376 |
+ tree alloca_size; |
4377 |
++ cgraph_node_ptr node; |
4378 |
++ int frequency; |
4379 |
++ basic_block bb; |
4380 |
+ |
4381 |
+ // insert call to void pax_check_alloca(unsigned long size) |
4382 |
+ alloca_size = gimple_call_arg(gsi_stmt(*gsi), 0); |
4383 |
+ check_alloca = gimple_build_call(check_function_decl, 1, alloca_size); |
4384 |
+ gsi_insert_before(gsi, check_alloca, GSI_SAME_STMT); |
4385 |
++ |
4386 |
++ // update the cgraph |
4387 |
++ bb = gimple_bb(check_alloca); |
4388 |
++ node = cgraph_get_create_node(check_function_decl); |
4389 |
++ gcc_assert(node); |
4390 |
++ frequency = compute_call_stmt_bb_frequency(current_function_decl, bb); |
4391 |
++ cgraph_create_edge(cgraph_get_node(current_function_decl), node, check_alloca, bb->count, frequency, bb->loop_depth); |
4392 |
+} |
4393 |
+ |
4394 |
+static void stackleak_add_instrumentation(gimple_stmt_iterator *gsi) |
4395 |
+{ |
4396 |
-+ gimple track_stack; |
4397 |
++ gcall *track_stack; |
4398 |
++ cgraph_node_ptr node; |
4399 |
++ int frequency; |
4400 |
++ basic_block bb; |
4401 |
+ |
4402 |
+ // insert call to void pax_track_stack(void) |
4403 |
+ track_stack = gimple_build_call(track_function_decl, 0); |
4404 |
+ gsi_insert_after(gsi, track_stack, GSI_CONTINUE_LINKING); |
4405 |
++ |
4406 |
++ // update the cgraph |
4407 |
++ bb = gimple_bb(track_stack); |
4408 |
++ node = cgraph_get_create_node(track_function_decl); |
4409 |
++ gcc_assert(node); |
4410 |
++ frequency = compute_call_stmt_bb_frequency(current_function_decl, bb); |
4411 |
++ cgraph_create_edge(cgraph_get_node(current_function_decl), node, track_stack, bb->count, frequency, bb->loop_depth); |
4412 |
+} |
4413 |
+ |
4414 |
+static bool is_alloca(gimple stmt) |
4415 |
@@ -147589,16 +148306,20 @@ index 0000000..51dc09d |
4416 |
+ track_function_decl = build_fn_decl(track_function, fntype); |
4417 |
+ DECL_ASSEMBLER_NAME(track_function_decl); // for LTO |
4418 |
+ TREE_PUBLIC(track_function_decl) = 1; |
4419 |
++ TREE_USED(track_function_decl) = 1; |
4420 |
+ DECL_EXTERNAL(track_function_decl) = 1; |
4421 |
+ DECL_ARTIFICIAL(track_function_decl) = 1; |
4422 |
++ DECL_PRESERVE_P(track_function_decl) = 1; |
4423 |
+ |
4424 |
+ // void pax_check_alloca(unsigned long) |
4425 |
+ fntype = build_function_type_list(void_type_node, long_unsigned_type_node, NULL_TREE); |
4426 |
+ check_function_decl = build_fn_decl(check_function, fntype); |
4427 |
+ DECL_ASSEMBLER_NAME(check_function_decl); // for LTO |
4428 |
+ TREE_PUBLIC(check_function_decl) = 1; |
4429 |
++ TREE_USED(check_function_decl) = 1; |
4430 |
+ DECL_EXTERNAL(check_function_decl) = 1; |
4431 |
+ DECL_ARTIFICIAL(check_function_decl) = 1; |
4432 |
++ DECL_PRESERVE_P(check_function_decl) = 1; |
4433 |
+} |
4434 |
+ |
4435 |
+#if BUILDING_GCC_VERSION >= 4009 |
4436 |
|
4437 |
diff --git a/3.2.68/0000_README b/3.2.68/0000_README |
4438 |
index 15188a5..bd504a3 100644 |
4439 |
--- a/3.2.68/0000_README |
4440 |
+++ b/3.2.68/0000_README |
4441 |
@@ -190,7 +190,7 @@ Patch: 1067_linux-3.2.68.patch |
4442 |
From: http://www.kernel.org |
4443 |
Desc: Linux 3.2.68 |
4444 |
|
4445 |
-Patch: 4420_grsecurity-3.1-3.2.68-201504270825.patch |
4446 |
+Patch: 4420_grsecurity-3.1-3.2.68-201504302116.patch |
4447 |
From: http://www.grsecurity.net |
4448 |
Desc: hardened-sources base patch from upstream grsecurity |
4449 |
|
4450 |
|
4451 |
diff --git a/3.2.68/4420_grsecurity-3.1-3.2.68-201504270825.patch b/3.2.68/4420_grsecurity-3.1-3.2.68-201504302116.patch |
4452 |
similarity index 99% |
4453 |
rename from 3.2.68/4420_grsecurity-3.1-3.2.68-201504270825.patch |
4454 |
rename to 3.2.68/4420_grsecurity-3.1-3.2.68-201504302116.patch |
4455 |
index 5f8c996..bf41e91 100644 |
4456 |
--- a/3.2.68/4420_grsecurity-3.1-3.2.68-201504270825.patch |
4457 |
+++ b/3.2.68/4420_grsecurity-3.1-3.2.68-201504302116.patch |
4458 |
@@ -14766,8 +14766,21 @@ index 8ca8283..8dc71fa 100644 |
4459 |
#endif /* __ASSEMBLY__ */ |
4460 |
|
4461 |
#include <asm-generic/memory_model.h> |
4462 |
+diff --git a/arch/x86/include/asm/page_32.h b/arch/x86/include/asm/page_32.h |
4463 |
+index da4e762..592f614 100644 |
4464 |
+--- a/arch/x86/include/asm/page_32.h |
4465 |
++++ b/arch/x86/include/asm/page_32.h |
4466 |
+@@ -11,7 +11,7 @@ |
4467 |
+ |
4468 |
+ #define __phys_addr_nodebug(x) ((x) - PAGE_OFFSET) |
4469 |
+ #ifdef CONFIG_DEBUG_VIRTUAL |
4470 |
+-extern unsigned long __phys_addr(unsigned long); |
4471 |
++extern unsigned long __intentional_overflow(-1) __phys_addr(unsigned long); |
4472 |
+ #else |
4473 |
+ #define __phys_addr(x) __phys_addr_nodebug(x) |
4474 |
+ #endif |
4475 |
diff --git a/arch/x86/include/asm/page_64_types.h b/arch/x86/include/asm/page_64_types.h |
4476 |
-index a9e9937..2bf88cc 100644 |
4477 |
+index a9e9937..a398cb4 100644 |
4478 |
--- a/arch/x86/include/asm/page_64_types.h |
4479 |
+++ b/arch/x86/include/asm/page_64_types.h |
4480 |
@@ -1,7 +1,7 @@ |
4481 |
@@ -14779,15 +14792,18 @@ index a9e9937..2bf88cc 100644 |
4482 |
#define THREAD_SIZE (PAGE_SIZE << THREAD_ORDER) |
4483 |
#define CURRENT_MASK (~(THREAD_SIZE - 1)) |
4484 |
|
4485 |
-@@ -55,7 +55,7 @@ void copy_page(void *to, void *from); |
4486 |
+@@ -55,9 +55,9 @@ void copy_page(void *to, void *from); |
4487 |
|
4488 |
/* duplicated to the one in bootmem.h */ |
4489 |
extern unsigned long max_pfn; |
4490 |
-extern unsigned long phys_base; |
4491 |
+extern const unsigned long phys_base; |
4492 |
|
4493 |
- extern unsigned long __phys_addr(unsigned long); |
4494 |
+-extern unsigned long __phys_addr(unsigned long); |
4495 |
++extern unsigned long __intentional_overflow(-1) __phys_addr(unsigned long); |
4496 |
#define __phys_reloc_hide(x) (x) |
4497 |
+ |
4498 |
+ #define vmemmap ((struct page *)VMEMMAP_START) |
4499 |
diff --git a/arch/x86/include/asm/paravirt.h b/arch/x86/include/asm/paravirt.h |
4500 |
index 91e758b..cac1cd6 100644 |
4501 |
--- a/arch/x86/include/asm/paravirt.h |
4502 |
@@ -16466,7 +16482,7 @@ index d7ef849..b1b009a 100644 |
4503 |
#endif |
4504 |
#endif /* _ASM_X86_THREAD_INFO_H */ |
4505 |
diff --git a/arch/x86/include/asm/uaccess.h b/arch/x86/include/asm/uaccess.h |
4506 |
-index 36361bf..9efdc12 100644 |
4507 |
+index 36361bf..916c53c 100644 |
4508 |
--- a/arch/x86/include/asm/uaccess.h |
4509 |
+++ b/arch/x86/include/asm/uaccess.h |
4510 |
@@ -7,6 +7,7 @@ |
4511 |
@@ -16536,7 +16552,32 @@ index 36361bf..9efdc12 100644 |
4512 |
|
4513 |
/* |
4514 |
* The exception table consists of pairs of addresses: the first is the |
4515 |
-@@ -182,12 +216,20 @@ extern int __get_user_bad(void); |
4516 |
+@@ -126,6 +160,15 @@ extern int __get_user_bad(void); |
4517 |
+ /* Careful: we have to cast the result to the type of the pointer |
4518 |
+ * for sign reasons */ |
4519 |
+ |
4520 |
++/* |
4521 |
++ * This is a type: either (un)signed int, if the argument fits into |
4522 |
++ * that type, or otherwise (un)signed long long. |
4523 |
++ */ |
4524 |
++#define __inttype(x) \ |
4525 |
++__typeof__(__builtin_choose_expr(sizeof(x) > sizeof(0U), \ |
4526 |
++ __builtin_choose_expr(__type_is_unsigned(__typeof__(x)), 0ULL, 0LL),\ |
4527 |
++ __builtin_choose_expr(__type_is_unsigned(__typeof__(x)), 0U, 0))) |
4528 |
++ |
4529 |
+ /** |
4530 |
+ * get_user: - Get a simple variable from user space. |
4531 |
+ * @x: Variable to store result. |
4532 |
+@@ -154,7 +197,7 @@ extern int __get_user_bad(void); |
4533 |
+ #define get_user(x, ptr) \ |
4534 |
+ ({ \ |
4535 |
+ int __ret_gu; \ |
4536 |
+- unsigned long __val_gu; \ |
4537 |
++ __inttype(*(ptr)) __val_gu; \ |
4538 |
+ __chk_user_ptr(ptr); \ |
4539 |
+ might_fault(); \ |
4540 |
+ switch (sizeof(*(ptr))) { \ |
4541 |
+@@ -182,12 +225,20 @@ extern int __get_user_bad(void); |
4542 |
asm volatile("call __put_user_" #size : "=a" (__ret_pu) \ |
4543 |
: "0" ((typeof(*(ptr)))(x)), "c" (ptr) : "ebx") |
4544 |
|
4545 |
@@ -16560,7 +16601,7 @@ index 36361bf..9efdc12 100644 |
4546 |
"3:\n" \ |
4547 |
".section .fixup,\"ax\"\n" \ |
4548 |
"4: movl %3,%0\n" \ |
4549 |
-@@ -199,8 +241,8 @@ extern int __get_user_bad(void); |
4550 |
+@@ -199,8 +250,8 @@ extern int __get_user_bad(void); |
4551 |
: "A" (x), "r" (addr), "i" (errret), "0" (err)) |
4552 |
|
4553 |
#define __put_user_asm_ex_u64(x, addr) \ |
4554 |
@@ -16571,7 +16612,7 @@ index 36361bf..9efdc12 100644 |
4555 |
"3:\n" \ |
4556 |
_ASM_EXTABLE(1b, 2b - 1b) \ |
4557 |
_ASM_EXTABLE(2b, 3b - 2b) \ |
4558 |
-@@ -252,7 +294,7 @@ extern void __put_user_8(void); |
4559 |
+@@ -252,7 +303,7 @@ extern void __put_user_8(void); |
4560 |
__typeof__(*(ptr)) __pu_val; \ |
4561 |
__chk_user_ptr(ptr); \ |
4562 |
might_fault(); \ |
4563 |
@@ -16580,7 +16621,7 @@ index 36361bf..9efdc12 100644 |
4564 |
switch (sizeof(*(ptr))) { \ |
4565 |
case 1: \ |
4566 |
__put_user_x(1, __pu_val, ptr, __ret_pu); \ |
4567 |
-@@ -373,7 +415,7 @@ do { \ |
4568 |
+@@ -373,7 +424,7 @@ do { \ |
4569 |
} while (0) |
4570 |
|
4571 |
#define __get_user_asm(x, addr, err, itype, rtype, ltype, errret) \ |
4572 |
@@ -16589,7 +16630,7 @@ index 36361bf..9efdc12 100644 |
4573 |
"2:\n" \ |
4574 |
".section .fixup,\"ax\"\n" \ |
4575 |
"3: mov %3,%0\n" \ |
4576 |
-@@ -381,7 +423,7 @@ do { \ |
4577 |
+@@ -381,7 +432,7 @@ do { \ |
4578 |
" jmp 2b\n" \ |
4579 |
".previous\n" \ |
4580 |
_ASM_EXTABLE(1b, 3b) \ |
4581 |
@@ -16598,7 +16639,7 @@ index 36361bf..9efdc12 100644 |
4582 |
: "m" (__m(addr)), "i" (errret), "0" (err)) |
4583 |
|
4584 |
#define __get_user_size_ex(x, ptr, size) \ |
4585 |
-@@ -406,7 +448,7 @@ do { \ |
4586 |
+@@ -406,7 +457,7 @@ do { \ |
4587 |
} while (0) |
4588 |
|
4589 |
#define __get_user_asm_ex(x, addr, itype, rtype, ltype) \ |
4590 |
@@ -16607,7 +16648,7 @@ index 36361bf..9efdc12 100644 |
4591 |
"2:\n" \ |
4592 |
_ASM_EXTABLE(1b, 2b - 1b) \ |
4593 |
: ltype(x) : "m" (__m(addr))) |
4594 |
-@@ -423,13 +465,24 @@ do { \ |
4595 |
+@@ -423,13 +474,24 @@ do { \ |
4596 |
int __gu_err; \ |
4597 |
unsigned long __gu_val; \ |
4598 |
__get_user_size(__gu_val, (ptr), (size), __gu_err, -EFAULT); \ |
4599 |
@@ -16634,7 +16675,7 @@ index 36361bf..9efdc12 100644 |
4600 |
|
4601 |
/* |
4602 |
* Tell gcc we read from memory instead of writing: this is because |
4603 |
-@@ -437,7 +490,7 @@ struct __large_struct { unsigned long buf[100]; }; |
4604 |
+@@ -437,7 +499,7 @@ struct __large_struct { unsigned long buf[100]; }; |
4605 |
* aliasing issues. |
4606 |
*/ |
4607 |
#define __put_user_asm(x, addr, err, itype, rtype, ltype, errret) \ |
4608 |
@@ -16643,7 +16684,7 @@ index 36361bf..9efdc12 100644 |
4609 |
"2:\n" \ |
4610 |
".section .fixup,\"ax\"\n" \ |
4611 |
"3: mov %3,%0\n" \ |
4612 |
-@@ -445,10 +498,10 @@ struct __large_struct { unsigned long buf[100]; }; |
4613 |
+@@ -445,10 +507,10 @@ struct __large_struct { unsigned long buf[100]; }; |
4614 |
".previous\n" \ |
4615 |
_ASM_EXTABLE(1b, 3b) \ |
4616 |
: "=r"(err) \ |
4617 |
@@ -16656,7 +16697,7 @@ index 36361bf..9efdc12 100644 |
4618 |
"2:\n" \ |
4619 |
_ASM_EXTABLE(1b, 2b - 1b) \ |
4620 |
: : ltype(x), "m" (__m(addr))) |
4621 |
-@@ -487,8 +540,12 @@ struct __large_struct { unsigned long buf[100]; }; |
4622 |
+@@ -487,8 +549,12 @@ struct __large_struct { unsigned long buf[100]; }; |
4623 |
* On error, the variable @x is set to zero. |
4624 |
*/ |
4625 |
|
4626 |
@@ -16669,7 +16710,7 @@ index 36361bf..9efdc12 100644 |
4627 |
|
4628 |
/** |
4629 |
* __put_user: - Write a simple value into user space, with less checking. |
4630 |
-@@ -510,8 +567,12 @@ struct __large_struct { unsigned long buf[100]; }; |
4631 |
+@@ -510,8 +576,12 @@ struct __large_struct { unsigned long buf[100]; }; |
4632 |
* Returns zero on success, or -EFAULT on error. |
4633 |
*/ |
4634 |
|
4635 |
@@ -16682,7 +16723,7 @@ index 36361bf..9efdc12 100644 |
4636 |
|
4637 |
#define __get_user_unaligned __get_user |
4638 |
#define __put_user_unaligned __put_user |
4639 |
-@@ -529,7 +590,7 @@ struct __large_struct { unsigned long buf[100]; }; |
4640 |
+@@ -529,7 +599,7 @@ struct __large_struct { unsigned long buf[100]; }; |
4641 |
#define get_user_ex(x, ptr) do { \ |
4642 |
unsigned long __gue_val; \ |
4643 |
__get_user_size_ex((__gue_val), (ptr), (sizeof(*(ptr)))); \ |
4644 |
@@ -17662,7 +17703,7 @@ index 5d513bc..6a51935 100644 |
4645 |
.name = "es7000", |
4646 |
.probe = probe_es7000, |
4647 |
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c |
4648 |
-index 6d939d7..75d1260 100644 |
4649 |
+index 6d939d7..a93a87e 100644 |
4650 |
--- a/arch/x86/kernel/apic/io_apic.c |
4651 |
+++ b/arch/x86/kernel/apic/io_apic.c |
4652 |
@@ -1096,7 +1096,7 @@ int IO_APIC_get_PCI_irq_vector(int bus, int slot, int pin, |
4653 |
@@ -17701,7 +17742,7 @@ index 6d939d7..75d1260 100644 |
4654 |
|
4655 |
eoi_ioapic_irq(irq, cfg); |
4656 |
} |
4657 |
-@@ -2634,13 +2634,16 @@ static void ir_print_prefix(struct irq_data *data, struct seq_file *p) |
4658 |
+@@ -2634,17 +2634,20 @@ static void ir_print_prefix(struct irq_data *data, struct seq_file *p) |
4659 |
|
4660 |
static void irq_remap_modify_chip_defaults(struct irq_chip *chip) |
4661 |
{ |
4662 |
@@ -17722,6 +17763,20 @@ index 6d939d7..75d1260 100644 |
4663 |
} |
4664 |
#endif /* CONFIG_IRQ_REMAP */ |
4665 |
|
4666 |
+-static struct irq_chip ioapic_chip __read_mostly = { |
4667 |
++static struct irq_chip ioapic_chip = { |
4668 |
+ .name = "IO-APIC", |
4669 |
+ .irq_startup = startup_ioapic_irq, |
4670 |
+ .irq_mask = mask_ioapic_irq, |
4671 |
+@@ -2715,7 +2718,7 @@ static void ack_lapic_irq(struct irq_data *data) |
4672 |
+ ack_APIC_irq(); |
4673 |
+ } |
4674 |
+ |
4675 |
+-static struct irq_chip lapic_chip __read_mostly = { |
4676 |
++static struct irq_chip lapic_chip = { |
4677 |
+ .name = "local-APIC", |
4678 |
+ .irq_mask = mask_lapic_irq, |
4679 |
+ .irq_unmask = unmask_lapic_irq, |
4680 |
diff --git a/arch/x86/kernel/apic/numaq_32.c b/arch/x86/kernel/apic/numaq_32.c |
4681 |
index c4a61ca..4c63d32 100644 |
4682 |
--- a/arch/x86/kernel/apic/numaq_32.c |
4683 |
@@ -17811,7 +17866,7 @@ index 79b05b8..bc1d972 100644 |
4684 |
.name = "UV large system", |
4685 |
.probe = uv_probe, |
4686 |
diff --git a/arch/x86/kernel/apm_32.c b/arch/x86/kernel/apm_32.c |
4687 |
-index a46bd38..6b906d7 100644 |
4688 |
+index a46bd38..92f6c9c 100644 |
4689 |
--- a/arch/x86/kernel/apm_32.c |
4690 |
+++ b/arch/x86/kernel/apm_32.c |
4691 |
@@ -411,7 +411,7 @@ static DEFINE_MUTEX(apm_mutex); |
4692 |
@@ -17869,6 +17924,15 @@ index a46bd38..6b906d7 100644 |
4693 |
put_cpu(); |
4694 |
return error; |
4695 |
} |
4696 |
+@@ -2037,7 +2051,7 @@ static int __init swab_apm_power_in_minutes(const struct dmi_system_id *d) |
4697 |
+ return 0; |
4698 |
+ } |
4699 |
+ |
4700 |
+-static struct dmi_system_id __initdata apm_dmi_table[] = { |
4701 |
++static const struct dmi_system_id __initconst apm_dmi_table[] = { |
4702 |
+ { |
4703 |
+ print_if_true, |
4704 |
+ KERN_WARNING "IBM T23 - BIOS 1.03b+ and controller firmware 1.02+ may be needed for Linux APM.", |
4705 |
@@ -2347,12 +2361,15 @@ static int __init apm_init(void) |
4706 |
* code to that CPU. |
4707 |
*/ |
4708 |
@@ -23450,7 +23514,7 @@ index 42eb330..139955c 100644 |
4709 |
|
4710 |
return ret; |
4711 |
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c |
4712 |
-index f411aca..bd2aa3b 100644 |
4713 |
+index f411aca..e436e0a 100644 |
4714 |
--- a/arch/x86/kernel/reboot.c |
4715 |
+++ b/arch/x86/kernel/reboot.c |
4716 |
@@ -35,7 +35,7 @@ void (*pm_power_off)(void); |
4717 |
@@ -23462,6 +23526,15 @@ index f411aca..bd2aa3b 100644 |
4718 |
enum reboot_type reboot_type = BOOT_ACPI; |
4719 |
int reboot_force; |
4720 |
|
4721 |
+@@ -145,7 +145,7 @@ static int __init set_kbd_reboot(const struct dmi_system_id *d) |
4722 |
+ return 0; |
4723 |
+ } |
4724 |
+ |
4725 |
+-static struct dmi_system_id __initdata reboot_dmi_table[] = { |
4726 |
++static const struct dmi_system_id __initconst reboot_dmi_table[] = { |
4727 |
+ { /* Handle problems with rebooting on Dell E520's */ |
4728 |
+ .callback = set_bios_reboot, |
4729 |
+ .ident = "Dell E520", |
4730 |
@@ -324,13 +324,17 @@ core_initcall(reboot_init); |
4731 |
extern const unsigned char machine_real_restart_asm[]; |
4732 |
extern const u64 machine_real_restart_gdt[3]; |
4733 |
@@ -33156,6 +33229,23 @@ index ba92046..2d5921a 100644 |
4734 |
if (!ret) |
4735 |
kobject_uevent(&pinst->kobj, KOBJ_ADD); |
4736 |
|
4737 |
+diff --git a/crypto/zlib.c b/crypto/zlib.c |
4738 |
+index d980788..2422b3d 100644 |
4739 |
+--- a/crypto/zlib.c |
4740 |
++++ b/crypto/zlib.c |
4741 |
+@@ -95,10 +95,10 @@ static int zlib_compress_setup(struct crypto_pcomp *tfm, void *params, |
4742 |
+ zlib_comp_exit(ctx); |
4743 |
+ |
4744 |
+ window_bits = tb[ZLIB_COMP_WINDOWBITS] |
4745 |
+- ? nla_get_u32(tb[ZLIB_COMP_WINDOWBITS]) |
4746 |
++ ? nla_get_s32(tb[ZLIB_COMP_WINDOWBITS]) |
4747 |
+ : MAX_WBITS; |
4748 |
+ mem_level = tb[ZLIB_COMP_MEMLEVEL] |
4749 |
+- ? nla_get_u32(tb[ZLIB_COMP_MEMLEVEL]) |
4750 |
++ ? nla_get_s32(tb[ZLIB_COMP_MEMLEVEL]) |
4751 |
+ : DEF_MEM_LEVEL; |
4752 |
+ |
4753 |
+ workspacesize = zlib_deflate_workspacesize(window_bits, mem_level); |
4754 |
diff --git a/drivers/acpi/apei/apei-internal.h b/drivers/acpi/apei/apei-internal.h |
4755 |
index f57050e..7ccfc74 100644 |
4756 |
--- a/drivers/acpi/apei/apei-internal.h |
4757 |
@@ -33232,6 +33322,28 @@ index cb96296..b81293b 100644 |
4758 |
{ |
4759 |
.callback = dmi_disable_osi_vista, |
4760 |
.ident = "Fujitsu Siemens", |
4761 |
+diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c |
4762 |
+index 3a0e92a..4348f2a 100644 |
4763 |
+--- a/drivers/acpi/bus.c |
4764 |
++++ b/drivers/acpi/bus.c |
4765 |
+@@ -72,7 +72,7 @@ static int set_copy_dsdt(const struct dmi_system_id *id) |
4766 |
+ } |
4767 |
+ #endif |
4768 |
+ |
4769 |
+-static struct dmi_system_id dsdt_dmi_table[] __initdata = { |
4770 |
++static const struct dmi_system_id dsdt_dmi_table[] __initconst = { |
4771 |
+ /* |
4772 |
+ * Invoke DSDT corruption work-around on all Toshiba Satellite. |
4773 |
+ * https://bugzilla.kernel.org/show_bug.cgi?id=14679 |
4774 |
+@@ -88,7 +88,7 @@ static struct dmi_system_id dsdt_dmi_table[] __initdata = { |
4775 |
+ {} |
4776 |
+ }; |
4777 |
+ #else |
4778 |
+-static struct dmi_system_id dsdt_dmi_table[] __initdata = { |
4779 |
++static const struct dmi_system_id dsdt_dmi_table[] __initconst = { |
4780 |
+ {} |
4781 |
+ }; |
4782 |
+ #endif |
4783 |
diff --git a/drivers/acpi/custom_method.c b/drivers/acpi/custom_method.c |
4784 |
index 5d42c24..4964b94 100644 |
4785 |
--- a/drivers/acpi/custom_method.c |
4786 |
@@ -33247,6 +33359,19 @@ index 5d42c24..4964b94 100644 |
4787 |
if (!(*ppos)) { |
4788 |
/* parse the table header to get the table length */ |
4789 |
if (count <= sizeof(struct acpi_table_header)) |
4790 |
+diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c |
4791 |
+index 30229af..eaddfaf 100644 |
4792 |
+--- a/drivers/acpi/ec.c |
4793 |
++++ b/drivers/acpi/ec.c |
4794 |
+@@ -1018,7 +1018,7 @@ static int ec_clear_on_resume(const struct dmi_system_id *id) |
4795 |
+ return 0; |
4796 |
+ } |
4797 |
+ |
4798 |
+-static struct dmi_system_id __initdata ec_dmi_table[] = { |
4799 |
++static const struct dmi_system_id __initconst ec_dmi_table[] = { |
4800 |
+ { |
4801 |
+ ec_skip_dsdt_scan, "Compal JFL92", { |
4802 |
+ DMI_MATCH(DMI_BIOS_VENDOR, "COMPAL"), |
4803 |
diff --git a/drivers/acpi/ec_sys.c b/drivers/acpi/ec_sys.c |
4804 |
index 6c47ae9..abfdd63 100644 |
4805 |
--- a/drivers/acpi/ec_sys.c |
4806 |
@@ -33300,6 +33425,19 @@ index 6c47ae9..abfdd63 100644 |
4807 |
err = ec_write(*off, byte_write); |
4808 |
if (err) |
4809 |
return err; |
4810 |
+diff --git a/drivers/acpi/pci_slot.c b/drivers/acpi/pci_slot.c |
4811 |
+index 07f7fea..118388f 100644 |
4812 |
+--- a/drivers/acpi/pci_slot.c |
4813 |
++++ b/drivers/acpi/pci_slot.c |
4814 |
+@@ -336,7 +336,7 @@ static int do_sta_before_sun(const struct dmi_system_id *d) |
4815 |
+ return 0; |
4816 |
+ } |
4817 |
+ |
4818 |
+-static struct dmi_system_id acpi_pci_slot_dmi_table[] __initdata = { |
4819 |
++static const struct dmi_system_id acpi_pci_slot_dmi_table[] __initconst = { |
4820 |
+ /* |
4821 |
+ * Fujitsu Primequest machines will return 1023 to indicate an |
4822 |
+ * error if the _SUN method is evaluated on SxFy objects that |
4823 |
diff --git a/drivers/acpi/proc.c b/drivers/acpi/proc.c |
4824 |
index 251c7b62..feab1d6 100644 |
4825 |
--- a/drivers/acpi/proc.c |
4826 |
@@ -33325,6 +33463,19 @@ index 251c7b62..feab1d6 100644 |
4827 |
sscanf(strbuf, "%s", str); |
4828 |
|
4829 |
mutex_lock(&acpi_device_lock); |
4830 |
+diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c |
4831 |
+index eff7222..fea8ae4 100644 |
4832 |
+--- a/drivers/acpi/processor_core.c |
4833 |
++++ b/drivers/acpi/processor_core.c |
4834 |
+@@ -28,7 +28,7 @@ static int __init set_no_mwait(const struct dmi_system_id *id) |
4835 |
+ return 0; |
4836 |
+ } |
4837 |
+ |
4838 |
+-static struct dmi_system_id __initdata processor_idle_dmi_table[] = { |
4839 |
++static const struct dmi_system_id __initconst processor_idle_dmi_table[] = { |
4840 |
+ { |
4841 |
+ set_no_mwait, "Extensa 5220", { |
4842 |
+ DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies LTD"), |
4843 |
diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c |
4844 |
index ac28db3..0848b37 100644 |
4845 |
--- a/drivers/acpi/processor_driver.c |
4846 |
@@ -33351,6 +33502,19 @@ index 388ba10..d509dbb 100644 |
4847 |
struct cpuidle_driver *drv = &acpi_idle_driver; |
4848 |
|
4849 |
if (!pr->flags.power_setup_done) |
4850 |
+diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c |
4851 |
+index cc9d020..b72fc03 100644 |
4852 |
+--- a/drivers/acpi/sleep.c |
4853 |
++++ b/drivers/acpi/sleep.c |
4854 |
+@@ -120,7 +120,7 @@ static int __init init_nvs_nosave(const struct dmi_system_id *d) |
4855 |
+ return 0; |
4856 |
+ } |
4857 |
+ |
4858 |
+-static struct dmi_system_id __initdata acpisleep_dmi_table[] = { |
4859 |
++static const struct dmi_system_id __initconst acpisleep_dmi_table[] = { |
4860 |
+ { |
4861 |
+ .callback = init_old_suspend_ordering, |
4862 |
+ .ident = "Abit KN9 (nForce4 variant)", |
4863 |
diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c |
4864 |
index 240a244..bc6239e 100644 |
4865 |
--- a/drivers/acpi/sysfs.c |
4866 |
@@ -33369,6 +33533,32 @@ index 240a244..bc6239e 100644 |
4867 |
|
4868 |
static void delete_gpe_attr_array(void) |
4869 |
{ |
4870 |
+diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c |
4871 |
+index 48fbc64..d0a31d4 100644 |
4872 |
+--- a/drivers/acpi/thermal.c |
4873 |
++++ b/drivers/acpi/thermal.c |
4874 |
+@@ -1110,7 +1110,7 @@ static int thermal_psv(const struct dmi_system_id *d) { |
4875 |
+ return 0; |
4876 |
+ } |
4877 |
+ |
4878 |
+-static struct dmi_system_id thermal_dmi_table[] __initdata = { |
4879 |
++static const struct dmi_system_id thermal_dmi_table[] __initconst = { |
4880 |
+ /* |
4881 |
+ * Award BIOS on this AOpen makes thermal control almost worthless. |
4882 |
+ * http://bugzilla.kernel.org/show_bug.cgi?id=8842 |
4883 |
+diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c |
4884 |
+index 2ebfdd2..fa1ce82 100644 |
4885 |
+--- a/drivers/acpi/video.c |
4886 |
++++ b/drivers/acpi/video.c |
4887 |
+@@ -395,7 +395,7 @@ static int video_ignore_initial_backlight(const struct dmi_system_id *d) |
4888 |
+ return 0; |
4889 |
+ } |
4890 |
+ |
4891 |
+-static struct dmi_system_id video_dmi_table[] __initdata = { |
4892 |
++static const struct dmi_system_id video_dmi_table[] __initconst = { |
4893 |
+ /* |
4894 |
+ * Broken _BQC workaround http://bugzilla.kernel.org/show_bug.cgi?id=13121 |
4895 |
+ */ |
4896 |
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c |
4897 |
index de2802c..2260da9 100644 |
4898 |
--- a/drivers/ata/libahci.c |
4899 |
@@ -35598,6 +35788,19 @@ index 86fe45c..c0ea948 100644 |
4900 |
return -EBUSY; |
4901 |
} |
4902 |
|
4903 |
+diff --git a/drivers/char/i8k.c b/drivers/char/i8k.c |
4904 |
+index 51efcbc..980f934 100644 |
4905 |
+--- a/drivers/char/i8k.c |
4906 |
++++ b/drivers/char/i8k.c |
4907 |
+@@ -607,7 +607,7 @@ static void __exit i8k_exit_hwmon(void) |
4908 |
+ hwmon_device_unregister(i8k_hwmon_dev); |
4909 |
+ } |
4910 |
+ |
4911 |
+-static struct dmi_system_id __initdata i8k_dmi_table[] = { |
4912 |
++static const struct dmi_system_id __initconst i8k_dmi_table[] = { |
4913 |
+ { |
4914 |
+ .ident = "Dell Inspiron", |
4915 |
+ .matches = { |
4916 |
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c |
4917 |
index 58c0e63..46c16bf 100644 |
4918 |
--- a/drivers/char/ipmi/ipmi_msghandler.c |
4919 |
@@ -37247,7 +37450,7 @@ index edf45ae..2b94e16 100644 |
4920 |
/* |
4921 |
* randomize_range() returns a start address such that |
4922 |
diff --git a/drivers/char/sonypi.c b/drivers/char/sonypi.c |
4923 |
-index 1ee8ce7..b778bef 100644 |
4924 |
+index 1ee8ce7..586718d 100644 |
4925 |
--- a/drivers/char/sonypi.c |
4926 |
+++ b/drivers/char/sonypi.c |
4927 |
@@ -55,6 +55,7 @@ |
4928 |
@@ -37288,6 +37491,15 @@ index 1ee8ce7..b778bef 100644 |
4929 |
mutex_unlock(&sonypi_device.lock); |
4930 |
|
4931 |
return 0; |
4932 |
+@@ -1497,7 +1498,7 @@ static struct platform_driver sonypi_driver = { |
4933 |
+ |
4934 |
+ static struct platform_device *sonypi_platform_device; |
4935 |
+ |
4936 |
+-static struct dmi_system_id __initdata sonypi_dmi_table[] = { |
4937 |
++static const struct dmi_system_id __initconst sonypi_dmi_table[] = { |
4938 |
+ { |
4939 |
+ .ident = "Sony Vaio", |
4940 |
+ .matches = { |
4941 |
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c |
4942 |
index c234b9e..34c325d 100644 |
4943 |
--- a/drivers/char/tpm/tpm.c |
4944 |
@@ -38147,10 +38359,32 @@ index 2a64e69..ac8fe51 100644 |
4945 |
|
4946 |
/* |
4947 |
* For now we register the efi subsystem with the firmware subsystem |
4948 |
+diff --git a/drivers/firmware/google/gsmi.c b/drivers/firmware/google/gsmi.c |
4949 |
+index c4e7c59..c85004e 100644 |
4950 |
+--- a/drivers/firmware/google/gsmi.c |
4951 |
++++ b/drivers/firmware/google/gsmi.c |
4952 |
+@@ -718,7 +718,7 @@ static u32 __init hash_oem_table_id(char s[8]) |
4953 |
+ return local_hash_64(input, 32); |
4954 |
+ } |
4955 |
+ |
4956 |
+-static struct dmi_system_id gsmi_dmi_table[] __initdata = { |
4957 |
++static const struct dmi_system_id gsmi_dmi_table[] __initconst = { |
4958 |
+ { |
4959 |
+ .ident = "Google Board", |
4960 |
+ .matches = { |
4961 |
diff --git a/drivers/firmware/google/memconsole.c b/drivers/firmware/google/memconsole.c |
4962 |
-index 2a90ba6..07f3733 100644 |
4963 |
+index 2a90ba6..72379aa 100644 |
4964 |
--- a/drivers/firmware/google/memconsole.c |
4965 |
+++ b/drivers/firmware/google/memconsole.c |
4966 |
+@@ -126,7 +126,7 @@ static bool found_memconsole(void) |
4967 |
+ return false; |
4968 |
+ } |
4969 |
+ |
4970 |
+-static struct dmi_system_id memconsole_dmi_table[] __initdata = { |
4971 |
++static const struct dmi_system_id memconsole_dmi_table[] __initconst = { |
4972 |
+ { |
4973 |
+ .ident = "Google Board", |
4974 |
+ .matches = { |
4975 |
@@ -147,7 +147,9 @@ static int __init memconsole_init(void) |
4976 |
if (!found_memconsole()) |
4977 |
return -ENODEV; |
4978 |
@@ -40231,7 +40465,7 @@ index f58067f..ed59814 100644 |
4979 |
child_device_obj->device.bus = &hv_bus; |
4980 |
child_device_obj->device.parent = &hv_acpi_dev->dev; |
4981 |
diff --git a/drivers/hwmon/acpi_power_meter.c b/drivers/hwmon/acpi_power_meter.c |
4982 |
-index 66f6729..4de8c4a 100644 |
4983 |
+index 66f6729..7b6cb19 100644 |
4984 |
--- a/drivers/hwmon/acpi_power_meter.c |
4985 |
+++ b/drivers/hwmon/acpi_power_meter.c |
4986 |
@@ -124,7 +124,7 @@ struct rw_sensor_template { |
4987 |
@@ -40270,6 +40504,15 @@ index 66f6729..4de8c4a 100644 |
4988 |
&resource->sensors[resource->num_sensors]; |
4989 |
int res = 0; |
4990 |
|
4991 |
+@@ -981,7 +979,7 @@ static int __init enable_cap_knobs(const struct dmi_system_id *d) |
4992 |
+ return 0; |
4993 |
+ } |
4994 |
+ |
4995 |
+-static struct dmi_system_id __initdata pm_dmi_table[] = { |
4996 |
++static const struct dmi_system_id __initconst pm_dmi_table[] = { |
4997 |
+ { |
4998 |
+ enable_cap_knobs, "IBM Active Energy Manager", |
4999 |
+ { |
5000 |
diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c |
5001 |
index 0b86d47..8066c3f 100644 |
5002 |
--- a/drivers/hwmon/applesmc.c |
5003 |
@@ -42098,6 +42341,19 @@ index 4d4cd14..d6fdd87 100644 |
5004 |
kref_init(&serio_raw->kref); |
5005 |
INIT_LIST_HEAD(&serio_raw->client_list); |
5006 |
init_waitqueue_head(&serio_raw->wait); |
5007 |
+diff --git a/drivers/input/touchscreen/htcpen.c b/drivers/input/touchscreen/htcpen.c |
5008 |
+index 62811de..2e1bd7f 100644 |
5009 |
+--- a/drivers/input/touchscreen/htcpen.c |
5010 |
++++ b/drivers/input/touchscreen/htcpen.c |
5011 |
+@@ -227,7 +227,7 @@ static struct isa_driver htcpen_isa_driver = { |
5012 |
+ } |
5013 |
+ }; |
5014 |
+ |
5015 |
+-static struct dmi_system_id __initdata htcshift_dmi_table[] = { |
5016 |
++static const struct dmi_system_id __initconst htcshift_dmi_table[] = { |
5017 |
+ { |
5018 |
+ .ident = "Shift", |
5019 |
+ .matches = { |
5020 |
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c |
5021 |
index 486982f..1e8058b 100644 |
5022 |
--- a/drivers/iommu/amd_iommu.c |
5023 |
@@ -43295,9 +43551,39 @@ index abac83a..3652f35 100644 |
5024 |
|
5025 |
rdev_dec_pending(rdev, mddev); |
5026 |
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c |
5027 |
-index c293d9c..73e0cd7 100644 |
5028 |
+index c293d9c..808ae97 100644 |
5029 |
--- a/drivers/md/raid5.c |
5030 |
+++ b/drivers/md/raid5.c |
5031 |
+@@ -598,23 +598,23 @@ async_copy_data(int frombio, struct bio *bio, struct page *page, |
5032 |
+ struct bio_vec *bvl; |
5033 |
+ struct page *bio_page; |
5034 |
+ int i; |
5035 |
+- int page_offset; |
5036 |
++ s64 page_offset; |
5037 |
+ struct async_submit_ctl submit; |
5038 |
+ enum async_tx_flags flags = 0; |
5039 |
+ |
5040 |
+ if (bio->bi_sector >= sector) |
5041 |
+- page_offset = (signed)(bio->bi_sector - sector) * 512; |
5042 |
++ page_offset = (s64)(bio->bi_sector - sector) * 512; |
5043 |
+ else |
5044 |
+- page_offset = (signed)(sector - bio->bi_sector) * -512; |
5045 |
++ page_offset = (s64)(sector - bio->bi_sector) * -512; |
5046 |
+ |
5047 |
+ if (frombio) |
5048 |
+ flags |= ASYNC_TX_FENCE; |
5049 |
+ init_async_submit(&submit, flags, tx, NULL, NULL, NULL); |
5050 |
+ |
5051 |
+ bio_for_each_segment(bvl, bio, i) { |
5052 |
+- int len = bvl->bv_len; |
5053 |
+- int clen; |
5054 |
+- int b_offset = 0; |
5055 |
++ s64 len = bvl->bv_len; |
5056 |
++ s64 clen; |
5057 |
++ s64 b_offset = 0; |
5058 |
+ |
5059 |
+ if (page_offset < 0) { |
5060 |
+ b_offset = -page_offset; |
5061 |
@@ -1364,6 +1364,10 @@ static int grow_one_stripe(struct r5conf *conf) |
5062 |
return 1; |
5063 |
} |
5064 |
@@ -45937,6 +46223,19 @@ index d4d2bc1..14b8672 100644 |
5065 |
}; |
5066 |
|
5067 |
static int stmmac_init_fs(struct net_device *dev) |
5068 |
+diff --git a/drivers/net/ethernet/via/via-rhine.c b/drivers/net/ethernet/via/via-rhine.c |
5069 |
+index f37e0ae..a273c4a 100644 |
5070 |
+--- a/drivers/net/ethernet/via/via-rhine.c |
5071 |
++++ b/drivers/net/ethernet/via/via-rhine.c |
5072 |
+@@ -2299,7 +2299,7 @@ static struct pci_driver rhine_driver = { |
5073 |
+ .shutdown = rhine_shutdown, |
5074 |
+ }; |
5075 |
+ |
5076 |
+-static struct dmi_system_id __initdata rhine_dmi_table[] = { |
5077 |
++static const struct dmi_system_id __initconst rhine_dmi_table[] = { |
5078 |
+ { |
5079 |
+ .ident = "EPIA-M", |
5080 |
+ .matches = { |
5081 |
diff --git a/drivers/net/ifb.c b/drivers/net/ifb.c |
5082 |
index 00f1367..bfcb2f6 100644 |
5083 |
--- a/drivers/net/ifb.c |
5084 |
@@ -47716,6 +48015,19 @@ index c73ed00..cc3edec 100644 |
5085 |
#define ASPM_STATE_L0S (ASPM_STATE_L0S_UP | ASPM_STATE_L0S_DW) |
5086 |
#define ASPM_STATE_ALL (ASPM_STATE_L0S | ASPM_STATE_L1) |
5087 |
|
5088 |
+diff --git a/drivers/pci/pcie/portdrv_pci.c b/drivers/pci/pcie/portdrv_pci.c |
5089 |
+index 7e41b70..6e34f30 100644 |
5090 |
+--- a/drivers/pci/pcie/portdrv_pci.c |
5091 |
++++ b/drivers/pci/pcie/portdrv_pci.c |
5092 |
+@@ -337,7 +337,7 @@ static int __init dmi_pcie_pme_disable_msi(const struct dmi_system_id *d) |
5093 |
+ return 0; |
5094 |
+ } |
5095 |
+ |
5096 |
+-static struct dmi_system_id __initdata pcie_portdrv_dmi_table[] = { |
5097 |
++static const struct dmi_system_id __initconst pcie_portdrv_dmi_table[] = { |
5098 |
+ /* |
5099 |
+ * Boxes that should not use MSI for PCIe PME signaling. |
5100 |
+ */ |
5101 |
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c |
5102 |
index bc92c47..47e01d7 100644 |
5103 |
--- a/drivers/pci/probe.c |
5104 |
@@ -47787,10 +48099,71 @@ index 26fba2d..693b4d3 100644 |
5105 |
status = wmi_evaluate_method(ASUS_WMI_MGMT_GUID, |
5106 |
1, asus->debug.method_id, |
5107 |
&input, &output); |
5108 |
+diff --git a/drivers/platform/x86/compal-laptop.c b/drivers/platform/x86/compal-laptop.c |
5109 |
+index 8877b83..024cf2c 100644 |
5110 |
+--- a/drivers/platform/x86/compal-laptop.c |
5111 |
++++ b/drivers/platform/x86/compal-laptop.c |
5112 |
+@@ -775,7 +775,7 @@ static int dmi_check_cb_extra(const struct dmi_system_id *id) |
5113 |
+ return 1; |
5114 |
+ } |
5115 |
+ |
5116 |
+-static struct dmi_system_id __initdata compal_dmi_table[] = { |
5117 |
++static const struct dmi_system_id __initconst compal_dmi_table[] = { |
5118 |
+ { |
5119 |
+ .ident = "FL90/IFL90", |
5120 |
+ .matches = { |
5121 |
+diff --git a/drivers/platform/x86/hdaps.c b/drivers/platform/x86/hdaps.c |
5122 |
+index 5a34973..bb006d3 100644 |
5123 |
+--- a/drivers/platform/x86/hdaps.c |
5124 |
++++ b/drivers/platform/x86/hdaps.c |
5125 |
+@@ -511,7 +511,7 @@ static int __init hdaps_dmi_match_invert(const struct dmi_system_id *id) |
5126 |
+ "ThinkPad T42p", so the order of the entries matters. |
5127 |
+ If your ThinkPad is not recognized, please update to latest |
5128 |
+ BIOS. This is especially the case for some R52 ThinkPads. */ |
5129 |
+-static struct dmi_system_id __initdata hdaps_whitelist[] = { |
5130 |
++static const struct dmi_system_id __initconst hdaps_whitelist[] = { |
5131 |
+ HDAPS_DMI_MATCH_INVERT("IBM", "ThinkPad R50p", HDAPS_BOTH_AXES), |
5132 |
+ HDAPS_DMI_MATCH_NORMAL("IBM", "ThinkPad R50"), |
5133 |
+ HDAPS_DMI_MATCH_NORMAL("IBM", "ThinkPad R51"), |
5134 |
+diff --git a/drivers/platform/x86/ibm_rtl.c b/drivers/platform/x86/ibm_rtl.c |
5135 |
+index 2704386..2229492 100644 |
5136 |
+--- a/drivers/platform/x86/ibm_rtl.c |
5137 |
++++ b/drivers/platform/x86/ibm_rtl.c |
5138 |
+@@ -238,7 +238,7 @@ static void rtl_teardown_sysfs(void) { |
5139 |
+ } |
5140 |
+ |
5141 |
+ |
5142 |
+-static struct dmi_system_id __initdata ibm_rtl_dmi_table[] = { |
5143 |
++static const struct dmi_system_id __initconst ibm_rtl_dmi_table[] = { |
5144 |
+ { \ |
5145 |
+ .matches = { \ |
5146 |
+ DMI_MATCH(DMI_SYS_VENDOR, "IBM"), \ |
5147 |
+diff --git a/drivers/platform/x86/intel_oaktrail.c b/drivers/platform/x86/intel_oaktrail.c |
5148 |
+index 7f88c79..3b5a7a2 100644 |
5149 |
+--- a/drivers/platform/x86/intel_oaktrail.c |
5150 |
++++ b/drivers/platform/x86/intel_oaktrail.c |
5151 |
+@@ -303,7 +303,7 @@ static int dmi_check_cb(const struct dmi_system_id *id) |
5152 |
+ return 0; |
5153 |
+ } |
5154 |
+ |
5155 |
+-static struct dmi_system_id __initdata oaktrail_dmi_table[] = { |
5156 |
++static const struct dmi_system_id __initconst oaktrail_dmi_table[] = { |
5157 |
+ { |
5158 |
+ .ident = "OakTrail platform", |
5159 |
+ .matches = { |
5160 |
diff --git a/drivers/platform/x86/msi-laptop.c b/drivers/platform/x86/msi-laptop.c |
5161 |
-index f204643..9ccea74 100644 |
5162 |
+index f204643..df8cb2e 100644 |
5163 |
--- a/drivers/platform/x86/msi-laptop.c |
5164 |
+++ b/drivers/platform/x86/msi-laptop.c |
5165 |
+@@ -451,7 +451,7 @@ static int dmi_check_cb(const struct dmi_system_id *id) |
5166 |
+ return 1; |
5167 |
+ } |
5168 |
+ |
5169 |
+-static struct dmi_system_id __initdata msi_dmi_table[] = { |
5170 |
++static const struct dmi_system_id __initconst msi_dmi_table[] = { |
5171 |
+ { |
5172 |
+ .ident = "MSI S270", |
5173 |
+ .matches = { |
5174 |
@@ -815,12 +815,14 @@ static int __init load_scm_model_init(struct platform_device *sdev) |
5175 |
int result; |
5176 |
|
5177 |
@@ -47825,6 +48198,45 @@ index b96766b..909c5a0 100644 |
5178 |
union acpi_object *obj; |
5179 |
ktime_t cur; |
5180 |
acpi_status status; |
5181 |
+diff --git a/drivers/platform/x86/samsung-laptop.c b/drivers/platform/x86/samsung-laptop.c |
5182 |
+index 64e1f2d..fbd2115 100644 |
5183 |
+--- a/drivers/platform/x86/samsung-laptop.c |
5184 |
++++ b/drivers/platform/x86/samsung-laptop.c |
5185 |
+@@ -543,7 +543,7 @@ static DEVICE_ATTR(performance_level, S_IWUSR | S_IRUGO, |
5186 |
+ get_performance_level, set_performance_level); |
5187 |
+ |
5188 |
+ |
5189 |
+-static struct dmi_system_id __initdata samsung_dmi_table[] = { |
5190 |
++static const struct dmi_system_id __initconst samsung_dmi_table[] = { |
5191 |
+ { |
5192 |
+ .matches = { |
5193 |
+ DMI_MATCH(DMI_SYS_VENDOR, |
5194 |
+diff --git a/drivers/platform/x86/samsung-q10.c b/drivers/platform/x86/samsung-q10.c |
5195 |
+index 1e54ae7..bb6f7b2 100644 |
5196 |
+--- a/drivers/platform/x86/samsung-q10.c |
5197 |
++++ b/drivers/platform/x86/samsung-q10.c |
5198 |
+@@ -130,7 +130,7 @@ static int __init dmi_check_callback(const struct dmi_system_id *id) |
5199 |
+ return 1; |
5200 |
+ } |
5201 |
+ |
5202 |
+-static struct dmi_system_id __initdata samsungq10_dmi_table[] = { |
5203 |
++static const struct dmi_system_id __initconst samsungq10_dmi_table[] = { |
5204 |
+ { |
5205 |
+ .ident = "Samsung Q10", |
5206 |
+ .matches = { |
5207 |
+diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c |
5208 |
+index 40c4705..d4d41b70 100644 |
5209 |
+--- a/drivers/platform/x86/sony-laptop.c |
5210 |
++++ b/drivers/platform/x86/sony-laptop.c |
5211 |
+@@ -3385,7 +3385,7 @@ static struct acpi_driver sony_pic_driver = { |
5212 |
+ }, |
5213 |
+ }; |
5214 |
+ |
5215 |
+-static struct dmi_system_id __initdata sonypi_dmi_table[] = { |
5216 |
++static const struct dmi_system_id __initconst sonypi_dmi_table[] = { |
5217 |
+ { |
5218 |
+ .ident = "Sony Vaio", |
5219 |
+ .matches = { |
5220 |
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c |
5221 |
index 2a8d6aa..29b1bcb 100644 |
5222 |
--- a/drivers/platform/x86/thinkpad_acpi.c |
5223 |
@@ -48030,6 +48442,19 @@ index b859d16..5cc6b1a 100644 |
5224 |
+ |
5225 |
+ pax_close_kernel(); |
5226 |
} |
5227 |
+diff --git a/drivers/pnp/pnpbios/core.c b/drivers/pnp/pnpbios/core.c |
5228 |
+index cfe8685..524a913 100644 |
5229 |
+--- a/drivers/pnp/pnpbios/core.c |
5230 |
++++ b/drivers/pnp/pnpbios/core.c |
5231 |
+@@ -492,7 +492,7 @@ static int __init exploding_pnp_bios(const struct dmi_system_id *d) |
5232 |
+ return 0; |
5233 |
+ } |
5234 |
+ |
5235 |
+-static struct dmi_system_id pnpbios_dmi_table[] __initdata = { |
5236 |
++static const struct dmi_system_id pnpbios_dmi_table[] __initconst = { |
5237 |
+ { /* PnPBIOS GPF on boot */ |
5238 |
+ .callback = exploding_pnp_bios, |
5239 |
+ .ident = "Higraded P14H", |
5240 |
diff --git a/drivers/pnp/resource.c b/drivers/pnp/resource.c |
5241 |
index b0ecacb..7c9da2e 100644 |
5242 |
--- a/drivers/pnp/resource.c |
5243 |
@@ -56200,6 +56625,37 @@ index 4a88ac3..d2e1657 100644 |
5244 |
} |
5245 |
EXPORT_SYMBOL_GPL(virtqueue_kick); |
5246 |
|
5247 |
+diff --git a/drivers/xen/events.c b/drivers/xen/events.c |
5248 |
+index f6227cc..3e22fab 100644 |
5249 |
+--- a/drivers/xen/events.c |
5250 |
++++ b/drivers/xen/events.c |
5251 |
+@@ -1632,7 +1632,7 @@ void xen_irq_resume(void) |
5252 |
+ restore_pirqs(); |
5253 |
+ } |
5254 |
+ |
5255 |
+-static struct irq_chip xen_dynamic_chip __read_mostly = { |
5256 |
++static struct irq_chip xen_dynamic_chip = { |
5257 |
+ .name = "xen-dyn", |
5258 |
+ |
5259 |
+ .irq_disable = disable_dynirq, |
5260 |
+@@ -1646,7 +1646,7 @@ static struct irq_chip xen_dynamic_chip __read_mostly = { |
5261 |
+ .irq_retrigger = retrigger_dynirq, |
5262 |
+ }; |
5263 |
+ |
5264 |
+-static struct irq_chip xen_pirq_chip __read_mostly = { |
5265 |
++static struct irq_chip xen_pirq_chip = { |
5266 |
+ .name = "xen-pirq", |
5267 |
+ |
5268 |
+ .irq_startup = startup_pirq, |
5269 |
+@@ -1666,7 +1666,7 @@ static struct irq_chip xen_pirq_chip __read_mostly = { |
5270 |
+ .irq_retrigger = retrigger_dynirq, |
5271 |
+ }; |
5272 |
+ |
5273 |
+-static struct irq_chip xen_percpu_chip __read_mostly = { |
5274 |
++static struct irq_chip xen_percpu_chip = { |
5275 |
+ .name = "xen-percpu", |
5276 |
+ |
5277 |
+ .irq_disable = disable_dynirq, |
5278 |
diff --git a/drivers/xen/xenfs/super.c b/drivers/xen/xenfs/super.c |
5279 |
index 1aa3897..3a6b3f1 100644 |
5280 |
--- a/drivers/xen/xenfs/super.c |
5281 |
@@ -60740,7 +61196,7 @@ index 9d1c995..7685971 100644 |
5282 |
static int __init |
5283 |
vxfs_init(void) |
5284 |
diff --git a/fs/fs_struct.c b/fs/fs_struct.c |
5285 |
-index 78b519c..b6e3076 100644 |
5286 |
+index 78b519c..8445fa6 100644 |
5287 |
--- a/fs/fs_struct.c |
5288 |
+++ b/fs/fs_struct.c |
5289 |
@@ -4,6 +4,7 @@ |
5290 |
@@ -60813,7 +61269,7 @@ index 78b519c..b6e3076 100644 |
5291 |
fs->in_exec = 0; |
5292 |
spin_lock_init(&fs->lock); |
5293 |
seqcount_init(&fs->seq); |
5294 |
-@@ -132,6 +146,9 @@ struct fs_struct *copy_fs_struct(struct fs_struct *old) |
5295 |
+@@ -132,9 +146,13 @@ struct fs_struct *copy_fs_struct(struct fs_struct *old) |
5296 |
spin_lock(&old->lock); |
5297 |
fs->root = old->root; |
5298 |
path_get_longterm(&fs->root); |
5299 |
@@ -60823,7 +61279,11 @@ index 78b519c..b6e3076 100644 |
5300 |
fs->pwd = old->pwd; |
5301 |
path_get_longterm(&fs->pwd); |
5302 |
spin_unlock(&old->lock); |
5303 |
-@@ -150,8 +167,9 @@ int unshare_fs_struct(void) |
5304 |
++ gr_inc_chroot_refcnts(fs->root.dentry, fs->root.mnt); |
5305 |
+ } |
5306 |
+ return fs; |
5307 |
+ } |
5308 |
+@@ -150,8 +168,9 @@ int unshare_fs_struct(void) |
5309 |
|
5310 |
task_lock(current); |
5311 |
spin_lock(&fs->lock); |
5312 |
@@ -60834,7 +61294,7 @@ index 78b519c..b6e3076 100644 |
5313 |
spin_unlock(&fs->lock); |
5314 |
task_unlock(current); |
5315 |
|
5316 |
-@@ -164,13 +182,13 @@ EXPORT_SYMBOL_GPL(unshare_fs_struct); |
5317 |
+@@ -164,13 +183,13 @@ EXPORT_SYMBOL_GPL(unshare_fs_struct); |
5318 |
|
5319 |
int current_umask(void) |
5320 |
{ |
5321 |
@@ -60850,7 +61310,7 @@ index 78b519c..b6e3076 100644 |
5322 |
.lock = __SPIN_LOCK_UNLOCKED(init_fs.lock), |
5323 |
.seq = SEQCNT_ZERO, |
5324 |
.umask = 0022, |
5325 |
-@@ -186,12 +204,13 @@ void daemonize_fs_struct(void) |
5326 |
+@@ -186,12 +205,13 @@ void daemonize_fs_struct(void) |
5327 |
task_lock(current); |
5328 |
|
5329 |
spin_lock(&init_fs.lock); |
5330 |
@@ -80456,7 +80916,7 @@ index cdd1cc2..2401b2e 100644 |
5331 |
* (asm goto is automatically volatile - the naming reflects this.) |
5332 |
*/ |
5333 |
diff --git a/include/linux/compiler.h b/include/linux/compiler.h |
5334 |
-index 7c7546b..92ea3ae 100644 |
5335 |
+index 7c7546b..588d7d2 100644 |
5336 |
--- a/include/linux/compiler.h |
5337 |
+++ b/include/linux/compiler.h |
5338 |
@@ -5,31 +5,51 @@ |
5339 |
@@ -80577,7 +81037,16 @@ index 7c7546b..92ea3ae 100644 |
5340 |
/* Simple shorthand for a section definition */ |
5341 |
#ifndef __section |
5342 |
# define __section(S) __attribute__ ((__section__(#S))) |
5343 |
-@@ -296,6 +358,18 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect); |
5344 |
+@@ -287,6 +349,8 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect); |
5345 |
+ # define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) |
5346 |
+ #endif |
5347 |
+ |
5348 |
++#define __type_is_unsigned(t) (__same_type((t)0, 0UL) || __same_type((t)0, 0U) || __same_type((t)0, (unsigned short)0) || __same_type((t)0, (unsigned char)0)) |
5349 |
++ |
5350 |
+ /* Compile time object size, -1 for unknown */ |
5351 |
+ #ifndef __compiletime_object_size |
5352 |
+ # define __compiletime_object_size(obj) -1 |
5353 |
+@@ -296,6 +360,18 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect); |
5354 |
#endif |
5355 |
#ifndef __compiletime_error |
5356 |
# define __compiletime_error(message) |
5357 |
@@ -80596,7 +81065,7 @@ index 7c7546b..92ea3ae 100644 |
5358 |
#endif |
5359 |
|
5360 |
/* |
5361 |
-@@ -310,6 +384,7 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect); |
5362 |
+@@ -310,6 +386,7 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect); |
5363 |
* use is to mediate communication between process-level code and irq/NMI |
5364 |
* handlers, all running on the same CPU. |
5365 |
*/ |
5366 |
@@ -83605,6 +84074,19 @@ index de3a321..8fb84fc 100644 |
5367 |
|
5368 |
static inline void mm_init_cpumask(struct mm_struct *mm) |
5369 |
{ |
5370 |
+diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h |
5371 |
+index 174a844..11483c2 100644 |
5372 |
+--- a/include/linux/mmc/core.h |
5373 |
++++ b/include/linux/mmc/core.h |
5374 |
+@@ -76,7 +76,7 @@ struct mmc_command { |
5375 |
+ #define mmc_cmd_type(cmd) ((cmd)->flags & MMC_CMD_MASK) |
5376 |
+ |
5377 |
+ unsigned int retries; /* max number of retries */ |
5378 |
+- unsigned int error; /* command error */ |
5379 |
++ int error; /* command error */ |
5380 |
+ |
5381 |
+ /* |
5382 |
+ * Standard errno values are used for errors, but some have specific |
5383 |
diff --git a/include/linux/mmiotrace.h b/include/linux/mmiotrace.h |
5384 |
index c5d5278..f0b68c8 100644 |
5385 |
--- a/include/linux/mmiotrace.h |
5386 |
@@ -85909,10 +86391,10 @@ index ea0c02f..0eed39d 100644 |
5387 |
#ifdef __arch_swab64 |
5388 |
return __arch_swab64(val); |
5389 |
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h |
5390 |
-index 86a24b11..e6974f1 100644 |
5391 |
+index 86a24b11..b6048c1 100644 |
5392 |
--- a/include/linux/syscalls.h |
5393 |
+++ b/include/linux/syscalls.h |
5394 |
-@@ -83,12 +83,20 @@ struct file_handle; |
5395 |
+@@ -83,12 +83,19 @@ struct file_handle; |
5396 |
#define __SC_DECL5(t5, a5, ...) t5 a5, __SC_DECL4(__VA_ARGS__) |
5397 |
#define __SC_DECL6(t6, a6, ...) t6 a6, __SC_DECL5(__VA_ARGS__) |
5398 |
|
5399 |
@@ -85922,12 +86404,11 @@ index 86a24b11..e6974f1 100644 |
5400 |
-#define __SC_LONG4(t4, a4, ...) long a4, __SC_LONG3(__VA_ARGS__) |
5401 |
-#define __SC_LONG5(t5, a5, ...) long a5, __SC_LONG4(__VA_ARGS__) |
5402 |
-#define __SC_LONG6(t6, a6, ...) long a6, __SC_LONG5(__VA_ARGS__) |
5403 |
-+#define __TYPE_IS_U(t) (__same_type((t)0, 0UL) || __same_type((t)0, 0U) || __same_type((t)0, (unsigned short)0) || __same_type((t)0, (unsigned char)0)) |
5404 |
+#define __SC_TYPE(t, a) __typeof( \ |
5405 |
+ __builtin_choose_expr( \ |
5406 |
+ sizeof(t) > sizeof(int), \ |
5407 |
+ (t) 0, \ |
5408 |
-+ __builtin_choose_expr(__TYPE_IS_U(t), 0UL, 0L) \ |
5409 |
++ __builtin_choose_expr(__type_is_unsigned(t), 0UL, 0L) \ |
5410 |
+ )) a |
5411 |
+ |
5412 |
+#define __SC_LONG1(t1, a1) __SC_TYPE(t1, a1) |
5413 |
@@ -85939,7 +86420,7 @@ index 86a24b11..e6974f1 100644 |
5414 |
|
5415 |
#define __SC_CAST1(t1, a1) (t1) a1 |
5416 |
#define __SC_CAST2(t2, a2, ...) (t2) a2, __SC_CAST1(__VA_ARGS__) |
5417 |
-@@ -392,11 +400,11 @@ asmlinkage long sys_sync(void); |
5418 |
+@@ -392,11 +399,11 @@ asmlinkage long sys_sync(void); |
5419 |
asmlinkage long sys_fsync(unsigned int fd); |
5420 |
asmlinkage long sys_fdatasync(unsigned int fd); |
5421 |
asmlinkage long sys_bdflush(int func, long data); |
5422 |
@@ -85955,7 +86436,7 @@ index 86a24b11..e6974f1 100644 |
5423 |
asmlinkage long sys_truncate(const char __user *path, long length); |
5424 |
asmlinkage long sys_ftruncate(unsigned int fd, unsigned long length); |
5425 |
asmlinkage long sys_stat(const char __user *filename, |
5426 |
-@@ -608,7 +616,7 @@ asmlinkage long sys_getsockname(int, struct sockaddr __user *, int __user *); |
5427 |
+@@ -608,7 +615,7 @@ asmlinkage long sys_getsockname(int, struct sockaddr __user *, int __user *); |
5428 |
asmlinkage long sys_getpeername(int, struct sockaddr __user *, int __user *); |
5429 |
asmlinkage long sys_send(int, void __user *, size_t, unsigned); |
5430 |
asmlinkage long sys_sendto(int, void __user *, size_t, unsigned, |
5431 |
@@ -87217,10 +87698,18 @@ index 252fd10..aa1421f 100644 |
5432 |
extern int nf_register_queue_handler(u_int8_t pf, |
5433 |
const struct nf_queue_handler *qh); |
5434 |
diff --git a/include/net/netlink.h b/include/net/netlink.h |
5435 |
-index cb1f350..3279d2c 100644 |
5436 |
+index cb1f350..55e1f96 100644 |
5437 |
--- a/include/net/netlink.h |
5438 |
+++ b/include/net/netlink.h |
5439 |
-@@ -569,7 +569,7 @@ static inline void *nlmsg_get_pos(struct sk_buff *skb) |
5440 |
+@@ -135,6 +135,7 @@ |
5441 |
+ * nla_get_u16(nla) get payload for a u16 attribute |
5442 |
+ * nla_get_u32(nla) get payload for a u32 attribute |
5443 |
+ * nla_get_u64(nla) get payload for a u64 attribute |
5444 |
++ * nla_get_s32(nla) get payload for a s32 attribute |
5445 |
+ * nla_get_flag(nla) return 1 if flag is true |
5446 |
+ * nla_get_msecs(nla) get payload for a msecs attribute |
5447 |
+ * |
5448 |
+@@ -569,7 +570,7 @@ static inline void *nlmsg_get_pos(struct sk_buff *skb) |
5449 |
static inline void nlmsg_trim(struct sk_buff *skb, const void *mark) |
5450 |
{ |
5451 |
if (mark) |
5452 |
@@ -87229,6 +87718,22 @@ index cb1f350..3279d2c 100644 |
5453 |
} |
5454 |
|
5455 |
/** |
5456 |
+@@ -998,6 +999,15 @@ static inline __be64 nla_get_be64(const struct nlattr *nla) |
5457 |
+ } |
5458 |
+ |
5459 |
+ /** |
5460 |
++ * nla_get_s32 - return payload of s32 attribute |
5461 |
++ * @nla: s32 netlink attribute |
5462 |
++ */ |
5463 |
++static inline s32 nla_get_s32(const struct nlattr *nla) |
5464 |
++{ |
5465 |
++ return *(s32 *) nla_data(nla); |
5466 |
++} |
5467 |
++ |
5468 |
++/** |
5469 |
+ * nla_get_flag - return payload of flag attribute |
5470 |
+ * @nla: flag netlink attribute |
5471 |
+ */ |
5472 |
diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h |
5473 |
index d786b4f..4c3dd41 100644 |
5474 |
--- a/include/net/netns/ipv4.h |
5475 |
@@ -97470,7 +97975,7 @@ index d53adf9..03a24bf 100644 |
5476 |
set_fs(old_fs); |
5477 |
|
5478 |
diff --git a/mm/madvise.c b/mm/madvise.c |
5479 |
-index 23d3a6b..e10d35a 100644 |
5480 |
+index 23d3a6b..76f0f839 100644 |
5481 |
--- a/mm/madvise.c |
5482 |
+++ b/mm/madvise.c |
5483 |
@@ -46,6 +46,10 @@ static long madvise_behavior(struct vm_area_struct * vma, |
5484 |
@@ -97523,9 +98028,9 @@ index 23d3a6b..e10d35a 100644 |
5485 |
+ .nonlinear_vma = vma_m, |
5486 |
+ .last_index = ULONG_MAX, |
5487 |
+ }; |
5488 |
-+ zap_page_range(vma, start + SEGMEXEC_TASK_SIZE, end - start, &details); |
5489 |
++ zap_page_range(vma_m, start + SEGMEXEC_TASK_SIZE, end - start, &details); |
5490 |
+ } else |
5491 |
-+ zap_page_range(vma, start + SEGMEXEC_TASK_SIZE, end - start, NULL); |
5492 |
++ zap_page_range(vma_m, start + SEGMEXEC_TASK_SIZE, end - start, NULL); |
5493 |
+ } |
5494 |
+#endif |
5495 |
+ |
5496 |
@@ -107278,6 +107783,19 @@ index dc8d7ef..9d37285 100644 |
5497 |
} while (!res); |
5498 |
return res; |
5499 |
} |
5500 |
+diff --git a/net/l2tp/l2tp_ip.c b/net/l2tp/l2tp_ip.c |
5501 |
+index 334a93d..ee97cfd 100644 |
5502 |
+--- a/net/l2tp/l2tp_ip.c |
5503 |
++++ b/net/l2tp/l2tp_ip.c |
5504 |
+@@ -667,7 +667,7 @@ static struct inet_protosw l2tp_ip_protosw = { |
5505 |
+ .no_check = 0, |
5506 |
+ }; |
5507 |
+ |
5508 |
+-static struct net_protocol l2tp_ip_protocol __read_mostly = { |
5509 |
++static const struct net_protocol l2tp_ip_protocol = { |
5510 |
+ .handler = l2tp_ip_recv, |
5511 |
+ }; |
5512 |
+ |
5513 |
diff --git a/net/l2tp/l2tp_netlink.c b/net/l2tp/l2tp_netlink.c |
5514 |
index 93a41a0..d4b4edb 100644 |
5515 |
--- a/net/l2tp/l2tp_netlink.c |
5516 |
@@ -115299,7 +115817,7 @@ index 0000000..60e7af2 |
5517 |
+randomize_layout_hash.h |
5518 |
diff --git a/tools/gcc/Makefile b/tools/gcc/Makefile |
5519 |
new file mode 100644 |
5520 |
-index 0000000..7b8921f |
5521 |
+index 0000000..a51677e |
5522 |
--- /dev/null |
5523 |
+++ b/tools/gcc/Makefile |
5524 |
@@ -0,0 +1,52 @@ |
5525 |
@@ -115315,7 +115833,7 @@ index 0000000..7b8921f |
5526 |
+export HOST_EXTRACFLAGS |
5527 |
+else |
5528 |
+HOSTLIBS := hostcxxlibs |
5529 |
-+HOST_EXTRACXXFLAGS += -I$(GCCPLUGINS_DIR)/include -I$(src) -std=gnu++98 -fno-rtti -ggdb -Wno-unused-parameter -Wno-narrowing -Wno-unused-variable |
5530 |
++HOST_EXTRACXXFLAGS += -I$(GCCPLUGINS_DIR)/include -I$(src) -std=gnu++98 -fno-rtti -fno-exceptions -fasynchronous-unwind-tables -ggdb -Wno-unused-parameter -Wno-narrowing -Wno-unused-variable |
5531 |
+export HOST_EXTRACXXFLAGS |
5532 |
+endif |
5533 |
+ |
5534 |
@@ -116303,10 +116821,10 @@ index 0000000..93b181d |
5535 |
+} |
5536 |
diff --git a/tools/gcc/gcc-common.h b/tools/gcc/gcc-common.h |
5537 |
new file mode 100644 |
5538 |
-index 0000000..19fedf2 |
5539 |
+index 0000000..d8ec362 |
5540 |
--- /dev/null |
5541 |
+++ b/tools/gcc/gcc-common.h |
5542 |
-@@ -0,0 +1,540 @@ |
5543 |
+@@ -0,0 +1,666 @@ |
5544 |
+#ifndef GCC_COMMON_H_INCLUDED |
5545 |
+#define GCC_COMMON_H_INCLUDED |
5546 |
+ |
5547 |
@@ -116629,13 +117147,6 @@ index 0000000..19fedf2 |
5548 |
+} |
5549 |
+#endif |
5550 |
+ |
5551 |
-+#if BUILDING_GCC_VERSION >= 4007 |
5552 |
-+#define cgraph_create_edge(caller, callee, call_stmt, count, freq, nest) \ |
5553 |
-+ cgraph_create_edge((caller), (callee), (call_stmt), (count), (freq)) |
5554 |
-+#define cgraph_create_edge_including_clones(caller, callee, old_call_stmt, call_stmt, count, freq, nest, reason) \ |
5555 |
-+ cgraph_create_edge_including_clones((caller), (callee), (old_call_stmt), (call_stmt), (count), (freq), (reason)) |
5556 |
-+#endif |
5557 |
-+ |
5558 |
+#if BUILDING_GCC_VERSION == 4007 || BUILDING_GCC_VERSION == 4008 |
5559 |
+static inline struct cgraph_node *cgraph_alias_target(struct cgraph_node *n) |
5560 |
+{ |
5561 |
@@ -116643,6 +117154,13 @@ index 0000000..19fedf2 |
5562 |
+} |
5563 |
+#endif |
5564 |
+ |
5565 |
++#if BUILDING_GCC_VERSION >= 4007 && BUILDING_GCC_VERSION <= 4009 |
5566 |
++#define cgraph_create_edge(caller, callee, call_stmt, count, freq, nest) \ |
5567 |
++ cgraph_create_edge((caller), (callee), (call_stmt), (count), (freq)) |
5568 |
++#define cgraph_create_edge_including_clones(caller, callee, old_call_stmt, call_stmt, count, freq, nest, reason) \ |
5569 |
++ cgraph_create_edge_including_clones((caller), (callee), (old_call_stmt), (call_stmt), (count), (freq), (reason)) |
5570 |
++#endif |
5571 |
++ |
5572 |
+#if BUILDING_GCC_VERSION <= 4008 |
5573 |
+#define ENTRY_BLOCK_PTR_FOR_FN(FN) ENTRY_BLOCK_PTR_FOR_FUNCTION(FN) |
5574 |
+#define EXIT_BLOCK_PTR_FOR_FN(FN) EXIT_BLOCK_PTR_FOR_FUNCTION(FN) |
5575 |
@@ -116655,6 +117173,40 @@ index 0000000..19fedf2 |
5576 |
+#define BASIC_BLOCK_FOR_FN(FN, N) BASIC_BLOCK_FOR_FUNCTION((FN), (N)) |
5577 |
+#define NODE_IMPLICIT_ALIAS(node) (node)->same_body_alias |
5578 |
+ |
5579 |
++static inline bool tree_fits_shwi_p(const_tree t) |
5580 |
++{ |
5581 |
++ if (t == NULL_TREE || TREE_CODE(t) != INTEGER_CST) |
5582 |
++ return false; |
5583 |
++ |
5584 |
++ if (TREE_INT_CST_HIGH(t) == 0 && (HOST_WIDE_INT)TREE_INT_CST_LOW(t) >= 0) |
5585 |
++ return true; |
5586 |
++ |
5587 |
++ if (TREE_INT_CST_HIGH(t) == -1 && (HOST_WIDE_INT)TREE_INT_CST_LOW(t) < 0 && !TYPE_UNSIGNED(TREE_TYPE(t))) |
5588 |
++ return true; |
5589 |
++ |
5590 |
++ return false; |
5591 |
++} |
5592 |
++ |
5593 |
++static inline bool tree_fits_uhwi_p(const_tree t) |
5594 |
++{ |
5595 |
++ if (t == NULL_TREE || TREE_CODE(t) != INTEGER_CST) |
5596 |
++ return false; |
5597 |
++ |
5598 |
++ return TREE_INT_CST_HIGH(t) == 0; |
5599 |
++} |
5600 |
++ |
5601 |
++static inline HOST_WIDE_INT tree_to_shwi(const_tree t) |
5602 |
++{ |
5603 |
++ gcc_assert(tree_fits_shwi_p(t)); |
5604 |
++ return TREE_INT_CST_LOW(t); |
5605 |
++} |
5606 |
++ |
5607 |
++static inline unsigned HOST_WIDE_INT tree_to_uhwi(const_tree t) |
5608 |
++{ |
5609 |
++ gcc_assert(tree_fits_uhwi_p(t)); |
5610 |
++ return TREE_INT_CST_LOW(t); |
5611 |
++} |
5612 |
++ |
5613 |
+static inline const char *get_tree_code_name(enum tree_code code) |
5614 |
+{ |
5615 |
+ gcc_assert(code < MAX_TREE_CODES); |
5616 |
@@ -116665,6 +117217,7 @@ index 0000000..19fedf2 |
5617 |
+typedef union gimple_statement_d gasm; |
5618 |
+typedef union gimple_statement_d gassign; |
5619 |
+typedef union gimple_statement_d gcall; |
5620 |
++typedef union gimple_statement_d gcond; |
5621 |
+typedef union gimple_statement_d gdebug; |
5622 |
+typedef union gimple_statement_d gphi; |
5623 |
+typedef union gimple_statement_d greturn; |
5624 |
@@ -116692,6 +117245,7 @@ index 0000000..19fedf2 |
5625 |
+typedef struct gimple_statement_base gasm; |
5626 |
+typedef struct gimple_statement_base gassign; |
5627 |
+typedef struct gimple_statement_base gcall; |
5628 |
++typedef struct gimple_statement_base gcond; |
5629 |
+typedef struct gimple_statement_base gdebug; |
5630 |
+typedef struct gimple_statement_base gphi; |
5631 |
+typedef struct gimple_statement_base greturn; |
5632 |
@@ -116705,15 +117259,50 @@ index 0000000..19fedf2 |
5633 |
+ return stmt; |
5634 |
+} |
5635 |
+ |
5636 |
++static inline const gasm *as_a_const_gasm(const_gimple stmt) |
5637 |
++{ |
5638 |
++ return stmt; |
5639 |
++} |
5640 |
++ |
5641 |
++static inline gassign *as_a_gassign(gimple stmt) |
5642 |
++{ |
5643 |
++ return stmt; |
5644 |
++} |
5645 |
++ |
5646 |
++static inline const gassign *as_a_const_gassign(const_gimple stmt) |
5647 |
++{ |
5648 |
++ return stmt; |
5649 |
++} |
5650 |
++ |
5651 |
+static inline gcall *as_a_gcall(gimple stmt) |
5652 |
+{ |
5653 |
+ return stmt; |
5654 |
+} |
5655 |
+ |
5656 |
++static inline const gcall *as_a_const_gcall(const_gimple stmt) |
5657 |
++{ |
5658 |
++ return stmt; |
5659 |
++} |
5660 |
++ |
5661 |
++static inline gphi *as_a_gphi(gimple stmt) |
5662 |
++{ |
5663 |
++ return stmt; |
5664 |
++} |
5665 |
++ |
5666 |
++static inline const gphi *as_a_const_gphi(const_gimple stmt) |
5667 |
++{ |
5668 |
++ return stmt; |
5669 |
++} |
5670 |
++ |
5671 |
+static inline greturn *as_a_greturn(gimple stmt) |
5672 |
+{ |
5673 |
+ return stmt; |
5674 |
+} |
5675 |
++ |
5676 |
++static inline const greturn *as_a_const_greturn(const_gimple stmt) |
5677 |
++{ |
5678 |
++ return stmt; |
5679 |
++} |
5680 |
+#endif |
5681 |
+ |
5682 |
+#if BUILDING_GCC_VERSION >= 4009 |
5683 |
@@ -116730,17 +117319,23 @@ index 0000000..19fedf2 |
5684 |
+#define TODO_verify_stmts TODO_verify_il |
5685 |
+#define TODO_verify_rtl_sharing TODO_verify_il |
5686 |
+ |
5687 |
-+#define TREE_INT_CST_HIGH(NODE) ({ TREE_INT_CST_EXT_NUNITS(NODE) > 1 ? (unsigned HOST_WIDE_INT)TREE_INT_CST_ELT(NODE, 1) : 0; }) |
5688 |
++//#define TREE_INT_CST_HIGH(NODE) ({ TREE_INT_CST_EXT_NUNITS(NODE) > 1 ? (unsigned HOST_WIDE_INT)TREE_INT_CST_ELT(NODE, 1) : 0; }) |
5689 |
+ |
5690 |
+#define INSN_DELETED_P(insn) (insn)->deleted() |
5691 |
+ |
5692 |
+// symtab/cgraph related |
5693 |
+#define debug_cgraph_node(node) (node)->debug() |
5694 |
+#define cgraph_get_node(decl) cgraph_node::get(decl) |
5695 |
++#define cgraph_get_create_node(decl) cgraph_node::get_create(decl) |
5696 |
+#define cgraph_n_nodes symtab->cgraph_count |
5697 |
+#define cgraph_max_uid symtab->cgraph_max_uid |
5698 |
+#define varpool_get_node(decl) varpool_node::get(decl) |
5699 |
+ |
5700 |
++#define cgraph_create_edge(caller, callee, call_stmt, count, freq, nest) \ |
5701 |
++ (caller)->create_edge((callee), (call_stmt), (count), (freq)) |
5702 |
++#define cgraph_create_edge_including_clones(caller, callee, old_call_stmt, call_stmt, count, freq, nest, reason) \ |
5703 |
++ (caller)->create_edge_including_clones((callee), (old_call_stmt), (call_stmt), (count), (freq), (reason)) |
5704 |
++ |
5705 |
+typedef struct cgraph_node *cgraph_node_ptr; |
5706 |
+typedef struct cgraph_edge *cgraph_edge_p; |
5707 |
+typedef struct varpool_node *varpool_node_ptr; |
5708 |
@@ -116816,26 +117411,70 @@ index 0000000..19fedf2 |
5709 |
+ return gimple_build_assign(lhs, subcode, op1, op2 PASS_MEM_STAT); |
5710 |
+} |
5711 |
+ |
5712 |
++template <> |
5713 |
++template <> |
5714 |
++inline bool is_a_helper<const gassign *>::test(const_gimple gs) |
5715 |
++{ |
5716 |
++ return gs->code == GIMPLE_ASSIGN; |
5717 |
++} |
5718 |
++ |
5719 |
++template <> |
5720 |
++template <> |
5721 |
++inline bool is_a_helper<const greturn *>::test(const_gimple gs) |
5722 |
++{ |
5723 |
++ return gs->code == GIMPLE_RETURN; |
5724 |
++} |
5725 |
++ |
5726 |
+static inline gasm *as_a_gasm(gimple stmt) |
5727 |
+{ |
5728 |
+ return as_a<gasm *>(stmt); |
5729 |
+} |
5730 |
+ |
5731 |
-+static inline const gasm *as_a_gasm(const_gimple stmt) |
5732 |
++static inline const gasm *as_a_const_gasm(const_gimple stmt) |
5733 |
+{ |
5734 |
+ return as_a<const gasm *>(stmt); |
5735 |
+} |
5736 |
+ |
5737 |
++static inline gassign *as_a_gassign(gimple stmt) |
5738 |
++{ |
5739 |
++ return as_a<gassign *>(stmt); |
5740 |
++} |
5741 |
++ |
5742 |
++static inline const gassign *as_a_const_gassign(const_gimple stmt) |
5743 |
++{ |
5744 |
++ return as_a<const gassign *>(stmt); |
5745 |
++} |
5746 |
++ |
5747 |
+static inline gcall *as_a_gcall(gimple stmt) |
5748 |
+{ |
5749 |
+ return as_a<gcall *>(stmt); |
5750 |
+} |
5751 |
+ |
5752 |
++static inline const gcall *as_a_const_gcall(const_gimple stmt) |
5753 |
++{ |
5754 |
++ return as_a<const gcall *>(stmt); |
5755 |
++} |
5756 |
++ |
5757 |
++static inline gphi *as_a_gphi(gimple stmt) |
5758 |
++{ |
5759 |
++ return as_a<gphi *>(stmt); |
5760 |
++} |
5761 |
++ |
5762 |
++static inline const gphi *as_a_const_gphi(const_gimple stmt) |
5763 |
++{ |
5764 |
++ return as_a<const gphi *>(stmt); |
5765 |
++} |
5766 |
++ |
5767 |
+static inline greturn *as_a_greturn(gimple stmt) |
5768 |
+{ |
5769 |
+ return as_a<greturn *>(stmt); |
5770 |
+} |
5771 |
+ |
5772 |
++static inline const greturn *as_a_const_greturn(const_gimple stmt) |
5773 |
++{ |
5774 |
++ return as_a<const greturn *>(stmt); |
5775 |
++} |
5776 |
++ |
5777 |
+// IPA/LTO related |
5778 |
+#define ipa_ref_list_referring_iterate(L,I,P) (L)->referring.iterate((I), &(P)) |
5779 |
+#define ipa_ref_list_reference_iterate(L,I,P) (L)->reference.iterate((I), &(P)) |
5780 |
@@ -116844,6 +117483,11 @@ index 0000000..19fedf2 |
5781 |
+{ |
5782 |
+ return dyn_cast<cgraph_node_ptr>(ref->referring); |
5783 |
+} |
5784 |
++ |
5785 |
++static inline void ipa_remove_stmt_references(symtab_node *referring_node, gimple stmt) |
5786 |
++{ |
5787 |
++ referring_node->remove_stmt_references(stmt); |
5788 |
++} |
5789 |
+#endif |
5790 |
+ |
5791 |
+#endif |
5792 |
@@ -117057,7 +117701,7 @@ index 0000000..457d54e |
5793 |
+} |
5794 |
diff --git a/tools/gcc/kernexec_plugin.c b/tools/gcc/kernexec_plugin.c |
5795 |
new file mode 100644 |
5796 |
-index 0000000..71716e7 |
5797 |
+index 0000000..b0d8255 |
5798 |
--- /dev/null |
5799 |
+++ b/tools/gcc/kernexec_plugin.c |
5800 |
@@ -0,0 +1,547 @@ |
5801 |
@@ -117212,9 +117856,9 @@ index 0000000..71716e7 |
5802 |
+ new_fptr = make_ssa_name(new_fptr, NULL); |
5803 |
+ |
5804 |
+ // build asm volatile("orq %%r12, %0\n\t" : "=r"(new_fptr) : "0"(old_fptr)); |
5805 |
-+ input = build_tree_list(NULL_TREE, build_string(1, "0")); |
5806 |
++ input = build_tree_list(NULL_TREE, build_string(2, "0")); |
5807 |
+ input = chainon(NULL_TREE, build_tree_list(input, old_fptr)); |
5808 |
-+ output = build_tree_list(NULL_TREE, build_string(2, "=r")); |
5809 |
++ output = build_tree_list(NULL_TREE, build_string(3, "=r")); |
5810 |
+ output = chainon(NULL_TREE, build_tree_list(output, new_fptr)); |
5811 |
+#if BUILDING_GCC_VERSION <= 4007 |
5812 |
+ VEC_safe_push(tree, gc, inputs, input); |
5813 |
@@ -117610,10 +118254,10 @@ index 0000000..71716e7 |
5814 |
+} |
5815 |
diff --git a/tools/gcc/latent_entropy_plugin.c b/tools/gcc/latent_entropy_plugin.c |
5816 |
new file mode 100644 |
5817 |
-index 0000000..d383708 |
5818 |
+index 0000000..ac6f9b4 |
5819 |
--- /dev/null |
5820 |
+++ b/tools/gcc/latent_entropy_plugin.c |
5821 |
-@@ -0,0 +1,473 @@ |
5822 |
+@@ -0,0 +1,474 @@ |
5823 |
+/* |
5824 |
+ * Copyright 2012-2015 by the PaX Team <pageexec@××××××××.hu> |
5825 |
+ * Licensed under the GPL v2 |
5826 |
@@ -117632,7 +118276,7 @@ index 0000000..d383708 |
5827 |
+ * - more instrumentation control via attribute parameters |
5828 |
+ * |
5829 |
+ * BUGS: |
5830 |
-+ * - LTO needs -flto-partition=none for now |
5831 |
++ * - none known |
5832 |
+ */ |
5833 |
+ |
5834 |
+#include "gcc-common.h" |
5835 |
@@ -117642,7 +118286,7 @@ index 0000000..d383708 |
5836 |
+static GTY(()) tree latent_entropy_decl; |
5837 |
+ |
5838 |
+static struct plugin_info latent_entropy_plugin_info = { |
5839 |
-+ .version = "201409101820", |
5840 |
++ .version = "201504282240", |
5841 |
+ .help = NULL |
5842 |
+}; |
5843 |
+ |
5844 |
@@ -117920,6 +118564,8 @@ index 0000000..d383708 |
5845 |
+ FOR_EACH_VARIABLE(node) { |
5846 |
+ tree var = NODE_DECL(node); |
5847 |
+ |
5848 |
++ if (DECL_NAME_LENGTH(var) < sizeof("latent_entropy") - 1) |
5849 |
++ continue; |
5850 |
+ if (strcmp(IDENTIFIER_POINTER(DECL_NAME(var)), "latent_entropy")) |
5851 |
+ continue; |
5852 |
+ latent_entropy_decl = var; |
5853 |
@@ -118080,8 +118726,7 @@ index 0000000..d383708 |
5854 |
+ |
5855 |
+ register_callback(plugin_name, PLUGIN_INFO, NULL, &latent_entropy_plugin_info); |
5856 |
+ register_callback(plugin_name, PLUGIN_START_UNIT, &latent_entropy_start_unit, NULL); |
5857 |
-+ if (!in_lto_p) |
5858 |
-+ register_callback(plugin_name, PLUGIN_REGISTER_GGC_ROOTS, NULL, (void *)>_ggc_r_gt_latent_entropy); |
5859 |
++ register_callback(plugin_name, PLUGIN_REGISTER_GGC_ROOTS, NULL, (void *)>_ggc_r_gt_latent_entropy); |
5860 |
+ register_callback(plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &latent_entropy_pass_info); |
5861 |
+ register_callback(plugin_name, PLUGIN_ATTRIBUTES, register_attributes, NULL); |
5862 |
+ |
5863 |
@@ -129225,10 +129870,10 @@ index 0000000..0888f6c |
5864 |
+ |
5865 |
diff --git a/tools/gcc/stackleak_plugin.c b/tools/gcc/stackleak_plugin.c |
5866 |
new file mode 100644 |
5867 |
-index 0000000..51dc09d |
5868 |
+index 0000000..1d296ce |
5869 |
--- /dev/null |
5870 |
+++ b/tools/gcc/stackleak_plugin.c |
5871 |
-@@ -0,0 +1,408 @@ |
5872 |
+@@ -0,0 +1,432 @@ |
5873 |
+/* |
5874 |
+ * Copyright 2011-2015 by the PaX Team <pageexec@××××××××.hu> |
5875 |
+ * Licensed under the GPL v2 |
5876 |
@@ -129261,29 +129906,49 @@ index 0000000..51dc09d |
5877 |
+static bool init_locals; |
5878 |
+ |
5879 |
+static struct plugin_info stackleak_plugin_info = { |
5880 |
-+ .version = "201408011900", |
5881 |
++ .version = "201504282245", |
5882 |
+ .help = "track-lowest-sp=nn\ttrack sp in functions whose frame size is at least nn bytes\n" |
5883 |
+// "initialize-locals\t\tforcibly initialize all stack frames\n" |
5884 |
+}; |
5885 |
+ |
5886 |
+static void stackleak_check_alloca(gimple_stmt_iterator *gsi) |
5887 |
+{ |
5888 |
-+ gimple check_alloca; |
5889 |
++ gcall *check_alloca; |
5890 |
+ tree alloca_size; |
5891 |
++ cgraph_node_ptr node; |
5892 |
++ int frequency; |
5893 |
++ basic_block bb; |
5894 |
+ |
5895 |
+ // insert call to void pax_check_alloca(unsigned long size) |
5896 |
+ alloca_size = gimple_call_arg(gsi_stmt(*gsi), 0); |
5897 |
+ check_alloca = gimple_build_call(check_function_decl, 1, alloca_size); |
5898 |
+ gsi_insert_before(gsi, check_alloca, GSI_SAME_STMT); |
5899 |
++ |
5900 |
++ // update the cgraph |
5901 |
++ bb = gimple_bb(check_alloca); |
5902 |
++ node = cgraph_get_create_node(check_function_decl); |
5903 |
++ gcc_assert(node); |
5904 |
++ frequency = compute_call_stmt_bb_frequency(current_function_decl, bb); |
5905 |
++ cgraph_create_edge(cgraph_get_node(current_function_decl), node, check_alloca, bb->count, frequency, bb->loop_depth); |
5906 |
+} |
5907 |
+ |
5908 |
+static void stackleak_add_instrumentation(gimple_stmt_iterator *gsi) |
5909 |
+{ |
5910 |
-+ gimple track_stack; |
5911 |
++ gcall *track_stack; |
5912 |
++ cgraph_node_ptr node; |
5913 |
++ int frequency; |
5914 |
++ basic_block bb; |
5915 |
+ |
5916 |
+ // insert call to void pax_track_stack(void) |
5917 |
+ track_stack = gimple_build_call(track_function_decl, 0); |
5918 |
+ gsi_insert_after(gsi, track_stack, GSI_CONTINUE_LINKING); |
5919 |
++ |
5920 |
++ // update the cgraph |
5921 |
++ bb = gimple_bb(track_stack); |
5922 |
++ node = cgraph_get_create_node(track_function_decl); |
5923 |
++ gcc_assert(node); |
5924 |
++ frequency = compute_call_stmt_bb_frequency(current_function_decl, bb); |
5925 |
++ cgraph_create_edge(cgraph_get_node(current_function_decl), node, track_stack, bb->count, frequency, bb->loop_depth); |
5926 |
+} |
5927 |
+ |
5928 |
+static bool is_alloca(gimple stmt) |
5929 |
@@ -129438,16 +130103,20 @@ index 0000000..51dc09d |
5930 |
+ track_function_decl = build_fn_decl(track_function, fntype); |
5931 |
+ DECL_ASSEMBLER_NAME(track_function_decl); // for LTO |
5932 |
+ TREE_PUBLIC(track_function_decl) = 1; |
5933 |
++ TREE_USED(track_function_decl) = 1; |
5934 |
+ DECL_EXTERNAL(track_function_decl) = 1; |
5935 |
+ DECL_ARTIFICIAL(track_function_decl) = 1; |
5936 |
++ DECL_PRESERVE_P(track_function_decl) = 1; |
5937 |
+ |
5938 |
+ // void pax_check_alloca(unsigned long) |
5939 |
+ fntype = build_function_type_list(void_type_node, long_unsigned_type_node, NULL_TREE); |
5940 |
+ check_function_decl = build_fn_decl(check_function, fntype); |
5941 |
+ DECL_ASSEMBLER_NAME(check_function_decl); // for LTO |
5942 |
+ TREE_PUBLIC(check_function_decl) = 1; |
5943 |
++ TREE_USED(check_function_decl) = 1; |
5944 |
+ DECL_EXTERNAL(check_function_decl) = 1; |
5945 |
+ DECL_ARTIFICIAL(check_function_decl) = 1; |
5946 |
++ DECL_PRESERVE_P(check_function_decl) = 1; |
5947 |
+} |
5948 |
+ |
5949 |
+#if BUILDING_GCC_VERSION >= 4009 |