summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony G. Basile <blueness@gentoo.org>2015-05-01 13:55:27 -0400
committerAnthony G. Basile <blueness@gentoo.org>2015-05-01 13:55:27 -0400
commit3e678adc57099bd7bd7b6b67f97cc88826db452d (patch)
tree662dab9113b7912634d34410edfd1ea111ea3451
parentGrsec/PaX: 3.1-{3.14.40,3.19.6}-201504290821 (diff)
downloadhardened-patchset-3e678adc57099bd7bd7b6b67f97cc88826db452d.tar.gz
hardened-patchset-3e678adc57099bd7bd7b6b67f97cc88826db452d.tar.bz2
hardened-patchset-3e678adc57099bd7bd7b6b67f97cc88826db452d.zip
Grsec/PaX: 3.1-{3.2.68,3.14.40,3.19.6}-20150430211920150430
-rw-r--r--3.14.40/0000_README2
-rw-r--r--3.14.40/4420_grsecurity-3.1-3.14.40-201504302118.patch (renamed from 3.14.40/4420_grsecurity-3.1-3.14.40-201504290821.patch)917
-rw-r--r--3.19.6/0000_README2
-rw-r--r--3.19.6/4420_grsecurity-3.1-3.19.6-201504302119.patch (renamed from 3.19.6/4420_grsecurity-3.1-3.19.6-201504290821.patch)1221
-rw-r--r--3.2.68/0000_README2
-rw-r--r--3.2.68/4420_grsecurity-3.1-3.2.68-201504302116.patch (renamed from 3.2.68/4420_grsecurity-3.1-3.2.68-201504270825.patch)811
6 files changed, 2542 insertions, 413 deletions
diff --git a/3.14.40/0000_README b/3.14.40/0000_README
index 79dc6c4..4907942 100644
--- a/3.14.40/0000_README
+++ b/3.14.40/0000_README
@@ -6,7 +6,7 @@ Patch: 1039_linux-3.14.40.patch
From: http://www.kernel.org
Desc: Linux 3.14.40
-Patch: 4420_grsecurity-3.1-3.14.40-201504290821.patch
+Patch: 4420_grsecurity-3.1-3.14.40-201504302118.patch
From: http://www.grsecurity.net
Desc: hardened-sources base patch from upstream grsecurity
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
index 47246da..59db1dc 100644
--- 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
@@ -17533,7 +17533,7 @@ index 775873d..04cd306 100644
#include <asm-generic/memory_model.h>
diff --git a/arch/x86/include/asm/page_64.h b/arch/x86/include/asm/page_64.h
-index 0f1ddee..e2fc3d1 100644
+index 0f1ddee..7ce1ad2 100644
--- a/arch/x86/include/asm/page_64.h
+++ b/arch/x86/include/asm/page_64.h
@@ -7,9 +7,9 @@
@@ -17548,6 +17548,17 @@ index 0f1ddee..e2fc3d1 100644
{
unsigned long y = x - __START_KERNEL_map;
+@@ -20,8 +20,8 @@ static inline unsigned long __phys_addr_nodebug(unsigned long x)
+ }
+
+ #ifdef CONFIG_DEBUG_VIRTUAL
+-extern unsigned long __phys_addr(unsigned long);
+-extern unsigned long __phys_addr_symbol(unsigned long);
++extern unsigned long __intentional_overflow(-1) __phys_addr(unsigned long);
++extern unsigned long __intentional_overflow(-1) __phys_addr_symbol(unsigned long);
+ #else
+ #define __phys_addr(x) __phys_addr_nodebug(x)
+ #define __phys_addr_symbol(x) \
diff --git a/arch/x86/include/asm/page_64_types.h b/arch/x86/include/asm/page_64_types.h
index d54d1ee..75450b2 100644
--- a/arch/x86/include/asm/page_64_types.h
@@ -19565,7 +19576,7 @@ index 04905bf..1178cdf 100644
}
diff --git a/arch/x86/include/asm/uaccess.h b/arch/x86/include/asm/uaccess.h
-index 0d592e0..526f797 100644
+index 0d592e0..a9e3d4a 100644
--- a/arch/x86/include/asm/uaccess.h
+++ b/arch/x86/include/asm/uaccess.h
@@ -7,6 +7,7 @@
@@ -19628,7 +19639,24 @@ index 0d592e0..526f797 100644
/*
* The exception table consists of pairs of addresses relative to the
-@@ -176,10 +210,12 @@ __typeof__(__builtin_choose_expr(sizeof(x) > sizeof(0UL), 0ULL, 0UL))
+@@ -134,11 +168,13 @@ extern int __get_user_8(void);
+ extern int __get_user_bad(void);
+
+ /*
+- * This is a type: either unsigned long, if the argument fits into
+- * that type, or otherwise unsigned long long.
++ * This is a type: either (un)signed int, if the argument fits into
++ * that type, or otherwise (un)signed long long.
+ */
+ #define __inttype(x) \
+-__typeof__(__builtin_choose_expr(sizeof(x) > sizeof(0UL), 0ULL, 0UL))
++__typeof__(__builtin_choose_expr(sizeof(x) > sizeof(0U), \
++ __builtin_choose_expr(__type_is_unsigned(__typeof__(x)), 0ULL, 0LL),\
++ __builtin_choose_expr(__type_is_unsigned(__typeof__(x)), 0U, 0)))
+
+ /**
+ * get_user: - Get a simple variable from user space.
+@@ -176,10 +212,12 @@ __typeof__(__builtin_choose_expr(sizeof(x) > sizeof(0UL), 0ULL, 0UL))
register __inttype(*(ptr)) __val_gu asm("%"_ASM_DX); \
__chk_user_ptr(ptr); \
might_fault(); \
@@ -19641,7 +19669,7 @@ index 0d592e0..526f797 100644
__ret_gu; \
})
-@@ -187,13 +223,21 @@ __typeof__(__builtin_choose_expr(sizeof(x) > sizeof(0UL), 0ULL, 0UL))
+@@ -187,13 +225,21 @@ __typeof__(__builtin_choose_expr(sizeof(x) > sizeof(0UL), 0ULL, 0UL))
asm volatile("call __put_user_" #size : "=a" (__ret_pu) \
: "0" ((typeof(*(ptr)))(x)), "c" (ptr) : "ebx")
@@ -19666,7 +19694,7 @@ index 0d592e0..526f797 100644
"3: " ASM_CLAC "\n" \
".section .fixup,\"ax\"\n" \
"4: movl %3,%0\n" \
-@@ -206,8 +250,8 @@ __typeof__(__builtin_choose_expr(sizeof(x) > sizeof(0UL), 0ULL, 0UL))
+@@ -206,8 +252,8 @@ __typeof__(__builtin_choose_expr(sizeof(x) > sizeof(0UL), 0ULL, 0UL))
#define __put_user_asm_ex_u64(x, addr) \
asm volatile(ASM_STAC "\n" \
@@ -19677,7 +19705,7 @@ index 0d592e0..526f797 100644
"3: " ASM_CLAC "\n" \
_ASM_EXTABLE_EX(1b, 2b) \
_ASM_EXTABLE_EX(2b, 3b) \
-@@ -257,7 +301,8 @@ extern void __put_user_8(void);
+@@ -257,7 +303,8 @@ extern void __put_user_8(void);
__typeof__(*(ptr)) __pu_val; \
__chk_user_ptr(ptr); \
might_fault(); \
@@ -19687,7 +19715,7 @@ index 0d592e0..526f797 100644
switch (sizeof(*(ptr))) { \
case 1: \
__put_user_x(1, __pu_val, ptr, __ret_pu); \
-@@ -275,6 +320,7 @@ extern void __put_user_8(void);
+@@ -275,6 +322,7 @@ extern void __put_user_8(void);
__put_user_x(X, __pu_val, ptr, __ret_pu); \
break; \
} \
@@ -19695,7 +19723,7 @@ index 0d592e0..526f797 100644
__ret_pu; \
})
-@@ -355,8 +401,10 @@ do { \
+@@ -355,8 +403,10 @@ do { \
} while (0)
#define __get_user_asm(x, addr, err, itype, rtype, ltype, errret) \
@@ -19707,7 +19735,7 @@ index 0d592e0..526f797 100644
"2: " ASM_CLAC "\n" \
".section .fixup,\"ax\"\n" \
"3: mov %3,%0\n" \
-@@ -364,8 +412,10 @@ do { \
+@@ -364,8 +414,10 @@ do { \
" jmp 2b\n" \
".previous\n" \
_ASM_EXTABLE(1b, 3b) \
@@ -19720,7 +19748,7 @@ index 0d592e0..526f797 100644
#define __get_user_size_ex(x, ptr, size) \
do { \
-@@ -389,7 +439,7 @@ do { \
+@@ -389,7 +441,7 @@ do { \
} while (0)
#define __get_user_asm_ex(x, addr, itype, rtype, ltype) \
@@ -19729,7 +19757,7 @@ index 0d592e0..526f797 100644
"2:\n" \
_ASM_EXTABLE_EX(1b, 2b) \
: ltype(x) : "m" (__m(addr)))
-@@ -406,13 +456,24 @@ do { \
+@@ -406,13 +458,24 @@ do { \
int __gu_err; \
unsigned long __gu_val; \
__get_user_size(__gu_val, (ptr), (size), __gu_err, -EFAULT); \
@@ -19756,7 +19784,7 @@ index 0d592e0..526f797 100644
/*
* Tell gcc we read from memory instead of writing: this is because
-@@ -420,8 +481,10 @@ struct __large_struct { unsigned long buf[100]; };
+@@ -420,8 +483,10 @@ struct __large_struct { unsigned long buf[100]; };
* aliasing issues.
*/
#define __put_user_asm(x, addr, err, itype, rtype, ltype, errret) \
@@ -19768,7 +19796,7 @@ index 0d592e0..526f797 100644
"2: " ASM_CLAC "\n" \
".section .fixup,\"ax\"\n" \
"3: mov %3,%0\n" \
-@@ -429,10 +492,12 @@ struct __large_struct { unsigned long buf[100]; };
+@@ -429,10 +494,12 @@ struct __large_struct { unsigned long buf[100]; };
".previous\n" \
_ASM_EXTABLE(1b, 3b) \
: "=r"(err) \
@@ -19783,7 +19811,7 @@ index 0d592e0..526f797 100644
"2:\n" \
_ASM_EXTABLE_EX(1b, 2b) \
: : ltype(x), "m" (__m(addr)))
-@@ -442,11 +507,13 @@ struct __large_struct { unsigned long buf[100]; };
+@@ -442,11 +509,13 @@ struct __large_struct { unsigned long buf[100]; };
*/
#define uaccess_try do { \
current_thread_info()->uaccess_err = 0; \
@@ -19797,7 +19825,7 @@ index 0d592e0..526f797 100644
(err) |= (current_thread_info()->uaccess_err ? -EFAULT : 0); \
} while (0)
-@@ -471,8 +538,12 @@ struct __large_struct { unsigned long buf[100]; };
+@@ -471,8 +540,12 @@ struct __large_struct { unsigned long buf[100]; };
* On error, the variable @x is set to zero.
*/
@@ -19810,7 +19838,7 @@ index 0d592e0..526f797 100644
/**
* __put_user: - Write a simple value into user space, with less checking.
-@@ -494,8 +565,12 @@ struct __large_struct { unsigned long buf[100]; };
+@@ -494,8 +567,12 @@ struct __large_struct { unsigned long buf[100]; };
* Returns zero on success, or -EFAULT on error.
*/
@@ -19823,7 +19851,7 @@ index 0d592e0..526f797 100644
#define __get_user_unaligned __get_user
#define __put_user_unaligned __put_user
-@@ -513,7 +588,7 @@ struct __large_struct { unsigned long buf[100]; };
+@@ -513,7 +590,7 @@ struct __large_struct { unsigned long buf[100]; };
#define get_user_ex(x, ptr) do { \
unsigned long __gue_val; \
__get_user_size_ex((__gue_val), (ptr), (sizeof(*(ptr)))); \
@@ -19832,7 +19860,7 @@ index 0d592e0..526f797 100644
} while (0)
#define put_user_try uaccess_try
-@@ -542,18 +617,19 @@ extern void __cmpxchg_wrong_size(void)
+@@ -542,18 +619,19 @@ extern void __cmpxchg_wrong_size(void)
__typeof__(ptr) __uval = (uval); \
__typeof__(*(ptr)) __old = (old); \
__typeof__(*(ptr)) __new = (new); \
@@ -19854,7 +19882,7 @@ index 0d592e0..526f797 100644
: "i" (-EFAULT), "q" (__new), "1" (__old) \
: "memory" \
); \
-@@ -562,14 +638,14 @@ extern void __cmpxchg_wrong_size(void)
+@@ -562,14 +640,14 @@ extern void __cmpxchg_wrong_size(void)
case 2: \
{ \
asm volatile("\t" ASM_STAC "\n" \
@@ -19871,7 +19899,7 @@ index 0d592e0..526f797 100644
: "i" (-EFAULT), "r" (__new), "1" (__old) \
: "memory" \
); \
-@@ -578,14 +654,14 @@ extern void __cmpxchg_wrong_size(void)
+@@ -578,14 +656,14 @@ extern void __cmpxchg_wrong_size(void)
case 4: \
{ \
asm volatile("\t" ASM_STAC "\n" \
@@ -19888,7 +19916,7 @@ index 0d592e0..526f797 100644
: "i" (-EFAULT), "r" (__new), "1" (__old) \
: "memory" \
); \
-@@ -597,14 +673,14 @@ extern void __cmpxchg_wrong_size(void)
+@@ -597,14 +675,14 @@ extern void __cmpxchg_wrong_size(void)
__cmpxchg_wrong_size(); \
\
asm volatile("\t" ASM_STAC "\n" \
@@ -19905,7 +19933,7 @@ index 0d592e0..526f797 100644
: "i" (-EFAULT), "r" (__new), "1" (__old) \
: "memory" \
); \
-@@ -613,6 +689,7 @@ extern void __cmpxchg_wrong_size(void)
+@@ -613,6 +691,7 @@ extern void __cmpxchg_wrong_size(void)
default: \
__cmpxchg_wrong_size(); \
} \
@@ -19913,7 +19941,7 @@ index 0d592e0..526f797 100644
*__uval = __old; \
__ret; \
})
-@@ -636,17 +713,6 @@ extern struct movsl_mask {
+@@ -636,17 +715,6 @@ extern struct movsl_mask {
#define ARCH_HAS_NOCACHE_UACCESS 1
@@ -19931,7 +19959,7 @@ index 0d592e0..526f797 100644
#ifdef CONFIG_DEBUG_STRICT_USER_COPY_CHECKS
# define copy_user_diag __compiletime_error
#else
-@@ -656,7 +722,7 @@ unsigned long __must_check _copy_to_user(void __user *to, const void *from,
+@@ -656,7 +724,7 @@ unsigned long __must_check _copy_to_user(void __user *to, const void *from,
extern void copy_user_diag("copy_from_user() buffer size is too small")
copy_from_user_overflow(void);
extern void copy_user_diag("copy_to_user() buffer size is too small")
@@ -19940,7 +19968,7 @@ index 0d592e0..526f797 100644
#undef copy_user_diag
-@@ -669,7 +735,7 @@ __copy_from_user_overflow(void) __asm__("copy_from_user_overflow");
+@@ -669,7 +737,7 @@ __copy_from_user_overflow(void) __asm__("copy_from_user_overflow");
extern void
__compiletime_warning("copy_to_user() buffer size is not provably correct")
@@ -19949,7 +19977,7 @@ index 0d592e0..526f797 100644
#define __copy_to_user_overflow(size, count) __copy_to_user_overflow()
#else
-@@ -684,10 +750,16 @@ __copy_from_user_overflow(int size, unsigned long count)
+@@ -684,10 +752,16 @@ __copy_from_user_overflow(int size, unsigned long count)
#endif
@@ -19967,7 +19995,7 @@ index 0d592e0..526f797 100644
might_fault();
-@@ -709,12 +781,15 @@ copy_from_user(void *to, const void __user *from, unsigned long n)
+@@ -709,12 +783,15 @@ copy_from_user(void *to, const void __user *from, unsigned long n)
* case, and do only runtime checking for non-constant sizes.
*/
@@ -19989,7 +20017,7 @@ index 0d592e0..526f797 100644
return n;
}
-@@ -722,17 +797,18 @@ copy_from_user(void *to, const void __user *from, unsigned long n)
+@@ -722,17 +799,18 @@ copy_from_user(void *to, const void __user *from, unsigned long n)
static inline unsigned long __must_check
copy_to_user(void __user *to, const void *from, unsigned long n)
{
@@ -20890,7 +20918,7 @@ index c552247..587a316 100644
.name = "es7000",
.probe = probe_es7000,
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
-index 6ad4658..38a7b5c 100644
+index 6ad4658..5450d96 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -1057,7 +1057,7 @@ int IO_APIC_get_PCI_irq_vector(int bus, int slot, int pin,
@@ -20929,6 +20957,24 @@ index 6ad4658..38a7b5c 100644
eoi_ioapic_irq(irq, cfg);
}
+@@ -2513,7 +2513,7 @@ static void ack_apic_level(struct irq_data *data)
+ ioapic_irqd_unmask(data, cfg, masked);
+ }
+
+-static struct irq_chip ioapic_chip __read_mostly = {
++static struct irq_chip ioapic_chip = {
+ .name = "IO-APIC",
+ .irq_startup = startup_ioapic_irq,
+ .irq_mask = mask_ioapic_irq,
+@@ -2582,7 +2582,7 @@ static void ack_lapic_irq(struct irq_data *data)
+ ack_APIC_irq();
+ }
+
+-static struct irq_chip lapic_chip __read_mostly = {
++static struct irq_chip lapic_chip = {
+ .name = "local-APIC",
+ .irq_mask = mask_lapic_irq,
+ .irq_unmask = unmask_lapic_irq,
diff --git a/arch/x86/kernel/apic/numaq_32.c b/arch/x86/kernel/apic/numaq_32.c
index 1e42e8f..daacf44 100644
--- a/arch/x86/kernel/apic/numaq_32.c
@@ -21018,7 +21064,7 @@ index d263b13..963258b 100644
.name = "UV large system",
.probe = uv_probe,
diff --git a/arch/x86/kernel/apm_32.c b/arch/x86/kernel/apm_32.c
-index 3ab0343..814c4787 100644
+index 3ab0343..26bdc88 100644
--- a/arch/x86/kernel/apm_32.c
+++ b/arch/x86/kernel/apm_32.c
@@ -433,7 +433,7 @@ static DEFINE_MUTEX(apm_mutex);
@@ -21076,6 +21122,15 @@ index 3ab0343..814c4787 100644
put_cpu();
return error;
}
+@@ -2052,7 +2066,7 @@ static int __init swab_apm_power_in_minutes(const struct dmi_system_id *d)
+ return 0;
+ }
+
+-static struct dmi_system_id __initdata apm_dmi_table[] = {
++static const struct dmi_system_id __initconst apm_dmi_table[] = {
+ {
+ print_if_true,
+ KERN_WARNING "IBM T23 - BIOS 1.03b+ and controller firmware 1.02+ may be needed for Linux APM.",
@@ -2362,12 +2376,15 @@ static int __init apm_init(void)
* code to that CPU.
*/
@@ -27011,7 +27066,7 @@ index 2f355d2..e75ed0a 100644
return ret;
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
-index a6aa91f..74ba85d 100644
+index a6aa91f..257fea9 100644
--- a/arch/x86/kernel/reboot.c
+++ b/arch/x86/kernel/reboot.c
@@ -68,6 +68,11 @@ static int __init set_bios_reboot(const struct dmi_system_id *d)
@@ -27057,6 +27112,15 @@ index a6aa91f..74ba85d 100644
"rm" (real_mode_header->machine_real_restart_asm),
"a" (type));
#else
+@@ -135,7 +162,7 @@ static int __init set_kbd_reboot(const struct dmi_system_id *d)
+ /*
+ * This is a single dmi_table handling all reboot quirks.
+ */
+-static struct dmi_system_id __initdata reboot_dmi_table[] = {
++static const struct dmi_system_id __initconst reboot_dmi_table[] = {
+
+ /* Acer */
+ { /* Handle reboot issue on Acer Aspire one */
@@ -480,7 +507,7 @@ void __attribute__((weak)) mach_reboot_fixups(void)
* try to force a triple fault and then cycle between hitting the keyboard
* controller and doing that
@@ -33821,7 +33885,7 @@ index 9f0614d..92ae64a 100644
p += get_opcode(p, &opcode);
for (i = 0; i < ARRAY_SIZE(imm_wop); i++)
diff --git a/arch/x86/mm/pgtable.c b/arch/x86/mm/pgtable.c
-index 0004ac7..2ab49d0 100644
+index 0004ac7..b953d7b 100644
--- a/arch/x86/mm/pgtable.c
+++ b/arch/x86/mm/pgtable.c
@@ -97,10 +97,71 @@ static inline void pgd_list_del(pgd_t *pgd)
@@ -33874,7 +33938,7 @@ index 0004ac7..2ab49d0 100644
+#define pyd_t pgd_t
+#define paravirt_release_pxd(pfn) paravirt_release_pud(pfn)
+#define pgtable_pxd_page_ctor(page) true
-+#define pgtable_pxd_page_dtor(page)
++#define pgtable_pxd_page_dtor(page) do {} while (0)
+#define pxd_free(mm, pud) pud_free((mm), (pud))
+#define pyd_populate(mm, pgd, pud) pgd_populate((mm), (pgd), (pud))
+#define pyd_offset(mm, address) pgd_offset((mm), (address))
@@ -36940,6 +37004,23 @@ index 253db94..7ee5a04 100644
return 0;
}
+diff --git a/crypto/zlib.c b/crypto/zlib.c
+index d980788..2422b3d 100644
+--- a/crypto/zlib.c
++++ b/crypto/zlib.c
+@@ -95,10 +95,10 @@ static int zlib_compress_setup(struct crypto_pcomp *tfm, void *params,
+ zlib_comp_exit(ctx);
+
+ window_bits = tb[ZLIB_COMP_WINDOWBITS]
+- ? nla_get_u32(tb[ZLIB_COMP_WINDOWBITS])
++ ? nla_get_s32(tb[ZLIB_COMP_WINDOWBITS])
+ : MAX_WBITS;
+ mem_level = tb[ZLIB_COMP_MEMLEVEL]
+- ? nla_get_u32(tb[ZLIB_COMP_MEMLEVEL])
++ ? nla_get_s32(tb[ZLIB_COMP_MEMLEVEL])
+ : DEF_MEM_LEVEL;
+
+ workspacesize = zlib_deflate_workspacesize(window_bits, mem_level);
diff --git a/drivers/acpi/acpica/hwxfsleep.c b/drivers/acpi/acpica/hwxfsleep.c
index 15dddc1..b61cf0c 100644
--- a/drivers/acpi/acpica/hwxfsleep.c
@@ -37036,6 +37117,28 @@ index 3d8413d..95f638c 100644
{
.callback = dmi_disable_osi_vista,
.ident = "Fujitsu Siemens",
+diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
+index b48aefa..91b17ef 100644
+--- a/drivers/acpi/bus.c
++++ b/drivers/acpi/bus.c
+@@ -67,7 +67,7 @@ static int set_copy_dsdt(const struct dmi_system_id *id)
+ }
+ #endif
+
+-static struct dmi_system_id dsdt_dmi_table[] __initdata = {
++static const struct dmi_system_id dsdt_dmi_table[] __initconst = {
+ /*
+ * Invoke DSDT corruption work-around on all Toshiba Satellite.
+ * https://bugzilla.kernel.org/show_bug.cgi?id=14679
+@@ -83,7 +83,7 @@ static struct dmi_system_id dsdt_dmi_table[] __initdata = {
+ {}
+ };
+ #else
+-static struct dmi_system_id dsdt_dmi_table[] __initdata = {
++static const struct dmi_system_id dsdt_dmi_table[] __initconst = {
+ {}
+ };
+ #endif
diff --git a/drivers/acpi/custom_method.c b/drivers/acpi/custom_method.c
index c68e724..e863008 100644
--- a/drivers/acpi/custom_method.c
@@ -37051,6 +37154,58 @@ index c68e724..e863008 100644
if (!(*ppos)) {
/* parse the table header to get the table length */
if (count <= sizeof(struct acpi_table_header))
+diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
+index 49d8990..500b5ffe 100644
+--- a/drivers/acpi/ec.c
++++ b/drivers/acpi/ec.c
+@@ -978,7 +978,7 @@ static int ec_clear_on_resume(const struct dmi_system_id *id)
+ return 0;
+ }
+
+-static struct dmi_system_id ec_dmi_table[] __initdata = {
++static const struct dmi_system_id ec_dmi_table[] __initconst = {
+ {
+ ec_skip_dsdt_scan, "Compal JFL92", {
+ DMI_MATCH(DMI_BIOS_VENDOR, "COMPAL"),
+diff --git a/drivers/acpi/pci_slot.c b/drivers/acpi/pci_slot.c
+index 139d9e4..9a9d799 100644
+--- a/drivers/acpi/pci_slot.c
++++ b/drivers/acpi/pci_slot.c
+@@ -195,7 +195,7 @@ static int do_sta_before_sun(const struct dmi_system_id *d)
+ return 0;
+ }
+
+-static struct dmi_system_id acpi_pci_slot_dmi_table[] __initdata = {
++static const struct dmi_system_id acpi_pci_slot_dmi_table[] __initconst = {
+ /*
+ * Fujitsu Primequest machines will return 1023 to indicate an
+ * error if the _SUN method is evaluated on SxFy objects that
+diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
+index a4eea9a..1765579 100644
+--- a/drivers/acpi/processor_core.c
++++ b/drivers/acpi/processor_core.c
+@@ -27,7 +27,7 @@ static int __init set_no_mwait(const struct dmi_system_id *id)
+ return 0;
+ }
+
+-static struct dmi_system_id processor_idle_dmi_table[] __initdata = {
++static const struct dmi_system_id processor_idle_dmi_table[] __initconst = {
+ {
+ set_no_mwait, "Extensa 5220", {
+ DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies LTD"),
+diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c
+index c1c3562..4c77729 100644
+--- a/drivers/acpi/processor_driver.c
++++ b/drivers/acpi/processor_driver.c
+@@ -153,7 +153,7 @@ static int acpi_cpu_soft_notify(struct notifier_block *nfb,
+ return NOTIFY_OK;
+ }
+
+-static struct notifier_block __refdata acpi_cpu_notifier = {
++static struct notifier_block __refconst acpi_cpu_notifier = {
+ .notifier_call = acpi_cpu_soft_notify,
+ };
+
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index fd8496a..bd2c3e3 100644
--- a/drivers/acpi/processor_idle.c
@@ -37064,6 +37219,19 @@ index fd8496a..bd2c3e3 100644
struct cpuidle_driver *drv = &acpi_idle_driver;
if (!pr->flags.power_setup_done)
+diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
+index c40fb2e..2c09959 100644
+--- a/drivers/acpi/sleep.c
++++ b/drivers/acpi/sleep.c
+@@ -145,7 +145,7 @@ static int __init init_nvs_nosave(const struct dmi_system_id *d)
+ return 0;
+ }
+
+-static struct dmi_system_id acpisleep_dmi_table[] __initdata = {
++static const struct dmi_system_id acpisleep_dmi_table[] __initconst = {
+ {
+ .callback = init_old_suspend_ordering,
+ .ident = "Abit KN9 (nForce4 variant)",
diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c
index 91a32ce..d77fcaf 100644
--- a/drivers/acpi/sysfs.c
@@ -37082,6 +37250,32 @@ index 91a32ce..d77fcaf 100644
static void delete_gpe_attr_array(void)
{
+diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
+index 08626c8..e433906 100644
+--- a/drivers/acpi/thermal.c
++++ b/drivers/acpi/thermal.c
+@@ -1189,7 +1189,7 @@ static int thermal_psv(const struct dmi_system_id *d) {
+ return 0;
+ }
+
+-static struct dmi_system_id thermal_dmi_table[] __initdata = {
++static const struct dmi_system_id thermal_dmi_table[] __initconst = {
+ /*
+ * Award BIOS on this AOpen makes thermal control almost worthless.
+ * http://bugzilla.kernel.org/show_bug.cgi?id=8842
+diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
+index 997540d..cebb4c5 100644
+--- a/drivers/acpi/video.c
++++ b/drivers/acpi/video.c
+@@ -413,7 +413,7 @@ static int __init video_set_use_native_backlight(const struct dmi_system_id *d)
+ return 0;
+ }
+
+-static struct dmi_system_id video_dmi_table[] __initdata = {
++static const struct dmi_system_id video_dmi_table[] __initconst = {
+ /*
+ * Broken _BQC workaround http://bugzilla.kernel.org/show_bug.cgi?id=13121
+ */
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
index 36605ab..6ef6d4b 100644
--- a/drivers/ata/libahci.c
@@ -39328,6 +39522,19 @@ index 86fe45c..c0ea948 100644
return -EBUSY;
}
+diff --git a/drivers/char/i8k.c b/drivers/char/i8k.c
+index 93dcad0..c6e53b1 100644
+--- a/drivers/char/i8k.c
++++ b/drivers/char/i8k.c
+@@ -659,7 +659,7 @@ static int __init i8k_init_hwmon(void)
+ return 0;
+ }
+
+-static struct dmi_system_id i8k_dmi_table[] __initdata = {
++static const struct dmi_system_id i8k_dmi_table[] __initconst = {
+ {
+ .ident = "Dell Inspiron",
+ .matches = {
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c
index ec4e10f..f2a763b 100644
--- a/drivers/char/ipmi/ipmi_msghandler.c
@@ -39717,7 +39924,7 @@ index 8a64dbe..58488cc 100644
entropy_count = *(int *)table->data >> ENTROPY_SHIFT;
diff --git a/drivers/char/sonypi.c b/drivers/char/sonypi.c
-index 7cc1fe22..b602d6b 100644
+index 7cc1fe22..e7bf59e 100644
--- a/drivers/char/sonypi.c
+++ b/drivers/char/sonypi.c
@@ -54,6 +54,7 @@
@@ -39758,6 +39965,15 @@ index 7cc1fe22..b602d6b 100644
mutex_unlock(&sonypi_device.lock);
return 0;
+@@ -1492,7 +1493,7 @@ static struct platform_driver sonypi_driver = {
+
+ static struct platform_device *sonypi_platform_device;
+
+-static struct dmi_system_id __initdata sonypi_dmi_table[] = {
++static const struct dmi_system_id __initconst sonypi_dmi_table[] = {
+ {
+ .ident = "Sony Vaio",
+ .matches = {
diff --git a/drivers/char/tpm/tpm_acpi.c b/drivers/char/tpm/tpm_acpi.c
index b9a57fa..5bb9e38 100644
--- a/drivers/char/tpm/tpm_acpi.c
@@ -40789,10 +41005,45 @@ index 3dc2482..7bd2f61 100644
int error;
/* new_var */
+diff --git a/drivers/firmware/efi/runtime-map.c b/drivers/firmware/efi/runtime-map.c
+index c98b101..cc7bd25 100644
+--- a/drivers/firmware/efi/runtime-map.c
++++ b/drivers/firmware/efi/runtime-map.c
+@@ -97,7 +97,7 @@ static void map_release(struct kobject *kobj)
+ kfree(entry);
+ }
+
+-static struct kobj_type __refdata map_ktype = {
++static const struct kobj_type __refconst map_ktype = {
+ .sysfs_ops = &map_attr_ops,
+ .default_attrs = def_attrs,
+ .release = map_release,
+diff --git a/drivers/firmware/google/gsmi.c b/drivers/firmware/google/gsmi.c
+index e5a67b2..77d6167 100644
+--- a/drivers/firmware/google/gsmi.c
++++ b/drivers/firmware/google/gsmi.c
+@@ -709,7 +709,7 @@ static u32 __init hash_oem_table_id(char s[8])
+ return local_hash_64(input, 32);
+ }
+
+-static struct dmi_system_id gsmi_dmi_table[] __initdata = {
++static const struct dmi_system_id gsmi_dmi_table[] __initconst = {
+ {
+ .ident = "Google Board",
+ .matches = {
diff --git a/drivers/firmware/google/memconsole.c b/drivers/firmware/google/memconsole.c
-index 2a90ba6..07f3733 100644
+index 2a90ba6..72379aa 100644
--- a/drivers/firmware/google/memconsole.c
+++ b/drivers/firmware/google/memconsole.c
+@@ -126,7 +126,7 @@ static bool found_memconsole(void)
+ return false;
+ }
+
+-static struct dmi_system_id memconsole_dmi_table[] __initdata = {
++static const struct dmi_system_id memconsole_dmi_table[] __initconst = {
+ {
+ .ident = "Google Board",
+ .matches = {
@@ -147,7 +147,9 @@ static int __init memconsole_init(void)
if (!found_memconsole())
return -ENODEV;
@@ -40804,6 +41055,19 @@ index 2a90ba6..07f3733 100644
ret = sysfs_create_bin_file(firmware_kobj, &memconsole_bin_attr);
+diff --git a/drivers/firmware/memmap.c b/drivers/firmware/memmap.c
+index 17cf96c..0b11581 100644
+--- a/drivers/firmware/memmap.c
++++ b/drivers/firmware/memmap.c
+@@ -124,7 +124,7 @@ static void __meminit release_firmware_map_entry(struct kobject *kobj)
+ kfree(entry);
+ }
+
+-static struct kobj_type __refdata memmap_ktype = {
++static const struct kobj_type __refconst memmap_ktype = {
+ .release = release_firmware_map_entry,
+ .sysfs_ops = &memmap_attr_ops,
+ .default_attrs = def_attrs,
diff --git a/drivers/gpio/gpio-em.c b/drivers/gpio/gpio-em.c
index 1e98a98..b444372 100644
--- a/drivers/gpio/gpio-em.c
@@ -42816,7 +43080,7 @@ index 077bb1b..d433d74 100644
child_device_obj->device.bus = &hv_bus;
child_device_obj->device.parent = &hv_acpi_dev->dev;
diff --git a/drivers/hwmon/acpi_power_meter.c b/drivers/hwmon/acpi_power_meter.c
-index 579bdf9..75118b5 100644
+index 579bdf9..0dac21d5 100644
--- a/drivers/hwmon/acpi_power_meter.c
+++ b/drivers/hwmon/acpi_power_meter.c
@@ -116,7 +116,7 @@ struct sensor_template {
@@ -42837,6 +43101,15 @@ index 579bdf9..75118b5 100644
&resource->sensors[resource->num_sensors];
int res = 0;
+@@ -973,7 +973,7 @@ static int __init enable_cap_knobs(const struct dmi_system_id *d)
+ return 0;
+ }
+
+-static struct dmi_system_id __initdata pm_dmi_table[] = {
++static const struct dmi_system_id __initconst pm_dmi_table[] = {
+ {
+ enable_cap_knobs, "IBM Active Energy Manager",
+ {
diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
index 3288f13..71cfb4e 100644
--- a/drivers/hwmon/applesmc.c
@@ -44235,6 +44508,19 @@ index c9a02fe..0debc75 100644
kref_init(&serio_raw->kref);
INIT_LIST_HEAD(&serio_raw->client_list);
init_waitqueue_head(&serio_raw->wait);
+diff --git a/drivers/input/touchscreen/htcpen.c b/drivers/input/touchscreen/htcpen.c
+index 92e2243..8fd9092 100644
+--- a/drivers/input/touchscreen/htcpen.c
++++ b/drivers/input/touchscreen/htcpen.c
+@@ -219,7 +219,7 @@ static struct isa_driver htcpen_isa_driver = {
+ }
+ };
+
+-static struct dmi_system_id htcshift_dmi_table[] __initdata = {
++static const struct dmi_system_id htcshift_dmi_table[] __initconst = {
+ {
+ .ident = "Shift",
+ .matches = {
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
index 9cbef59..26db8e4 100644
--- a/drivers/iommu/amd_iommu.c
@@ -45490,9 +45776,39 @@ index a46124e..caf0bd55 100644
rdev_dec_pending(rdev, mddev);
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
-index 3545faf..2977207 100644
+index 3545faf..1431c5a 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
+@@ -942,23 +942,23 @@ async_copy_data(int frombio, struct bio *bio, struct page *page,
+ struct bio_vec bvl;
+ struct bvec_iter iter;
+ struct page *bio_page;
+- int page_offset;
++ s64 page_offset;
+ struct async_submit_ctl submit;
+ enum async_tx_flags flags = 0;
+
+ if (bio->bi_iter.bi_sector >= sector)
+- page_offset = (signed)(bio->bi_iter.bi_sector - sector) * 512;
++ page_offset = (s64)(bio->bi_iter.bi_sector - sector) * 512;
+ else
+- page_offset = (signed)(sector - bio->bi_iter.bi_sector) * -512;
++ page_offset = (s64)(sector - bio->bi_iter.bi_sector) * -512;
+
+ if (frombio)
+ flags |= ASYNC_TX_FENCE;
+ init_async_submit(&submit, flags, tx, NULL, NULL, NULL);
+
+ bio_for_each_segment(bvl, bio, iter) {
+- int len = bvl.bv_len;
+- int clen;
+- int b_offset = 0;
++ s64 len = bvl.bv_len;
++ s64 clen;
++ s64 b_offset = 0;
+
+ if (page_offset < 0) {
+ b_offset = -page_offset;
@@ -1711,6 +1711,10 @@ static int grow_one_stripe(struct r5conf *conf, int hash)
return 1;
}
@@ -47110,6 +47426,19 @@ index d1a22aa..d0f7bf7 100644
static char **event_name;
static u8 avg_sample = SAMPLE_16;
+diff --git a/drivers/mfd/kempld-core.c b/drivers/mfd/kempld-core.c
+index 2df3cbc..e4101dc 100644
+--- a/drivers/mfd/kempld-core.c
++++ b/drivers/mfd/kempld-core.c
+@@ -414,7 +414,7 @@ static struct platform_driver kempld_driver = {
+ .remove = kempld_remove,
+ };
+
+-static struct dmi_system_id __initdata kempld_dmi_table[] = {
++static const struct dmi_system_id __initconst kempld_dmi_table[] = {
+ {
+ .ident = "BHL6",
+ .matches = {
diff --git a/drivers/mfd/max8925-i2c.c b/drivers/mfd/max8925-i2c.c
index a83eed5..62a58a9 100644
--- a/drivers/mfd/max8925-i2c.c
@@ -48279,6 +48608,19 @@ index 50617c5..b13724c 100644
}
/* To mask all all interrupts.*/
+diff --git a/drivers/net/ethernet/via/via-rhine.c b/drivers/net/ethernet/via/via-rhine.c
+index 6ac20a6..a0cbf82 100644
+--- a/drivers/net/ethernet/via/via-rhine.c
++++ b/drivers/net/ethernet/via/via-rhine.c
+@@ -2417,7 +2417,7 @@ static struct pci_driver rhine_driver = {
+ .driver.pm = RHINE_PM_OPS,
+ };
+
+-static struct dmi_system_id rhine_dmi_table[] __initdata = {
++static const struct dmi_system_id rhine_dmi_table[] __initconst = {
+ {
+ .ident = "EPIA-M",
+ .matches = {
diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h
index 7b594ce..1f6c5708 100644
--- a/drivers/net/hyperv/hyperv_net.h
@@ -49984,6 +50326,19 @@ index e1e7026..d28dd33 100644
#define ASPM_STATE_L0S (ASPM_STATE_L0S_UP | ASPM_STATE_L0S_DW)
#define ASPM_STATE_ALL (ASPM_STATE_L0S | ASPM_STATE_L1)
+diff --git a/drivers/pci/pcie/portdrv_pci.c b/drivers/pci/pcie/portdrv_pci.c
+index 0d8fdc4..271f09e 100644
+--- a/drivers/pci/pcie/portdrv_pci.c
++++ b/drivers/pci/pcie/portdrv_pci.c
+@@ -402,7 +402,7 @@ static int __init dmi_pcie_pme_disable_msi(const struct dmi_system_id *d)
+ return 0;
+ }
+
+-static struct dmi_system_id __initdata pcie_portdrv_dmi_table[] = {
++static const struct dmi_system_id __initconst pcie_portdrv_dmi_table[] = {
+ /*
+ * Boxes that should not use MSI for PCIe PME signaling.
+ */
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 5b428db..553e4e3 100644
--- a/drivers/pci/probe.c
@@ -50031,6 +50386,19 @@ index 7f3aad0..7d604bb 100644
{
.ident = "Samsung Series 5 550",
.matches = {
+diff --git a/drivers/platform/chrome/chromeos_pstore.c b/drivers/platform/chrome/chromeos_pstore.c
+index e0e0e65..c086592 100644
+--- a/drivers/platform/chrome/chromeos_pstore.c
++++ b/drivers/platform/chrome/chromeos_pstore.c
+@@ -13,7 +13,7 @@
+ #include <linux/platform_device.h>
+ #include <linux/pstore_ram.h>
+
+-static struct dmi_system_id chromeos_pstore_dmi_table[] __initdata = {
++static const struct dmi_system_id chromeos_pstore_dmi_table[] __initconst = {
+ {
+ /*
+ * Today all Chromebooks/boxes ship with GOOGLE as vendor and
diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
index c5e082f..d6307a0 100644
--- a/drivers/platform/x86/asus-wmi.c
@@ -50068,10 +50436,71 @@ index c5e082f..d6307a0 100644
status = wmi_evaluate_method(ASUS_WMI_MGMT_GUID,
1, asus->debug.method_id,
&input, &output);
+diff --git a/drivers/platform/x86/compal-laptop.c b/drivers/platform/x86/compal-laptop.c
+index 7297df2..b832a73 100644
+--- a/drivers/platform/x86/compal-laptop.c
++++ b/drivers/platform/x86/compal-laptop.c
+@@ -767,7 +767,7 @@ static int dmi_check_cb_extra(const struct dmi_system_id *id)
+ return 1;
+ }
+
+-static struct dmi_system_id __initdata compal_dmi_table[] = {
++static const struct dmi_system_id __initconst compal_dmi_table[] = {
+ {
+ .ident = "FL90/IFL90",
+ .matches = {
+diff --git a/drivers/platform/x86/hdaps.c b/drivers/platform/x86/hdaps.c
+index 777c7e3..11dcbce 100644
+--- a/drivers/platform/x86/hdaps.c
++++ b/drivers/platform/x86/hdaps.c
+@@ -515,7 +515,7 @@ static int __init hdaps_dmi_match_invert(const struct dmi_system_id *id)
+ "ThinkPad T42p", so the order of the entries matters.
+ If your ThinkPad is not recognized, please update to latest
+ BIOS. This is especially the case for some R52 ThinkPads. */
+-static struct dmi_system_id __initdata hdaps_whitelist[] = {
++static const struct dmi_system_id __initconst hdaps_whitelist[] = {
+ HDAPS_DMI_MATCH_INVERT("IBM", "ThinkPad R50p", HDAPS_BOTH_AXES),
+ HDAPS_DMI_MATCH_NORMAL("IBM", "ThinkPad R50"),
+ HDAPS_DMI_MATCH_NORMAL("IBM", "ThinkPad R51"),
+diff --git a/drivers/platform/x86/ibm_rtl.c b/drivers/platform/x86/ibm_rtl.c
+index 97c2be1..2ee50ce 100644
+--- a/drivers/platform/x86/ibm_rtl.c
++++ b/drivers/platform/x86/ibm_rtl.c
+@@ -227,7 +227,7 @@ static void rtl_teardown_sysfs(void) {
+ }
+
+
+-static struct dmi_system_id __initdata ibm_rtl_dmi_table[] = {
++static const struct dmi_system_id __initconst ibm_rtl_dmi_table[] = {
+ { \
+ .matches = { \
+ DMI_MATCH(DMI_SYS_VENDOR, "IBM"), \
+diff --git a/drivers/platform/x86/intel_oaktrail.c b/drivers/platform/x86/intel_oaktrail.c
+index 4bc9604..db855c0 100644
+--- a/drivers/platform/x86/intel_oaktrail.c
++++ b/drivers/platform/x86/intel_oaktrail.c
+@@ -300,7 +300,7 @@ static int dmi_check_cb(const struct dmi_system_id *id)
+ return 0;
+ }
+
+-static struct dmi_system_id __initdata oaktrail_dmi_table[] = {
++static const struct dmi_system_id __initconst oaktrail_dmi_table[] = {
+ {
+ .ident = "OakTrail platform",
+ .matches = {
diff --git a/drivers/platform/x86/msi-laptop.c b/drivers/platform/x86/msi-laptop.c
-index 62f8030..c7f2a45 100644
+index 62f8030..02f93f0 100644
--- a/drivers/platform/x86/msi-laptop.c
+++ b/drivers/platform/x86/msi-laptop.c
+@@ -605,7 +605,7 @@ static int dmi_check_cb(const struct dmi_system_id *dmi)
+ return 1;
+ }
+
+-static struct dmi_system_id __initdata msi_dmi_table[] = {
++static const struct dmi_system_id __initconst msi_dmi_table[] = {
+ {
+ .ident = "MSI S270",
+ .matches = {
@@ -1000,12 +1000,14 @@ static int __init load_scm_model_init(struct platform_device *sdev)
if (!quirks->ec_read_only) {
@@ -50106,8 +50535,34 @@ index 70222f2..8c8ce66 100644
union acpi_object *obj;
acpi_status status;
+diff --git a/drivers/platform/x86/samsung-laptop.c b/drivers/platform/x86/samsung-laptop.c
+index d1f03005..0695666 100644
+--- a/drivers/platform/x86/samsung-laptop.c
++++ b/drivers/platform/x86/samsung-laptop.c
+@@ -1435,7 +1435,7 @@ static int __init samsung_dmi_matched(const struct dmi_system_id *d)
+ return 0;
+ }
+
+-static struct dmi_system_id __initdata samsung_dmi_table[] = {
++static const struct dmi_system_id __initconst samsung_dmi_table[] = {
+ {
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR,
+diff --git a/drivers/platform/x86/samsung-q10.c b/drivers/platform/x86/samsung-q10.c
+index 5413f62..79b83da 100644
+--- a/drivers/platform/x86/samsung-q10.c
++++ b/drivers/platform/x86/samsung-q10.c
+@@ -102,7 +102,7 @@ static int __init dmi_check_callback(const struct dmi_system_id *id)
+ return 1;
+ }
+
+-static struct dmi_system_id __initdata samsungq10_dmi_table[] = {
++static const struct dmi_system_id __initconst samsungq10_dmi_table[] = {
+ {
+ .ident = "Samsung Q10",
+ .matches = {
diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c
-index 8f8551a..3ace3ca 100644
+index 8f8551a..5961446 100644
--- a/drivers/platform/x86/sony-laptop.c
+++ b/drivers/platform/x86/sony-laptop.c
@@ -2451,7 +2451,7 @@ static void sony_nc_gfx_switch_cleanup(struct platform_device *pd)
@@ -50119,6 +50574,15 @@ index 8f8551a..3ace3ca 100644
static ssize_t sony_nc_highspeed_charging_store(struct device *dev,
struct device_attribute *attr,
+@@ -4434,7 +4434,7 @@ static struct acpi_driver sony_pic_driver = {
+ .drv.pm = &sony_pic_pm,
+ };
+
+-static struct dmi_system_id __initdata sonypi_dmi_table[] = {
++static const struct dmi_system_id __initconst sonypi_dmi_table[] = {
+ {
+ .ident = "Sony Vaio",
+ .matches = {
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
index e2a91c8..986cc9f 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
@@ -50311,6 +50775,19 @@ index 769d265..a3a05ca 100644
+
+ pax_close_kernel();
}
+diff --git a/drivers/pnp/pnpbios/core.c b/drivers/pnp/pnpbios/core.c
+index 074569e..d807bef 100644
+--- a/drivers/pnp/pnpbios/core.c
++++ b/drivers/pnp/pnpbios/core.c
+@@ -493,7 +493,7 @@ static int __init exploding_pnp_bios(const struct dmi_system_id *d)
+ return 0;
+ }
+
+-static struct dmi_system_id pnpbios_dmi_table[] __initdata = {
++static const struct dmi_system_id pnpbios_dmi_table[] __initconst = {
+ { /* PnPBIOS GPF on boot */
+ .callback = exploding_pnp_bios,
+ .ident = "Higraded P14H",
diff --git a/drivers/pnp/resource.c b/drivers/pnp/resource.c
index bacddd1..65ea100 100644
--- a/drivers/pnp/resource.c
@@ -52844,6 +53321,19 @@ index 04b1be7..5eff86d 100644
tz->get_temp = NULL;
tz->get_trend = NULL;
+diff --git a/drivers/thermal/x86_pkg_temp_thermal.c b/drivers/thermal/x86_pkg_temp_thermal.c
+index 081fd7e..6fb58a2 100644
+--- a/drivers/thermal/x86_pkg_temp_thermal.c
++++ b/drivers/thermal/x86_pkg_temp_thermal.c
+@@ -567,7 +567,7 @@ static int pkg_temp_thermal_cpu_callback(struct notifier_block *nfb,
+ return NOTIFY_OK;
+ }
+
+-static struct notifier_block pkg_temp_thermal_notifier __refdata = {
++static struct notifier_block pkg_temp_thermal_notifier __refconst = {
+ .notifier_call = pkg_temp_thermal_cpu_callback,
+ };
+
diff --git a/drivers/tty/cyclades.c b/drivers/tty/cyclades.c
index a57bb5a..1f727d33 100644
--- a/drivers/tty/cyclades.c
@@ -58381,6 +58871,37 @@ index 88714ae..16c2e11 100644
static inline u32 get_pll_internal_frequency(u32 ref_freq,
+diff --git a/drivers/xen/events/events_base.c b/drivers/xen/events/events_base.c
+index c8860a8..9fec529 100644
+--- a/drivers/xen/events/events_base.c
++++ b/drivers/xen/events/events_base.c
+@@ -1587,7 +1587,7 @@ void xen_irq_resume(void)
+ restore_pirqs();
+ }
+
+-static struct irq_chip xen_dynamic_chip __read_mostly = {
++static struct irq_chip xen_dynamic_chip = {
+ .name = "xen-dyn",
+
+ .irq_disable = disable_dynirq,
+@@ -1601,7 +1601,7 @@ static struct irq_chip xen_dynamic_chip __read_mostly = {
+ .irq_retrigger = retrigger_dynirq,
+ };
+
+-static struct irq_chip xen_pirq_chip __read_mostly = {
++static struct irq_chip xen_pirq_chip = {
+ .name = "xen-pirq",
+
+ .irq_startup = startup_pirq,
+@@ -1621,7 +1621,7 @@ static struct irq_chip xen_pirq_chip __read_mostly = {
+ .irq_retrigger = retrigger_dynirq,
+ };
+
+-static struct irq_chip xen_percpu_chip __read_mostly = {
++static struct irq_chip xen_percpu_chip = {
+ .name = "xen-percpu",
+
+ .irq_disable = disable_dynirq,
diff --git a/drivers/xen/xenfs/xenstored.c b/drivers/xen/xenfs/xenstored.c
index fef20db..d28b1ab 100644
--- a/drivers/xen/xenfs/xenstored.c
@@ -62596,7 +63117,7 @@ index 92567d9..fcd8cbf 100644
if (dot && fs && !(fs->fs_flags & FS_HAS_SUBTYPE)) {
diff --git a/fs/fs_struct.c b/fs/fs_struct.c
-index 7dca743..2f2786d 100644
+index 7dca743..1ff87ae 100644
--- a/fs/fs_struct.c
+++ b/fs/fs_struct.c
@@ -4,6 +4,7 @@
@@ -62665,7 +63186,7 @@ index 7dca743..2f2786d 100644
fs->in_exec = 0;
spin_lock_init(&fs->lock);
seqcount_init(&fs->seq);
-@@ -121,6 +132,9 @@ struct fs_struct *copy_fs_struct(struct fs_struct *old)
+@@ -121,9 +132,13 @@ struct fs_struct *copy_fs_struct(struct fs_struct *old)
spin_lock(&old->lock);
fs->root = old->root;
path_get(&fs->root);
@@ -62675,7 +63196,11 @@ index 7dca743..2f2786d 100644
fs->pwd = old->pwd;
path_get(&fs->pwd);
spin_unlock(&old->lock);
-@@ -139,8 +153,9 @@ int unshare_fs_struct(void)
++ gr_inc_chroot_refcnts(fs->root.dentry, fs->root.mnt);
+ }
+ return fs;
+ }
+@@ -139,8 +154,9 @@ int unshare_fs_struct(void)
task_lock(current);
spin_lock(&fs->lock);
@@ -62686,7 +63211,7 @@ index 7dca743..2f2786d 100644
spin_unlock(&fs->lock);
task_unlock(current);
-@@ -153,13 +168,13 @@ EXPORT_SYMBOL_GPL(unshare_fs_struct);
+@@ -153,13 +169,13 @@ EXPORT_SYMBOL_GPL(unshare_fs_struct);
int current_umask(void)
{
@@ -81853,7 +82378,7 @@ index cdd1cc2..2401b2e 100644
* (asm goto is automatically volatile - the naming reflects this.)
*/
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
-index 2472740..4857634 100644
+index 2472740..73ef938 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -5,11 +5,14 @@
@@ -81979,7 +82504,16 @@ index 2472740..4857634 100644
/* Simple shorthand for a section definition */
#ifndef __section
# define __section(S) __attribute__ ((__section__(#S)))
-@@ -362,7 +428,8 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);
+@@ -302,6 +368,8 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);
+ # define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
+ #endif
+
++#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))
++
+ /* Is this type a native word size -- useful for atomic operations */
+ #ifndef __native_word
+ # define __native_word(t) (sizeof(t) == sizeof(int) || sizeof(t) == sizeof(long))
+@@ -362,7 +430,8 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);
* use is to mediate communication between process-level code and irq/NMI
* handlers, all running on the same CPU.
*/
@@ -85014,6 +85548,19 @@ index 2b58d19..6378966 100644
static inline void mm_init_cpumask(struct mm_struct *mm)
{
+diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h
+index 87079fc..7724b1f 100644
+--- a/include/linux/mmc/core.h
++++ b/include/linux/mmc/core.h
+@@ -79,7 +79,7 @@ struct mmc_command {
+ #define mmc_cmd_type(cmd) ((cmd)->flags & MMC_CMD_MASK)
+
+ unsigned int retries; /* max number of retries */
+- unsigned int error; /* command error */
++ int error; /* command error */
+
+ /*
+ * Standard errno values are used for errors, but some have specific
diff --git a/include/linux/mmiotrace.h b/include/linux/mmiotrace.h
index c5d5278..f0b68c8 100644
--- a/include/linux/mmiotrace.h
@@ -86928,26 +87475,24 @@ index a5ffd32..0935dea 100644
extern dma_addr_t swiotlb_map_page(struct device *dev, struct page *page,
unsigned long offset, size_t size,
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
-index a747a77..9e14df7 100644
+index a747a77..02cf063 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
-@@ -98,8 +98,14 @@ struct sigaltstack;
- #define __MAP(n,...) __MAP##n(__VA_ARGS__)
+@@ -99,7 +99,12 @@ struct sigaltstack;
#define __SC_DECL(t, a) t a
-+#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))
#define __TYPE_IS_LL(t) (__same_type((t)0, 0LL) || __same_type((t)0, 0ULL))
-#define __SC_LONG(t, a) __typeof(__builtin_choose_expr(__TYPE_IS_LL(t), 0LL, 0L)) a
-+#define __SC_LONG(t, a) __typeof( \
++#define __SC_LONG(t, a) __typeof__( \
+ __builtin_choose_expr( \
+ sizeof(t) > sizeof(int), \
+ (t) 0, \
-+ __builtin_choose_expr(__TYPE_IS_U(t), 0UL, 0L) \
++ __builtin_choose_expr(__type_is_unsigned(t), 0UL, 0L) \
+ )) a
#define __SC_CAST(t, a) (t) a
#define __SC_ARGS(t, a) a
#define __SC_TEST(t, a) (void)BUILD_BUG_ON_ZERO(!__TYPE_IS_LL(t) && sizeof(t) > sizeof(long))
-@@ -371,11 +377,11 @@ asmlinkage long sys_sync(void);
+@@ -371,11 +376,11 @@ asmlinkage long sys_sync(void);
asmlinkage long sys_fsync(unsigned int fd);
asmlinkage long sys_fdatasync(unsigned int fd);
asmlinkage long sys_bdflush(int func, long data);
@@ -86963,7 +87508,7 @@ index a747a77..9e14df7 100644
asmlinkage long sys_truncate(const char __user *path, long length);
asmlinkage long sys_ftruncate(unsigned int fd, unsigned long length);
asmlinkage long sys_stat(const char __user *filename,
-@@ -587,7 +593,7 @@ asmlinkage long sys_getsockname(int, struct sockaddr __user *, int __user *);
+@@ -587,7 +592,7 @@ asmlinkage long sys_getsockname(int, struct sockaddr __user *, int __user *);
asmlinkage long sys_getpeername(int, struct sockaddr __user *, int __user *);
asmlinkage long sys_send(int, void __user *, size_t, unsigned);
asmlinkage long sys_sendto(int, void __user *, size_t, unsigned,
@@ -97273,7 +97818,7 @@ index d53adf9..03a24bf 100644
set_fs(old_fs);
diff --git a/mm/madvise.c b/mm/madvise.c
-index a402f8f..f5e5daa 100644
+index a402f8f..1851ab2 100644
--- a/mm/madvise.c
+++ b/mm/madvise.c
@@ -51,6 +51,10 @@ static long madvise_behavior(struct vm_area_struct *vma,
@@ -97326,9 +97871,9 @@ index a402f8f..f5e5daa 100644
+ .nonlinear_vma = vma_m,
+ .last_index = ULONG_MAX,
+ };
-+ zap_page_range(vma, start + SEGMEXEC_TASK_SIZE, end - start, &details);
++ zap_page_range(vma_m, start + SEGMEXEC_TASK_SIZE, end - start, &details);
+ } else
-+ zap_page_range(vma, start + SEGMEXEC_TASK_SIZE, end - start, NULL);
++ zap_page_range(vma_m, start + SEGMEXEC_TASK_SIZE, end - start, NULL);
+ }
+#endif
+
@@ -106283,6 +106828,32 @@ index 7932697..a13d158 100644
} while (!res);
return res;
}
+diff --git a/net/l2tp/l2tp_ip.c b/net/l2tp/l2tp_ip.c
+index 0b44d85..94067b3 100644
+--- a/net/l2tp/l2tp_ip.c
++++ b/net/l2tp/l2tp_ip.c
+@@ -609,7 +609,7 @@ static struct inet_protosw l2tp_ip_protosw = {
+ .no_check = 0,
+ };
+
+-static struct net_protocol l2tp_ip_protocol __read_mostly = {
++static const struct net_protocol l2tp_ip_protocol = {
+ .handler = l2tp_ip_recv,
+ .netns_ok = 1,
+ };
+diff --git a/net/l2tp/l2tp_ip6.c b/net/l2tp/l2tp_ip6.c
+index 7704ea9..7f2b105 100644
+--- a/net/l2tp/l2tp_ip6.c
++++ b/net/l2tp/l2tp_ip6.c
+@@ -764,7 +764,7 @@ static struct inet_protosw l2tp_ip6_protosw = {
+ .no_check = 0,
+ };
+
+-static struct inet6_protocol l2tp_ip6_protocol __read_mostly = {
++static const struct inet6_protocol l2tp_ip6_protocol = {
+ .handler = l2tp_ip6_recv,
+ };
+
diff --git a/net/llc/llc_proc.c b/net/llc/llc_proc.c
index 1a3c7e0..80f8b0c 100644
--- a/net/llc/llc_proc.c
@@ -106995,7 +107566,7 @@ index 108120f..5b169db 100644
queued = 0;
err = 0;
diff --git a/net/netfilter/nft_compat.c b/net/netfilter/nft_compat.c
-index 7350723..c58f861 100644
+index 7350723..af7fa0d 100644
--- a/net/netfilter/nft_compat.c
+++ b/net/netfilter/nft_compat.c
@@ -216,7 +216,7 @@ target_dump_info(struct sk_buff *skb, const struct xt_target *t, const void *in)
@@ -107007,7 +107578,23 @@ index 7350723..c58f861 100644
set_fs(old_fs);
ret = nla_put(skb, NFTA_TARGET_INFO, XT_ALIGN(t->targetsize), out);
kfree(out);
-@@ -403,7 +403,7 @@ match_dump_info(struct sk_buff *skb, const struct xt_match *m, const void *in)
+@@ -283,14 +283,7 @@ static void nft_match_eval(const struct nft_expr *expr,
+ return;
+ }
+
+- switch(ret) {
+- case true:
+- data[NFT_REG_VERDICT].verdict = NFT_CONTINUE;
+- break;
+- case false:
+- data[NFT_REG_VERDICT].verdict = NFT_BREAK;
+- break;
+- }
++ data[NFT_REG_VERDICT].verdict = ret ? NFT_CONTINUE : NFT_BREAK;
+ }
+
+ static const struct nla_policy nft_match_policy[NFTA_MATCH_MAX + 1] = {
+@@ -403,7 +396,7 @@ match_dump_info(struct sk_buff *skb, const struct xt_match *m, const void *in)
/* We want to reuse existing compat_to_user */
old_fs = get_fs();
set_fs(KERNEL_DS);
@@ -109952,7 +110539,7 @@ index 8fac3fd..32ff38d 100644
unsigned int secindex_strings;
diff --git a/security/Kconfig b/security/Kconfig
-index beb86b5..4c193cc 100644
+index beb86b5..86bc440 100644
--- a/security/Kconfig
+++ b/security/Kconfig
@@ -4,6 +4,974 @@
@@ -110270,9 +110857,9 @@ index beb86b5..4c193cc 100644
+ bool 'Use filesystem extended attributes marking'
+ default y if GRKERNSEC_CONFIG_AUTO
+ select CIFS_XATTR if CIFS
-+ select F2FS_FS_XATTR if F2FS_FS
+ select EXT2_FS_XATTR if EXT2_FS
+ select EXT3_FS_XATTR if EXT3_FS
++ select F2FS_FS_XATTR if F2FS_FS
+ select JFFS2_FS_XATTR if JFFS2_FS
+ select REISERFS_FS_XATTR if REISERFS_FS
+ select SQUASHFS_XATTR if SQUASHFS
@@ -112365,7 +112952,7 @@ index 0000000..60e7af2
+randomize_layout_hash.h
diff --git a/tools/gcc/Makefile b/tools/gcc/Makefile
new file mode 100644
-index 0000000..7b8921f
+index 0000000..a51677e
--- /dev/null
+++ b/tools/gcc/Makefile
@@ -0,0 +1,52 @@
@@ -112381,7 +112968,7 @@ index 0000000..7b8921f
+export HOST_EXTRACFLAGS
+else
+HOSTLIBS := hostcxxlibs
-+HOST_EXTRACXXFLAGS += -I$(GCCPLUGINS_DIR)/include -I$(src) -std=gnu++98 -fno-rtti -ggdb -Wno-unused-parameter -Wno-narrowing -Wno-unused-variable
++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
+export HOST_EXTRACXXFLAGS
+endif
+
@@ -113369,10 +113956,10 @@ index 0000000..93b181d
+}
diff --git a/tools/gcc/gcc-common.h b/tools/gcc/gcc-common.h
new file mode 100644
-index 0000000..19fedf2
+index 0000000..d8ec362
--- /dev/null
+++ b/tools/gcc/gcc-common.h
-@@ -0,0 +1,540 @@
+@@ -0,0 +1,666 @@
+#ifndef GCC_COMMON_H_INCLUDED
+#define GCC_COMMON_H_INCLUDED
+
@@ -113695,13 +114282,6 @@ index 0000000..19fedf2
+}
+#endif
+
-+#if BUILDING_GCC_VERSION >= 4007
-+#define cgraph_create_edge(caller, callee, call_stmt, count, freq, nest) \
-+ cgraph_create_edge((caller), (callee), (call_stmt), (count), (freq))
-+#define cgraph_create_edge_including_clones(caller, callee, old_call_stmt, call_stmt, count, freq, nest, reason) \
-+ cgraph_create_edge_including_clones((caller), (callee), (old_call_stmt), (call_stmt), (count), (freq), (reason))
-+#endif
-+
+#if BUILDING_GCC_VERSION == 4007 || BUILDING_GCC_VERSION == 4008
+static inline struct cgraph_node *cgraph_alias_target(struct cgraph_node *n)
+{
@@ -113709,6 +114289,13 @@ index 0000000..19fedf2
+}
+#endif
+
++#if BUILDING_GCC_VERSION >= 4007 && BUILDING_GCC_VERSION <= 4009
++#define cgraph_create_edge(caller, callee, call_stmt, count, freq, nest) \
++ cgraph_create_edge((caller), (callee), (call_stmt), (count), (freq))
++#define cgraph_create_edge_including_clones(caller, callee, old_call_stmt, call_stmt, count, freq, nest, reason) \
++ cgraph_create_edge_including_clones((caller), (callee), (old_call_stmt), (call_stmt), (count), (freq), (reason))
++#endif
++
+#if BUILDING_GCC_VERSION <= 4008
+#define ENTRY_BLOCK_PTR_FOR_FN(FN) ENTRY_BLOCK_PTR_FOR_FUNCTION(FN)
+#define EXIT_BLOCK_PTR_FOR_FN(FN) EXIT_BLOCK_PTR_FOR_FUNCTION(FN)
@@ -113721,6 +114308,40 @@ index 0000000..19fedf2
+#define BASIC_BLOCK_FOR_FN(FN, N) BASIC_BLOCK_FOR_FUNCTION((FN), (N))
+#define NODE_IMPLICIT_ALIAS(node) (node)->same_body_alias
+
++static inline bool tree_fits_shwi_p(const_tree t)
++{
++ if (t == NULL_TREE || TREE_CODE(t) != INTEGER_CST)
++ return false;
++
++ if (TREE_INT_CST_HIGH(t) == 0 && (HOST_WIDE_INT)TREE_INT_CST_LOW(t) >= 0)
++ return true;
++
++ if (TREE_INT_CST_HIGH(t) == -1 && (HOST_WIDE_INT)TREE_INT_CST_LOW(t) < 0 && !TYPE_UNSIGNED(TREE_TYPE(t)))
++ return true;
++
++ return false;
++}
++
++static inline bool tree_fits_uhwi_p(const_tree t)
++{
++ if (t == NULL_TREE || TREE_CODE(t) != INTEGER_CST)
++ return false;
++
++ return TREE_INT_CST_HIGH(t) == 0;
++}
++
++static inline HOST_WIDE_INT tree_to_shwi(const_tree t)
++{
++ gcc_assert(tree_fits_shwi_p(t));
++ return TREE_INT_CST_LOW(t);
++}
++
++static inline unsigned HOST_WIDE_INT tree_to_uhwi(const_tree t)
++{
++ gcc_assert(tree_fits_uhwi_p(t));
++ return TREE_INT_CST_LOW(t);
++}
++
+static inline const char *get_tree_code_name(enum tree_code code)
+{
+ gcc_assert(code < MAX_TREE_CODES);
@@ -113731,6 +114352,7 @@ index 0000000..19fedf2
+typedef union gimple_statement_d gasm;
+typedef union gimple_statement_d gassign;
+typedef union gimple_statement_d gcall;
++typedef union gimple_statement_d gcond;
+typedef union gimple_statement_d gdebug;
+typedef union gimple_statement_d gphi;
+typedef union gimple_statement_d greturn;
@@ -113758,6 +114380,7 @@ index 0000000..19fedf2
+typedef struct gimple_statement_base gasm;
+typedef struct gimple_statement_base gassign;
+typedef struct gimple_statement_base gcall;
++typedef struct gimple_statement_base gcond;
+typedef struct gimple_statement_base gdebug;
+typedef struct gimple_statement_base gphi;
+typedef struct gimple_statement_base greturn;
@@ -113771,15 +114394,50 @@ index 0000000..19fedf2
+ return stmt;
+}
+
++static inline const gasm *as_a_const_gasm(const_gimple stmt)
++{
++ return stmt;
++}
++
++static inline gassign *as_a_gassign(gimple stmt)
++{
++ return stmt;
++}
++
++static inline const gassign *as_a_const_gassign(const_gimple stmt)
++{
++ return stmt;
++}
++
+static inline gcall *as_a_gcall(gimple stmt)
+{
+ return stmt;
+}
+
++static inline const gcall *as_a_const_gcall(const_gimple stmt)
++{
++ return stmt;
++}
++
++static inline gphi *as_a_gphi(gimple stmt)
++{
++ return stmt;
++}
++
++static inline const gphi *as_a_const_gphi(const_gimple stmt)
++{
++ return stmt;
++}
++
+static inline greturn *as_a_greturn(gimple stmt)
+{
+ return stmt;
+}
++
++static inline const greturn *as_a_const_greturn(const_gimple stmt)
++{
++ return stmt;
++}
+#endif
+
+#if BUILDING_GCC_VERSION >= 4009
@@ -113796,17 +114454,23 @@ index 0000000..19fedf2
+#define TODO_verify_stmts TODO_verify_il
+#define TODO_verify_rtl_sharing TODO_verify_il
+
-+#define TREE_INT_CST_HIGH(NODE) ({ TREE_INT_CST_EXT_NUNITS(NODE) > 1 ? (unsigned HOST_WIDE_INT)TREE_INT_CST_ELT(NODE, 1) : 0; })
++//#define TREE_INT_CST_HIGH(NODE) ({ TREE_INT_CST_EXT_NUNITS(NODE) > 1 ? (unsigned HOST_WIDE_INT)TREE_INT_CST_ELT(NODE, 1) : 0; })
+
+#define INSN_DELETED_P(insn) (insn)->deleted()
+
+// symtab/cgraph related
+#define debug_cgraph_node(node) (node)->debug()
+#define cgraph_get_node(decl) cgraph_node::get(decl)
++#define cgraph_get_create_node(decl) cgraph_node::get_create(decl)
+#define cgraph_n_nodes symtab->cgraph_count
+#define cgraph_max_uid symtab->cgraph_max_uid
+#define varpool_get_node(decl) varpool_node::get(decl)
+
++#define cgraph_create_edge(caller, callee, call_stmt, count, freq, nest) \
++ (caller)->create_edge((callee), (call_stmt), (count), (freq))
++#define cgraph_create_edge_including_clones(caller, callee, old_call_stmt, call_stmt, count, freq, nest, reason) \
++ (caller)->create_edge_including_clones((callee), (old_call_stmt), (call_stmt), (count), (freq), (reason))
++
+typedef struct cgraph_node *cgraph_node_ptr;
+typedef struct cgraph_edge *cgraph_edge_p;
+typedef struct varpool_node *varpool_node_ptr;
@@ -113882,26 +114546,70 @@ index 0000000..19fedf2
+ return gimple_build_assign(lhs, subcode, op1, op2 PASS_MEM_STAT);
+}
+
++template <>
++template <>
++inline bool is_a_helper<const gassign *>::test(const_gimple gs)
++{
++ return gs->code == GIMPLE_ASSIGN;
++}
++
++template <>
++template <>
++inline bool is_a_helper<const greturn *>::test(const_gimple gs)
++{
++ return gs->code == GIMPLE_RETURN;
++}
++
+static inline gasm *as_a_gasm(gimple stmt)
+{
+ return as_a<gasm *>(stmt);
+}
+
-+static inline const gasm *as_a_gasm(const_gimple stmt)
++static inline const gasm *as_a_const_gasm(const_gimple stmt)
+{
+ return as_a<const gasm *>(stmt);
+}
+
++static inline gassign *as_a_gassign(gimple stmt)
++{
++ return as_a<gassign *>(stmt);
++}
++
++static inline const gassign *as_a_const_gassign(const_gimple stmt)
++{
++ return as_a<const gassign *>(stmt);
++}
++
+static inline gcall *as_a_gcall(gimple stmt)
+{
+ return as_a<gcall *>(stmt);
+}
+
++static inline const gcall *as_a_const_gcall(const_gimple stmt)
++{
++ return as_a<const gcall *>(stmt);
++}
++
++static inline gphi *as_a_gphi(gimple stmt)
++{
++ return as_a<gphi *>(stmt);
++}
++
++static inline const gphi *as_a_const_gphi(const_gimple stmt)
++{
++ return as_a<const gphi *>(stmt);
++}
++
+static inline greturn *as_a_greturn(gimple stmt)
+{
+ return as_a<greturn *>(stmt);
+}
+
++static inline const greturn *as_a_const_greturn(const_gimple stmt)
++{
++ return as_a<const greturn *>(stmt);
++}
++
+// IPA/LTO related
+#define ipa_ref_list_referring_iterate(L,I,P) (L)->referring.iterate((I), &(P))
+#define ipa_ref_list_reference_iterate(L,I,P) (L)->reference.iterate((I), &(P))
@@ -113910,6 +114618,11 @@ index 0000000..19fedf2
+{
+ return dyn_cast<cgraph_node_ptr>(ref->referring);
+}
++
++static inline void ipa_remove_stmt_references(symtab_node *referring_node, gimple stmt)
++{
++ referring_node->remove_stmt_references(stmt);
++}
+#endif
+
+#endif
@@ -114123,7 +114836,7 @@ index 0000000..457d54e
+}
diff --git a/tools/gcc/kernexec_plugin.c b/tools/gcc/kernexec_plugin.c
new file mode 100644
-index 0000000..71716e7
+index 0000000..b0d8255
--- /dev/null
+++ b/tools/gcc/kernexec_plugin.c
@@ -0,0 +1,547 @@
@@ -114278,9 +114991,9 @@ index 0000000..71716e7
+ new_fptr = make_ssa_name(new_fptr, NULL);
+
+ // build asm volatile("orq %%r12, %0\n\t" : "=r"(new_fptr) : "0"(old_fptr));
-+ input = build_tree_list(NULL_TREE, build_string(1, "0"));
++ input = build_tree_list(NULL_TREE, build_string(2, "0"));
+ input = chainon(NULL_TREE, build_tree_list(input, old_fptr));
-+ output = build_tree_list(NULL_TREE, build_string(2, "=r"));
++ output = build_tree_list(NULL_TREE, build_string(3, "=r"));
+ output = chainon(NULL_TREE, build_tree_list(output, new_fptr));
+#if BUILDING_GCC_VERSION <= 4007
+ VEC_safe_push(tree, gc, inputs, input);
@@ -114676,10 +115389,10 @@ index 0000000..71716e7
+}
diff --git a/tools/gcc/latent_entropy_plugin.c b/tools/gcc/latent_entropy_plugin.c
new file mode 100644
-index 0000000..d383708
+index 0000000..ac6f9b4
--- /dev/null
+++ b/tools/gcc/latent_entropy_plugin.c
-@@ -0,0 +1,473 @@
+@@ -0,0 +1,474 @@
+/*
+ * Copyright 2012-2015 by the PaX Team <pageexec@freemail.hu>
+ * Licensed under the GPL v2
@@ -114698,7 +115411,7 @@ index 0000000..d383708
+ * - more instrumentation control via attribute parameters
+ *
+ * BUGS:
-+ * - LTO needs -flto-partition=none for now
++ * - none known
+ */
+
+#include "gcc-common.h"
@@ -114708,7 +115421,7 @@ index 0000000..d383708
+static GTY(()) tree latent_entropy_decl;
+
+static struct plugin_info latent_entropy_plugin_info = {
-+ .version = "201409101820",
++ .version = "201504282240",
+ .help = NULL
+};
+
@@ -114986,6 +115699,8 @@ index 0000000..d383708
+ FOR_EACH_VARIABLE(node) {
+ tree var = NODE_DECL(node);
+
++ if (DECL_NAME_LENGTH(var) < sizeof("latent_entropy") - 1)
++ continue;
+ if (strcmp(IDENTIFIER_POINTER(DECL_NAME(var)), "latent_entropy"))
+ continue;
+ latent_entropy_decl = var;
@@ -115146,8 +115861,7 @@ index 0000000..d383708
+
+ register_callback(plugin_name, PLUGIN_INFO, NULL, &latent_entropy_plugin_info);
+ register_callback(plugin_name, PLUGIN_START_UNIT, &latent_entropy_start_unit, NULL);
-+ if (!in_lto_p)
-+ register_callback(plugin_name, PLUGIN_REGISTER_GGC_ROOTS, NULL, (void *)&gt_ggc_r_gt_latent_entropy);
++ register_callback(plugin_name, PLUGIN_REGISTER_GGC_ROOTS, NULL, (void *)&gt_ggc_r_gt_latent_entropy);
+ register_callback(plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &latent_entropy_pass_info);
+ register_callback(plugin_name, PLUGIN_ATTRIBUTES, register_attributes, NULL);
+
@@ -120420,10 +121134,10 @@ index 0000000..4378111
+}
diff --git a/tools/gcc/size_overflow_plugin/size_overflow_hash.data b/tools/gcc/size_overflow_plugin/size_overflow_hash.data
new file mode 100644
-index 0000000..f48651d
+index 0000000..f314f81
--- /dev/null
+++ b/tools/gcc/size_overflow_plugin/size_overflow_hash.data
-@@ -0,0 +1,6057 @@
+@@ -0,0 +1,6058 @@
+intel_fake_agp_alloc_by_type_1 intel_fake_agp_alloc_by_type 1 1 NULL
+ocfs2_get_refcount_tree_3 ocfs2_get_refcount_tree 0 3 NULL
+storvsc_connect_to_vsp_22 storvsc_connect_to_vsp 2 22 NULL
@@ -126406,6 +127120,7 @@ index 0000000..f48651d
+__apei_exec_run_64563 __apei_exec_run 0 64563 NULL
+kstrtoul_from_user_64569 kstrtoul_from_user 2 64569 NULL
+do_erase_64574 do_erase 4 64574 NULL
++nla_get_s32_64603 nla_get_s32 0 64603 NULL
+fanotify_write_64623 fanotify_write 3 64623 NULL
+regmap_read_debugfs_64658 regmap_read_debugfs 5 64658 NULL
+ocfs2_read_xattr_block_64661 ocfs2_read_xattr_block 0 64661 NULL nohasharray
@@ -127216,10 +127931,10 @@ index 0000000..0888f6c
+
diff --git a/tools/gcc/stackleak_plugin.c b/tools/gcc/stackleak_plugin.c
new file mode 100644
-index 0000000..51dc09d
+index 0000000..1d296ce
--- /dev/null
+++ b/tools/gcc/stackleak_plugin.c
-@@ -0,0 +1,408 @@
+@@ -0,0 +1,432 @@
+/*
+ * Copyright 2011-2015 by the PaX Team <pageexec@freemail.hu>
+ * Licensed under the GPL v2
@@ -127252,29 +127967,49 @@ index 0000000..51dc09d
+static bool init_locals;
+
+static struct plugin_info stackleak_plugin_info = {
-+ .version = "201408011900",
++ .version = "201504282245",
+ .help = "track-lowest-sp=nn\ttrack sp in functions whose frame size is at least nn bytes\n"
+// "initialize-locals\t\tforcibly initialize all stack frames\n"
+};
+
+static void stackleak_check_alloca(gimple_stmt_iterator *gsi)
+{
-+ gimple check_alloca;
++ gcall *check_alloca;
+ tree alloca_size;
++ cgraph_node_ptr node;
++ int frequency;
++ basic_block bb;
+
+ // insert call to void pax_check_alloca(unsigned long size)
+ alloca_size = gimple_call_arg(gsi_stmt(*gsi), 0);
+ check_alloca = gimple_build_call(check_function_decl, 1, alloca_size);
+ gsi_insert_before(gsi, check_alloca, GSI_SAME_STMT);
++
++ // update the cgraph
++ bb = gimple_bb(check_alloca);
++ node = cgraph_get_create_node(check_function_decl);
++ gcc_assert(node);
++ frequency = compute_call_stmt_bb_frequency(current_function_decl, bb);
++ cgraph_create_edge(cgraph_get_node(current_function_decl), node, check_alloca, bb->count, frequency, bb->loop_depth);
+}
+
+static void stackleak_add_instrumentation(gimple_stmt_iterator *gsi)
+{
-+ gimple track_stack;
++ gcall *track_stack;
++ cgraph_node_ptr node;
++ int frequency;
++ basic_block bb;
+
+ // insert call to void pax_track_stack(void)
+ track_stack = gimple_build_call(track_function_decl, 0);
+ gsi_insert_after(gsi, track_stack, GSI_CONTINUE_LINKING);
++
++ // update the cgraph
++ bb = gimple_bb(track_stack);
++ node = cgraph_get_create_node(track_function_decl);
++ gcc_assert(node);
++ frequency = compute_call_stmt_bb_frequency(current_function_decl, bb);
++ cgraph_create_edge(cgraph_get_node(current_function_decl), node, track_stack, bb->count, frequency, bb->loop_depth);
+}
+
+static bool is_alloca(gimple stmt)
@@ -127429,16 +128164,20 @@ index 0000000..51dc09d
+ track_function_decl = build_fn_decl(track_function, fntype);
+ DECL_ASSEMBLER_NAME(track_function_decl); // for LTO
+ TREE_PUBLIC(track_function_decl) = 1;
++ TREE_USED(track_function_decl) = 1;
+ DECL_EXTERNAL(track_function_decl) = 1;
+ DECL_ARTIFICIAL(track_function_decl) = 1;
++ DECL_PRESERVE_P(track_function_decl) = 1;
+
+ // void pax_check_alloca(unsigned long)
+ fntype = build_function_type_list(void_type_node, long_unsigned_type_node, NULL_TREE);
+ check_function_decl = build_fn_decl(check_function, fntype);
+ DECL_ASSEMBLER_NAME(check_function_decl); // for LTO
+ TREE_PUBLIC(check_function_decl) = 1;
++ TREE_USED(check_function_decl) = 1;
+ DECL_EXTERNAL(check_function_decl) = 1;
+ DECL_ARTIFICIAL(check_function_decl) = 1;
++ DECL_PRESERVE_P(check_function_decl) = 1;
+}
+
+#if BUILDING_GCC_VERSION >= 4009
diff --git a/3.19.6/0000_README b/3.19.6/0000_README
index 725e5d4..db4d6ad 100644
--- a/3.19.6/0000_README
+++ b/3.19.6/0000_README
@@ -6,7 +6,7 @@ Patch: 1005_linux-3.19.6.patch
From: http://www.kernel.org
Desc: Linux 3.19.6
-Patch: 4420_grsecurity-3.1-3.19.6-201504290821.patch
+Patch: 4420_grsecurity-3.1-3.19.6-201504302119.patch
From: http://www.grsecurity.net
Desc: hardened-sources base patch from upstream grsecurity
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
index 68f5d26..8de6fff 100644
--- 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
@@ -20972,7 +20972,7 @@ index c4a8d63..fe893ac 100644
.name = "bigsmp",
.probe = probe_bigsmp,
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
-index 3f5f604..309c0e6 100644
+index 3f5f604..07a35cf 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -1859,7 +1859,7 @@ int native_ioapic_set_affinity(struct irq_data *data,
@@ -20993,6 +20993,24 @@ index 3f5f604..309c0e6 100644
eoi_ioapic_irq(irq, cfg);
}
+@@ -2008,7 +2008,7 @@ static void ack_ioapic_level(struct irq_data *data)
+ ioapic_irqd_unmask(data, cfg, masked);
+ }
+
+-static struct irq_chip ioapic_chip __read_mostly = {
++static struct irq_chip ioapic_chip = {
+ .name = "IO-APIC",
+ .irq_startup = startup_ioapic_irq,
+ .irq_mask = mask_ioapic_irq,
+@@ -2067,7 +2067,7 @@ static void ack_lapic_irq(struct irq_data *data)
+ ack_APIC_irq();
+ }
+
+-static struct irq_chip lapic_chip __read_mostly = {
++static struct irq_chip lapic_chip = {
+ .name = "local-APIC",
+ .irq_mask = mask_lapic_irq,
+ .irq_unmask = unmask_lapic_irq,
diff --git a/arch/x86/kernel/apic/probe_32.c b/arch/x86/kernel/apic/probe_32.c
index bda4886..f9c7195 100644
--- a/arch/x86/kernel/apic/probe_32.c
@@ -21077,7 +21095,7 @@ index 8e9dcfd..c61b3e4 100644
.name = "UV large system",
.probe = uv_probe,
diff --git a/arch/x86/kernel/apm_32.c b/arch/x86/kernel/apm_32.c
-index 927ec92..0dc3bd4 100644
+index 927ec92..de68f32 100644
--- a/arch/x86/kernel/apm_32.c
+++ b/arch/x86/kernel/apm_32.c
@@ -432,7 +432,7 @@ static DEFINE_MUTEX(apm_mutex);
@@ -21135,6 +21153,15 @@ index 927ec92..0dc3bd4 100644
put_cpu();
return error;
}
+@@ -2039,7 +2053,7 @@ static int __init swab_apm_power_in_minutes(const struct dmi_system_id *d)
+ return 0;
+ }
+
+-static struct dmi_system_id __initdata apm_dmi_table[] = {
++static const struct dmi_system_id __initconst apm_dmi_table[] = {
+ {
+ print_if_true,
+ KERN_WARNING "IBM T23 - BIOS 1.03b+ and controller firmware 1.02+ may be needed for Linux APM.",
@@ -2349,12 +2363,15 @@ static int __init apm_init(void)
* code to that CPU.
*/
@@ -27041,7 +27068,7 @@ index 2f355d2..e75ed0a 100644
return ret;
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
-index 86db4bc..531675b 100644
+index 86db4bc..a50a54a 100644
--- a/arch/x86/kernel/reboot.c
+++ b/arch/x86/kernel/reboot.c
@@ -70,6 +70,11 @@ static int __init set_bios_reboot(const struct dmi_system_id *d)
@@ -27087,6 +27114,15 @@ index 86db4bc..531675b 100644
"rm" (real_mode_header->machine_real_restart_asm),
"a" (type));
#else
+@@ -137,7 +164,7 @@ static int __init set_kbd_reboot(const struct dmi_system_id *d)
+ /*
+ * This is a single dmi_table handling all reboot quirks.
+ */
+-static struct dmi_system_id __initdata reboot_dmi_table[] = {
++static const struct dmi_system_id __initconst reboot_dmi_table[] = {
+
+ /* Acer */
+ { /* Handle reboot issue on Acer Aspire one */
@@ -511,7 +538,7 @@ void __attribute__((weak)) mach_reboot_fixups(void)
* This means that this function can never return, it can misbehave
* by not rebooting properly and hanging.
@@ -36511,6 +36547,28 @@ index 9b693d5..8953d54 100644
{
.callback = dmi_disable_osi_vista,
.ident = "Fujitsu Siemens",
+diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
+index 8b67bd0..b59593e 100644
+--- a/drivers/acpi/bus.c
++++ b/drivers/acpi/bus.c
+@@ -67,7 +67,7 @@ static int set_copy_dsdt(const struct dmi_system_id *id)
+ }
+ #endif
+
+-static struct dmi_system_id dsdt_dmi_table[] __initdata = {
++static const struct dmi_system_id dsdt_dmi_table[] __initconst = {
+ /*
+ * Invoke DSDT corruption work-around on all Toshiba Satellite.
+ * https://bugzilla.kernel.org/show_bug.cgi?id=14679
+@@ -83,7 +83,7 @@ static struct dmi_system_id dsdt_dmi_table[] __initdata = {
+ {}
+ };
+ #else
+-static struct dmi_system_id dsdt_dmi_table[] __initdata = {
++static const struct dmi_system_id dsdt_dmi_table[] __initconst = {
+ {}
+ };
+ #endif
diff --git a/drivers/acpi/custom_method.c b/drivers/acpi/custom_method.c
index c68e724..e863008 100644
--- a/drivers/acpi/custom_method.c
@@ -36555,6 +36613,45 @@ index c0d44d3..5ad8f9a 100644
return 0;
}
EXPORT_SYMBOL_GPL(acpi_dev_pm_attach);
+diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
+index 1b5853f..ab1808c 100644
+--- a/drivers/acpi/ec.c
++++ b/drivers/acpi/ec.c
+@@ -1045,7 +1045,7 @@ static int ec_clear_on_resume(const struct dmi_system_id *id)
+ return 0;
+ }
+
+-static struct dmi_system_id ec_dmi_table[] __initdata = {
++static const struct dmi_system_id ec_dmi_table[] __initconst = {
+ {
+ ec_skip_dsdt_scan, "Compal JFL92", {
+ DMI_MATCH(DMI_BIOS_VENDOR, "COMPAL"),
+diff --git a/drivers/acpi/pci_slot.c b/drivers/acpi/pci_slot.c
+index 139d9e4..9a9d799 100644
+--- a/drivers/acpi/pci_slot.c
++++ b/drivers/acpi/pci_slot.c
+@@ -195,7 +195,7 @@ static int do_sta_before_sun(const struct dmi_system_id *d)
+ return 0;
+ }
+
+-static struct dmi_system_id acpi_pci_slot_dmi_table[] __initdata = {
++static const struct dmi_system_id acpi_pci_slot_dmi_table[] __initconst = {
+ /*
+ * Fujitsu Primequest machines will return 1023 to indicate an
+ * error if the _SUN method is evaluated on SxFy objects that
+diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c
+index d9f7158..168e742 100644
+--- a/drivers/acpi/processor_driver.c
++++ b/drivers/acpi/processor_driver.c
+@@ -159,7 +159,7 @@ static int acpi_cpu_soft_notify(struct notifier_block *nfb,
+ return NOTIFY_OK;
+ }
+
+-static struct notifier_block __refdata acpi_cpu_notifier = {
++static struct notifier_block __refconst acpi_cpu_notifier = {
+ .notifier_call = acpi_cpu_soft_notify,
+ };
+
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index b27ab7a..275b1b6 100644
--- a/drivers/acpi/processor_idle.c
@@ -36568,6 +36665,32 @@ index b27ab7a..275b1b6 100644
struct cpuidle_driver *drv = &acpi_idle_driver;
if (!pr->flags.power_setup_done)
+diff --git a/drivers/acpi/processor_pdc.c b/drivers/acpi/processor_pdc.c
+index e5dd808..1eceed1 100644
+--- a/drivers/acpi/processor_pdc.c
++++ b/drivers/acpi/processor_pdc.c
+@@ -176,7 +176,7 @@ static int __init set_no_mwait(const struct dmi_system_id *id)
+ return 0;
+ }
+
+-static struct dmi_system_id processor_idle_dmi_table[] __initdata = {
++static const struct dmi_system_id processor_idle_dmi_table[] __initconst = {
+ {
+ set_no_mwait, "Extensa 5220", {
+ DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies LTD"),
+diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
+index 8aa9254..aeff570 100644
+--- a/drivers/acpi/sleep.c
++++ b/drivers/acpi/sleep.c
+@@ -148,7 +148,7 @@ static int __init init_nvs_nosave(const struct dmi_system_id *d)
+ return 0;
+ }
+
+-static struct dmi_system_id acpisleep_dmi_table[] __initdata = {
++static const struct dmi_system_id acpisleep_dmi_table[] __initconst = {
+ {
+ .callback = init_old_suspend_ordering,
+ .ident = "Abit KN9 (nForce4 variant)",
diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c
index 13e577c..cef11ee 100644
--- a/drivers/acpi/sysfs.c
@@ -36586,6 +36709,32 @@ index 13e577c..cef11ee 100644
static void delete_gpe_attr_array(void)
{
+diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
+index d24fa19..782f1e6 100644
+--- a/drivers/acpi/thermal.c
++++ b/drivers/acpi/thermal.c
+@@ -1209,7 +1209,7 @@ static int thermal_psv(const struct dmi_system_id *d) {
+ return 0;
+ }
+
+-static struct dmi_system_id thermal_dmi_table[] __initdata = {
++static const struct dmi_system_id thermal_dmi_table[] __initconst = {
+ /*
+ * Award BIOS on this AOpen makes thermal control almost worthless.
+ * http://bugzilla.kernel.org/show_bug.cgi?id=8842
+diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
+index 3647ce7..e733107 100644
+--- a/drivers/acpi/video.c
++++ b/drivers/acpi/video.c
+@@ -418,7 +418,7 @@ static int __init video_disable_native_backlight(const struct dmi_system_id *d)
+ return 0;
+ }
+
+-static struct dmi_system_id video_dmi_table[] __initdata = {
++static const struct dmi_system_id video_dmi_table[] __initconst = {
+ /*
+ * Broken _BQC workaround http://bugzilla.kernel.org/show_bug.cgi?id=13121
+ */
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
index 61a9c07..ea98fa1 100644
--- a/drivers/ata/libahci.c
@@ -38766,6 +38915,19 @@ index d5d4cd8..22d561d 100644
struct hpet_info *info)
{
struct hpet_timer __iomem *timer;
+diff --git a/drivers/char/i8k.c b/drivers/char/i8k.c
+index e34a019..842a568 100644
+--- a/drivers/char/i8k.c
++++ b/drivers/char/i8k.c
+@@ -684,7 +684,7 @@ static const struct i8k_config_data i8k_config_data[] = {
+ },
+ };
+
+-static struct dmi_system_id i8k_dmi_table[] __initdata = {
++static const struct dmi_system_id i8k_dmi_table[] __initconst = {
+ {
+ .ident = "Dell Inspiron",
+ .matches = {
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c
index 6b65fa4..8ebbc99 100644
--- a/drivers/char/ipmi/ipmi_msghandler.c
@@ -39132,7 +39294,7 @@ index 9cd6968..6416f00 100644
entropy_count = *(int *)table->data >> ENTROPY_SHIFT;
diff --git a/drivers/char/sonypi.c b/drivers/char/sonypi.c
-index e496dae..b793e7d 100644
+index e496dae..3db53b6 100644
--- a/drivers/char/sonypi.c
+++ b/drivers/char/sonypi.c
@@ -54,6 +54,7 @@
@@ -39173,6 +39335,15 @@ index e496dae..b793e7d 100644
mutex_unlock(&sonypi_device.lock);
return 0;
+@@ -1491,7 +1492,7 @@ static struct platform_driver sonypi_driver = {
+
+ static struct platform_device *sonypi_platform_device;
+
+-static struct dmi_system_id __initdata sonypi_dmi_table[] = {
++static const struct dmi_system_id __initconst sonypi_dmi_table[] = {
+ {
+ .ident = "Sony Vaio",
+ .matches = {
diff --git a/drivers/char/tpm/tpm_acpi.c b/drivers/char/tpm/tpm_acpi.c
index 565a947..dcdc06e 100644
--- a/drivers/char/tpm/tpm_acpi.c
@@ -40247,10 +40418,45 @@ index f256ecd..387dcb1 100644
int error;
/* new_var */
+diff --git a/drivers/firmware/efi/runtime-map.c b/drivers/firmware/efi/runtime-map.c
+index 87b8e3b..c4afb35 100644
+--- a/drivers/firmware/efi/runtime-map.c
++++ b/drivers/firmware/efi/runtime-map.c
+@@ -97,7 +97,7 @@ static void map_release(struct kobject *kobj)
+ kfree(entry);
+ }
+
+-static struct kobj_type __refdata map_ktype = {
++static const struct kobj_type __refconst map_ktype = {
+ .sysfs_ops = &map_attr_ops,
+ .default_attrs = def_attrs,
+ .release = map_release,
+diff --git a/drivers/firmware/google/gsmi.c b/drivers/firmware/google/gsmi.c
+index f1ab05e..ab51228 100644
+--- a/drivers/firmware/google/gsmi.c
++++ b/drivers/firmware/google/gsmi.c
+@@ -709,7 +709,7 @@ static u32 __init hash_oem_table_id(char s[8])
+ return local_hash_64(input, 32);
+ }
+
+-static struct dmi_system_id gsmi_dmi_table[] __initdata = {
++static const struct dmi_system_id gsmi_dmi_table[] __initconst = {
+ {
+ .ident = "Google Board",
+ .matches = {
diff --git a/drivers/firmware/google/memconsole.c b/drivers/firmware/google/memconsole.c
-index 2f569aa..c95f4fb 100644
+index 2f569aa..26e4f39 100644
--- a/drivers/firmware/google/memconsole.c
+++ b/drivers/firmware/google/memconsole.c
+@@ -136,7 +136,7 @@ static bool __init found_memconsole(void)
+ return false;
+ }
+
+-static struct dmi_system_id memconsole_dmi_table[] __initdata = {
++static const struct dmi_system_id memconsole_dmi_table[] __initconst = {
+ {
+ .ident = "Google Board",
+ .matches = {
@@ -155,7 +155,10 @@ static int __init memconsole_init(void)
if (!found_memconsole())
return -ENODEV;
@@ -40263,6 +40469,19 @@ index 2f569aa..c95f4fb 100644
return sysfs_create_bin_file(firmware_kobj, &memconsole_bin_attr);
}
+diff --git a/drivers/firmware/memmap.c b/drivers/firmware/memmap.c
+index cc016c61..d35279e 100644
+--- a/drivers/firmware/memmap.c
++++ b/drivers/firmware/memmap.c
+@@ -124,7 +124,7 @@ static void __meminit release_firmware_map_entry(struct kobject *kobj)
+ kfree(entry);
+ }
+
+-static struct kobj_type __refdata memmap_ktype = {
++static const struct kobj_type __refconst memmap_ktype = {
+ .release = release_firmware_map_entry,
+ .sysfs_ops = &memmap_attr_ops,
+ .default_attrs = def_attrs,
diff --git a/drivers/gpio/gpio-em.c b/drivers/gpio/gpio-em.c
index 3cfcfc6..09d6f117 100644
--- a/drivers/gpio/gpio-em.c
@@ -42127,7 +42346,7 @@ index 4d6b269..2e23b86 100644
child_device_obj->device.bus = &hv_bus;
child_device_obj->device.parent = &hv_acpi_dev->dev;
diff --git a/drivers/hwmon/acpi_power_meter.c b/drivers/hwmon/acpi_power_meter.c
-index 579bdf9..75118b5 100644
+index 579bdf9..0dac21d5 100644
--- a/drivers/hwmon/acpi_power_meter.c
+++ b/drivers/hwmon/acpi_power_meter.c
@@ -116,7 +116,7 @@ struct sensor_template {
@@ -42148,6 +42367,15 @@ index 579bdf9..75118b5 100644
&resource->sensors[resource->num_sensors];
int res = 0;
+@@ -973,7 +973,7 @@ static int __init enable_cap_knobs(const struct dmi_system_id *d)
+ return 0;
+ }
+
+-static struct dmi_system_id __initdata pm_dmi_table[] = {
++static const struct dmi_system_id __initconst pm_dmi_table[] = {
+ {
+ enable_cap_knobs, "IBM Active Energy Manager",
+ {
diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
index 0af63da..05a183a 100644
--- a/drivers/hwmon/applesmc.c
@@ -43530,6 +43758,19 @@ index 71ef5d6..93380a9 100644
kref_init(&serio_raw->kref);
INIT_LIST_HEAD(&serio_raw->client_list);
init_waitqueue_head(&serio_raw->wait);
+diff --git a/drivers/input/touchscreen/htcpen.c b/drivers/input/touchscreen/htcpen.c
+index 92e2243..8fd9092 100644
+--- a/drivers/input/touchscreen/htcpen.c
++++ b/drivers/input/touchscreen/htcpen.c
+@@ -219,7 +219,7 @@ static struct isa_driver htcpen_isa_driver = {
+ }
+ };
+
+-static struct dmi_system_id htcshift_dmi_table[] __initdata = {
++static const struct dmi_system_id htcshift_dmi_table[] __initconst = {
+ {
+ .ident = "Shift",
+ .matches = {
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
index 9802485..2e9941d 100644
--- a/drivers/iommu/amd_iommu.c
@@ -46469,6 +46710,19 @@ index 9a8e185..27ff17d 100644
static char **event_name;
static u8 avg_sample = SAMPLE_16;
+diff --git a/drivers/mfd/kempld-core.c b/drivers/mfd/kempld-core.c
+index 5615522..1eb6f3dc 100644
+--- a/drivers/mfd/kempld-core.c
++++ b/drivers/mfd/kempld-core.c
+@@ -499,7 +499,7 @@ static struct platform_driver kempld_driver = {
+ .remove = kempld_remove,
+ };
+
+-static struct dmi_system_id kempld_dmi_table[] __initdata = {
++static const struct dmi_system_id kempld_dmi_table[] __initconst = {
+ {
+ .ident = "BHL6",
+ .matches = {
diff --git a/drivers/mfd/max8925-i2c.c b/drivers/mfd/max8925-i2c.c
index c880c89..45a7c68 100644
--- a/drivers/mfd/max8925-i2c.c
@@ -48260,6 +48514,19 @@ index 08c483b..2c4a553 100644
}
/* To mask all all interrupts.*/
+diff --git a/drivers/net/ethernet/via/via-rhine.c b/drivers/net/ethernet/via/via-rhine.c
+index a191afc..d218a12 100644
+--- a/drivers/net/ethernet/via/via-rhine.c
++++ b/drivers/net/ethernet/via/via-rhine.c
+@@ -2513,7 +2513,7 @@ static struct platform_driver rhine_driver_platform = {
+ }
+ };
+
+-static struct dmi_system_id rhine_dmi_table[] __initdata = {
++static const struct dmi_system_id rhine_dmi_table[] __initconst = {
+ {
+ .ident = "EPIA-M",
+ .matches = {
diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h
index 384ca4f..dd7d4f9 100644
--- a/drivers/net/hyperv/hyperv_net.h
@@ -49998,6 +50265,19 @@ index e1e7026..d28dd33 100644
#define ASPM_STATE_L0S (ASPM_STATE_L0S_UP | ASPM_STATE_L0S_DW)
#define ASPM_STATE_ALL (ASPM_STATE_L0S | ASPM_STATE_L1)
+diff --git a/drivers/pci/pcie/portdrv_pci.c b/drivers/pci/pcie/portdrv_pci.c
+index be35da2..ec16cdb 100644
+--- a/drivers/pci/pcie/portdrv_pci.c
++++ b/drivers/pci/pcie/portdrv_pci.c
+@@ -324,7 +324,7 @@ static int __init dmi_pcie_pme_disable_msi(const struct dmi_system_id *d)
+ return 0;
+ }
+
+-static struct dmi_system_id __initdata pcie_portdrv_dmi_table[] = {
++static const struct dmi_system_id __initconst pcie_portdrv_dmi_table[] = {
+ /*
+ * Boxes that should not use MSI for PCIe PME signaling.
+ */
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 23212f8..65e945b 100644
--- a/drivers/pci/probe.c
@@ -50045,6 +50325,19 @@ index b84fdd6..b89d829 100644
{
.ident = "Samsung Series 5 550",
.matches = {
+diff --git a/drivers/platform/chrome/chromeos_pstore.c b/drivers/platform/chrome/chromeos_pstore.c
+index 3474920..acc9581 100644
+--- a/drivers/platform/chrome/chromeos_pstore.c
++++ b/drivers/platform/chrome/chromeos_pstore.c
+@@ -13,7 +13,7 @@
+ #include <linux/platform_device.h>
+ #include <linux/pstore_ram.h>
+
+-static struct dmi_system_id chromeos_pstore_dmi_table[] __initdata = {
++static const struct dmi_system_id chromeos_pstore_dmi_table[] __initconst = {
+ {
+ /*
+ * Today all Chromebooks/boxes ship with Google_* as version and
diff --git a/drivers/platform/x86/alienware-wmi.c b/drivers/platform/x86/alienware-wmi.c
index 1e1e594..8fe59c5 100644
--- a/drivers/platform/x86/alienware-wmi.c
@@ -50104,10 +50397,71 @@ index 7543a56..367ca8ed 100644
status = wmi_evaluate_method(ASUS_WMI_MGMT_GUID,
1, asus->debug.method_id,
&input, &output);
+diff --git a/drivers/platform/x86/compal-laptop.c b/drivers/platform/x86/compal-laptop.c
+index 15c0fab..f674006 100644
+--- a/drivers/platform/x86/compal-laptop.c
++++ b/drivers/platform/x86/compal-laptop.c
+@@ -766,7 +766,7 @@ static int dmi_check_cb_extra(const struct dmi_system_id *id)
+ return 1;
+ }
+
+-static struct dmi_system_id __initdata compal_dmi_table[] = {
++static const struct dmi_system_id __initconst compal_dmi_table[] = {
+ {
+ .ident = "FL90/IFL90",
+ .matches = {
+diff --git a/drivers/platform/x86/hdaps.c b/drivers/platform/x86/hdaps.c
+index 458e6c9..089aee7 100644
+--- a/drivers/platform/x86/hdaps.c
++++ b/drivers/platform/x86/hdaps.c
+@@ -514,7 +514,7 @@ static int __init hdaps_dmi_match_invert(const struct dmi_system_id *id)
+ "ThinkPad T42p", so the order of the entries matters.
+ If your ThinkPad is not recognized, please update to latest
+ BIOS. This is especially the case for some R52 ThinkPads. */
+-static struct dmi_system_id __initdata hdaps_whitelist[] = {
++static const struct dmi_system_id __initconst hdaps_whitelist[] = {
+ HDAPS_DMI_MATCH_INVERT("IBM", "ThinkPad R50p", HDAPS_BOTH_AXES),
+ HDAPS_DMI_MATCH_NORMAL("IBM", "ThinkPad R50"),
+ HDAPS_DMI_MATCH_NORMAL("IBM", "ThinkPad R51"),
+diff --git a/drivers/platform/x86/ibm_rtl.c b/drivers/platform/x86/ibm_rtl.c
+index 97c2be1..2ee50ce 100644
+--- a/drivers/platform/x86/ibm_rtl.c
++++ b/drivers/platform/x86/ibm_rtl.c
+@@ -227,7 +227,7 @@ static void rtl_teardown_sysfs(void) {
+ }
+
+
+-static struct dmi_system_id __initdata ibm_rtl_dmi_table[] = {
++static const struct dmi_system_id __initconst ibm_rtl_dmi_table[] = {
+ { \
+ .matches = { \
+ DMI_MATCH(DMI_SYS_VENDOR, "IBM"), \
+diff --git a/drivers/platform/x86/intel_oaktrail.c b/drivers/platform/x86/intel_oaktrail.c
+index a4a4258..a58a04c 100644
+--- a/drivers/platform/x86/intel_oaktrail.c
++++ b/drivers/platform/x86/intel_oaktrail.c
+@@ -298,7 +298,7 @@ static int dmi_check_cb(const struct dmi_system_id *id)
+ return 0;
+ }
+
+-static struct dmi_system_id __initdata oaktrail_dmi_table[] = {
++static const struct dmi_system_id __initconst oaktrail_dmi_table[] = {
+ {
+ .ident = "OakTrail platform",
+ .matches = {
diff --git a/drivers/platform/x86/msi-laptop.c b/drivers/platform/x86/msi-laptop.c
-index 0859877..1cf7d08 100644
+index 0859877..59d596d 100644
--- a/drivers/platform/x86/msi-laptop.c
+++ b/drivers/platform/x86/msi-laptop.c
+@@ -604,7 +604,7 @@ static int dmi_check_cb(const struct dmi_system_id *dmi)
+ return 1;
+ }
+
+-static struct dmi_system_id __initdata msi_dmi_table[] = {
++static const struct dmi_system_id __initconst msi_dmi_table[] = {
+ {
+ .ident = "MSI S270",
+ .matches = {
@@ -999,12 +999,14 @@ static int __init load_scm_model_init(struct platform_device *sdev)
if (!quirks->ec_read_only) {
@@ -50142,8 +50496,34 @@ index 6d2bac0..ec2b029 100644
union acpi_object *obj;
acpi_status status;
+diff --git a/drivers/platform/x86/samsung-laptop.c b/drivers/platform/x86/samsung-laptop.c
+index ce364a4..5074643 100644
+--- a/drivers/platform/x86/samsung-laptop.c
++++ b/drivers/platform/x86/samsung-laptop.c
+@@ -1465,7 +1465,7 @@ static int __init samsung_dmi_matched(const struct dmi_system_id *d)
+ return 0;
+ }
+
+-static struct dmi_system_id __initdata samsung_dmi_table[] = {
++static const struct dmi_system_id __initconst samsung_dmi_table[] = {
+ {
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR,
+diff --git a/drivers/platform/x86/samsung-q10.c b/drivers/platform/x86/samsung-q10.c
+index e6aac72..e11ff24 100644
+--- a/drivers/platform/x86/samsung-q10.c
++++ b/drivers/platform/x86/samsung-q10.c
+@@ -95,7 +95,7 @@ static int __init dmi_check_callback(const struct dmi_system_id *id)
+ return 1;
+ }
+
+-static struct dmi_system_id __initdata samsungq10_dmi_table[] = {
++static const struct dmi_system_id __initconst samsungq10_dmi_table[] = {
+ {
+ .ident = "Samsung Q10",
+ .matches = {
diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c
-index 6dd1c0e..5d602c7 100644
+index 6dd1c0e..78b9f0a 100644
--- a/drivers/platform/x86/sony-laptop.c
+++ b/drivers/platform/x86/sony-laptop.c
@@ -2526,7 +2526,7 @@ static void sony_nc_gfx_switch_cleanup(struct platform_device *pd)
@@ -50200,6 +50580,15 @@ index 6dd1c0e..5d602c7 100644
static ssize_t sony_nc_smart_conn_store(struct device *dev,
struct device_attribute *attr,
+@@ -4854,7 +4854,7 @@ static struct acpi_driver sony_pic_driver = {
+ .drv.pm = &sony_pic_pm,
+ };
+
+-static struct dmi_system_id __initdata sonypi_dmi_table[] = {
++static const struct dmi_system_id __initconst sonypi_dmi_table[] = {
+ {
+ .ident = "Sony Vaio",
+ .matches = {
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
index c3d11fa..f83cded 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
@@ -50285,6 +50674,19 @@ index 438d4c7..ca8a2fb 100644
+
+ pax_close_kernel();
}
+diff --git a/drivers/pnp/pnpbios/core.c b/drivers/pnp/pnpbios/core.c
+index 074569e..d807bef 100644
+--- a/drivers/pnp/pnpbios/core.c
++++ b/drivers/pnp/pnpbios/core.c
+@@ -493,7 +493,7 @@ static int __init exploding_pnp_bios(const struct dmi_system_id *d)
+ return 0;
+ }
+
+-static struct dmi_system_id pnpbios_dmi_table[] __initdata = {
++static const struct dmi_system_id pnpbios_dmi_table[] __initconst = {
+ { /* PnPBIOS GPF on boot */
+ .callback = exploding_pnp_bios,
+ .ident = "Higraded P14H",
diff --git a/drivers/power/pda_power.c b/drivers/power/pda_power.c
index 0c52e2a..3421ab7 100644
--- a/drivers/power/pda_power.c
@@ -52527,6 +52929,19 @@ index d717f3d..cae1cc3e 100644
tz->ops = NULL;
tz->sensor_data = NULL;
+diff --git a/drivers/thermal/x86_pkg_temp_thermal.c b/drivers/thermal/x86_pkg_temp_thermal.c
+index 9ea3d9d..53e8792 100644
+--- a/drivers/thermal/x86_pkg_temp_thermal.c
++++ b/drivers/thermal/x86_pkg_temp_thermal.c
+@@ -567,7 +567,7 @@ static int pkg_temp_thermal_cpu_callback(struct notifier_block *nfb,
+ return NOTIFY_OK;
+ }
+
+-static struct notifier_block pkg_temp_thermal_notifier __refdata = {
++static struct notifier_block pkg_temp_thermal_notifier __refconst = {
+ .notifier_call = pkg_temp_thermal_cpu_callback,
+ };
+
diff --git a/drivers/tty/cyclades.c b/drivers/tty/cyclades.c
index fd66f57..48e6376 100644
--- a/drivers/tty/cyclades.c
@@ -58114,6 +58529,37 @@ index 3c14e43..2630570 100644
+4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
+4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
+4 4 4 4 4 4
+diff --git a/drivers/xen/events/events_base.c b/drivers/xen/events/events_base.c
+index 70fba97..8ec7f86 100644
+--- a/drivers/xen/events/events_base.c
++++ b/drivers/xen/events/events_base.c
+@@ -1563,7 +1563,7 @@ void xen_irq_resume(void)
+ restore_pirqs();
+ }
+
+-static struct irq_chip xen_dynamic_chip __read_mostly = {
++static struct irq_chip xen_dynamic_chip = {
+ .name = "xen-dyn",
+
+ .irq_disable = disable_dynirq,
+@@ -1577,7 +1577,7 @@ static struct irq_chip xen_dynamic_chip __read_mostly = {
+ .irq_retrigger = retrigger_dynirq,
+ };
+
+-static struct irq_chip xen_pirq_chip __read_mostly = {
++static struct irq_chip xen_pirq_chip = {
+ .name = "xen-pirq",
+
+ .irq_startup = startup_pirq,
+@@ -1597,7 +1597,7 @@ static struct irq_chip xen_pirq_chip __read_mostly = {
+ .irq_retrigger = retrigger_dynirq,
+ };
+
+-static struct irq_chip xen_percpu_chip __read_mostly = {
++static struct irq_chip xen_percpu_chip = {
+ .name = "xen-percpu",
+
+ .irq_disable = disable_dynirq,
diff --git a/drivers/xen/xenfs/xenstored.c b/drivers/xen/xenfs/xenstored.c
index fef20db..d28b1ab 100644
--- a/drivers/xen/xenfs/xenstored.c
@@ -62052,7 +62498,7 @@ index 5797d45..7d7d79a 100644
if (dot && fs && !(fs->fs_flags & FS_HAS_SUBTYPE)) {
diff --git a/fs/fs_struct.c b/fs/fs_struct.c
-index 7dca743..2f2786d 100644
+index 7dca743..1ff87ae 100644
--- a/fs/fs_struct.c
+++ b/fs/fs_struct.c
@@ -4,6 +4,7 @@
@@ -62121,7 +62567,7 @@ index 7dca743..2f2786d 100644
fs->in_exec = 0;
spin_lock_init(&fs->lock);
seqcount_init(&fs->seq);
-@@ -121,6 +132,9 @@ struct fs_struct *copy_fs_struct(struct fs_struct *old)
+@@ -121,9 +132,13 @@ struct fs_struct *copy_fs_struct(struct fs_struct *old)
spin_lock(&old->lock);
fs->root = old->root;
path_get(&fs->root);
@@ -62131,7 +62577,11 @@ index 7dca743..2f2786d 100644
fs->pwd = old->pwd;
path_get(&fs->pwd);
spin_unlock(&old->lock);
-@@ -139,8 +153,9 @@ int unshare_fs_struct(void)
++ gr_inc_chroot_refcnts(fs->root.dentry, fs->root.mnt);
+ }
+ return fs;
+ }
+@@ -139,8 +154,9 @@ int unshare_fs_struct(void)
task_lock(current);
spin_lock(&fs->lock);
@@ -62142,7 +62592,7 @@ index 7dca743..2f2786d 100644
spin_unlock(&fs->lock);
task_unlock(current);
-@@ -153,13 +168,13 @@ EXPORT_SYMBOL_GPL(unshare_fs_struct);
+@@ -153,13 +169,13 @@ EXPORT_SYMBOL_GPL(unshare_fs_struct);
int current_umask(void)
{
@@ -80455,10 +80905,10 @@ index d1a5582..4424efa 100644
* Mark a position in code as unreachable. This can be used to
* suppress control flow warnings after asm blocks that transfer
diff --git a/include/linux/compiler-gcc5.h b/include/linux/compiler-gcc5.h
-index c8c5659..2401b2e 100644
+index c8c5659..9b20f4e 100644
--- a/include/linux/compiler-gcc5.h
+++ b/include/linux/compiler-gcc5.h
-@@ -28,6 +28,26 @@
+@@ -28,6 +28,25 @@
# define __compiletime_error(message) __attribute__((error(message)))
#endif /* __CHECKER__ */
@@ -80473,7 +80923,6 @@ index c8c5659..2401b2e 100644
+#endif
+
+#ifdef SIZE_OVERFLOW_PLUGIN
-+#error not yet
+#define __size_overflow(...) __attribute__((size_overflow(__VA_ARGS__)))
+#define __intentional_overflow(...) __attribute__((intentional_overflow(__VA_ARGS__)))
+#endif
@@ -104662,6 +105111,32 @@ index 781b3a2..73a7434 100644
kfree_skb(skb);
}
+diff --git a/net/l2tp/l2tp_ip.c b/net/l2tp/l2tp_ip.c
+index 05dfc8aa..df6cfd7 100644
+--- a/net/l2tp/l2tp_ip.c
++++ b/net/l2tp/l2tp_ip.c
+@@ -608,7 +608,7 @@ static struct inet_protosw l2tp_ip_protosw = {
+ .ops = &l2tp_ip_ops,
+ };
+
+-static struct net_protocol l2tp_ip_protocol __read_mostly = {
++static const struct net_protocol l2tp_ip_protocol = {
+ .handler = l2tp_ip_recv,
+ .netns_ok = 1,
+ };
+diff --git a/net/l2tp/l2tp_ip6.c b/net/l2tp/l2tp_ip6.c
+index 8611f1b..bc60a2d 100644
+--- a/net/l2tp/l2tp_ip6.c
++++ b/net/l2tp/l2tp_ip6.c
+@@ -757,7 +757,7 @@ static struct inet_protosw l2tp_ip6_protosw = {
+ .ops = &l2tp_ip6_ops,
+ };
+
+-static struct inet6_protocol l2tp_ip6_protocol __read_mostly = {
++static const struct inet6_protocol l2tp_ip6_protocol = {
+ .handler = l2tp_ip6_recv,
+ };
+
diff --git a/net/llc/llc_proc.c b/net/llc/llc_proc.c
index 1a3c7e0..80f8b0c 100644
--- a/net/llc/llc_proc.c
@@ -110456,7 +110931,7 @@ index 0000000..de92ed9
+randomize_layout_seed.h
diff --git a/tools/gcc/Makefile b/tools/gcc/Makefile
new file mode 100644
-index 0000000..7b8921f
+index 0000000..a51677e
--- /dev/null
+++ b/tools/gcc/Makefile
@@ -0,0 +1,52 @@
@@ -110472,7 +110947,7 @@ index 0000000..7b8921f
+export HOST_EXTRACFLAGS
+else
+HOSTLIBS := hostcxxlibs
-+HOST_EXTRACXXFLAGS += -I$(GCCPLUGINS_DIR)/include -I$(src) -std=gnu++98 -fno-rtti -ggdb -Wno-unused-parameter -Wno-narrowing -Wno-unused-variable
++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
+export HOST_EXTRACXXFLAGS
+endif
+
@@ -111460,10 +111935,10 @@ index 0000000..93b181d
+}
diff --git a/tools/gcc/gcc-common.h b/tools/gcc/gcc-common.h
new file mode 100644
-index 0000000..19fedf2
+index 0000000..d8ec362
--- /dev/null
+++ b/tools/gcc/gcc-common.h
-@@ -0,0 +1,540 @@
+@@ -0,0 +1,666 @@
+#ifndef GCC_COMMON_H_INCLUDED
+#define GCC_COMMON_H_INCLUDED
+
@@ -111786,13 +112261,6 @@ index 0000000..19fedf2
+}
+#endif
+
-+#if BUILDING_GCC_VERSION >= 4007
-+#define cgraph_create_edge(caller, callee, call_stmt, count, freq, nest) \
-+ cgraph_create_edge((caller), (callee), (call_stmt), (count), (freq))
-+#define cgraph_create_edge_including_clones(caller, callee, old_call_stmt, call_stmt, count, freq, nest, reason) \
-+ cgraph_create_edge_including_clones((caller), (callee), (old_call_stmt), (call_stmt), (count), (freq), (reason))
-+#endif
-+
+#if BUILDING_GCC_VERSION == 4007 || BUILDING_GCC_VERSION == 4008
+static inline struct cgraph_node *cgraph_alias_target(struct cgraph_node *n)
+{
@@ -111800,6 +112268,13 @@ index 0000000..19fedf2
+}
+#endif
+
++#if BUILDING_GCC_VERSION >= 4007 && BUILDING_GCC_VERSION <= 4009
++#define cgraph_create_edge(caller, callee, call_stmt, count, freq, nest) \
++ cgraph_create_edge((caller), (callee), (call_stmt), (count), (freq))
++#define cgraph_create_edge_including_clones(caller, callee, old_call_stmt, call_stmt, count, freq, nest, reason) \
++ cgraph_create_edge_including_clones((caller), (callee), (old_call_stmt), (call_stmt), (count), (freq), (reason))
++#endif
++
+#if BUILDING_GCC_VERSION <= 4008
+#define ENTRY_BLOCK_PTR_FOR_FN(FN) ENTRY_BLOCK_PTR_FOR_FUNCTION(FN)
+#define EXIT_BLOCK_PTR_FOR_FN(FN) EXIT_BLOCK_PTR_FOR_FUNCTION(FN)
@@ -111812,6 +112287,40 @@ index 0000000..19fedf2
+#define BASIC_BLOCK_FOR_FN(FN, N) BASIC_BLOCK_FOR_FUNCTION((FN), (N))
+#define NODE_IMPLICIT_ALIAS(node) (node)->same_body_alias
+
++static inline bool tree_fits_shwi_p(const_tree t)
++{
++ if (t == NULL_TREE || TREE_CODE(t) != INTEGER_CST)
++ return false;
++
++ if (TREE_INT_CST_HIGH(t) == 0 && (HOST_WIDE_INT)TREE_INT_CST_LOW(t) >= 0)
++ return true;
++
++ if (TREE_INT_CST_HIGH(t) == -1 && (HOST_WIDE_INT)TREE_INT_CST_LOW(t) < 0 && !TYPE_UNSIGNED(TREE_TYPE(t)))
++ return true;
++
++ return false;
++}
++
++static inline bool tree_fits_uhwi_p(const_tree t)
++{
++ if (t == NULL_TREE || TREE_CODE(t) != INTEGER_CST)
++ return false;
++
++ return TREE_INT_CST_HIGH(t) == 0;
++}
++
++static inline HOST_WIDE_INT tree_to_shwi(const_tree t)
++{
++ gcc_assert(tree_fits_shwi_p(t));
++ return TREE_INT_CST_LOW(t);
++}
++
++static inline unsigned HOST_WIDE_INT tree_to_uhwi(const_tree t)
++{
++ gcc_assert(tree_fits_uhwi_p(t));
++ return TREE_INT_CST_LOW(t);
++}
++
+static inline const char *get_tree_code_name(enum tree_code code)
+{
+ gcc_assert(code < MAX_TREE_CODES);
@@ -111822,6 +112331,7 @@ index 0000000..19fedf2
+typedef union gimple_statement_d gasm;
+typedef union gimple_statement_d gassign;
+typedef union gimple_statement_d gcall;
++typedef union gimple_statement_d gcond;
+typedef union gimple_statement_d gdebug;
+typedef union gimple_statement_d gphi;
+typedef union gimple_statement_d greturn;
@@ -111849,6 +112359,7 @@ index 0000000..19fedf2
+typedef struct gimple_statement_base gasm;
+typedef struct gimple_statement_base gassign;
+typedef struct gimple_statement_base gcall;
++typedef struct gimple_statement_base gcond;
+typedef struct gimple_statement_base gdebug;
+typedef struct gimple_statement_base gphi;
+typedef struct gimple_statement_base greturn;
@@ -111862,15 +112373,50 @@ index 0000000..19fedf2
+ return stmt;
+}
+
++static inline const gasm *as_a_const_gasm(const_gimple stmt)
++{
++ return stmt;
++}
++
++static inline gassign *as_a_gassign(gimple stmt)
++{
++ return stmt;
++}
++
++static inline const gassign *as_a_const_gassign(const_gimple stmt)
++{
++ return stmt;
++}
++
+static inline gcall *as_a_gcall(gimple stmt)
+{
+ return stmt;
+}
+
++static inline const gcall *as_a_const_gcall(const_gimple stmt)
++{
++ return stmt;
++}
++
++static inline gphi *as_a_gphi(gimple stmt)
++{
++ return stmt;
++}
++
++static inline const gphi *as_a_const_gphi(const_gimple stmt)
++{
++ return stmt;
++}
++
+static inline greturn *as_a_greturn(gimple stmt)
+{
+ return stmt;
+}
++
++static inline const greturn *as_a_const_greturn(const_gimple stmt)
++{
++ return stmt;
++}
+#endif
+
+#if BUILDING_GCC_VERSION >= 4009
@@ -111887,17 +112433,23 @@ index 0000000..19fedf2
+#define TODO_verify_stmts TODO_verify_il
+#define TODO_verify_rtl_sharing TODO_verify_il
+
-+#define TREE_INT_CST_HIGH(NODE) ({ TREE_INT_CST_EXT_NUNITS(NODE) > 1 ? (unsigned HOST_WIDE_INT)TREE_INT_CST_ELT(NODE, 1) : 0; })
++//#define TREE_INT_CST_HIGH(NODE) ({ TREE_INT_CST_EXT_NUNITS(NODE) > 1 ? (unsigned HOST_WIDE_INT)TREE_INT_CST_ELT(NODE, 1) : 0; })
+
+#define INSN_DELETED_P(insn) (insn)->deleted()
+
+// symtab/cgraph related
+#define debug_cgraph_node(node) (node)->debug()
+#define cgraph_get_node(decl) cgraph_node::get(decl)
++#define cgraph_get_create_node(decl) cgraph_node::get_create(decl)
+#define cgraph_n_nodes symtab->cgraph_count
+#define cgraph_max_uid symtab->cgraph_max_uid
+#define varpool_get_node(decl) varpool_node::get(decl)
+
++#define cgraph_create_edge(caller, callee, call_stmt, count, freq, nest) \
++ (caller)->create_edge((callee), (call_stmt), (count), (freq))
++#define cgraph_create_edge_including_clones(caller, callee, old_call_stmt, call_stmt, count, freq, nest, reason) \
++ (caller)->create_edge_including_clones((callee), (old_call_stmt), (call_stmt), (count), (freq), (reason))
++
+typedef struct cgraph_node *cgraph_node_ptr;
+typedef struct cgraph_edge *cgraph_edge_p;
+typedef struct varpool_node *varpool_node_ptr;
@@ -111973,26 +112525,70 @@ index 0000000..19fedf2
+ return gimple_build_assign(lhs, subcode, op1, op2 PASS_MEM_STAT);
+}
+
++template <>
++template <>
++inline bool is_a_helper<const gassign *>::test(const_gimple gs)
++{
++ return gs->code == GIMPLE_ASSIGN;
++}
++
++template <>
++template <>
++inline bool is_a_helper<const greturn *>::test(const_gimple gs)
++{
++ return gs->code == GIMPLE_RETURN;
++}
++
+static inline gasm *as_a_gasm(gimple stmt)
+{
+ return as_a<gasm *>(stmt);
+}
+
-+static inline const gasm *as_a_gasm(const_gimple stmt)
++static inline const gasm *as_a_const_gasm(const_gimple stmt)
+{
+ return as_a<const gasm *>(stmt);
+}
+
++static inline gassign *as_a_gassign(gimple stmt)
++{
++ return as_a<gassign *>(stmt);
++}
++
++static inline const gassign *as_a_const_gassign(const_gimple stmt)
++{
++ return as_a<const gassign *>(stmt);
++}
++
+static inline gcall *as_a_gcall(gimple stmt)
+{
+ return as_a<gcall *>(stmt);
+}
+
++static inline const gcall *as_a_const_gcall(const_gimple stmt)
++{
++ return as_a<const gcall *>(stmt);
++}
++
++static inline gphi *as_a_gphi(gimple stmt)
++{
++ return as_a<gphi *>(stmt);
++}
++
++static inline const gphi *as_a_const_gphi(const_gimple stmt)
++{
++ return as_a<const gphi *>(stmt);
++}
++
+static inline greturn *as_a_greturn(gimple stmt)
+{
+ return as_a<greturn *>(stmt);
+}
+
++static inline const greturn *as_a_const_greturn(const_gimple stmt)
++{
++ return as_a<const greturn *>(stmt);
++}
++
+// IPA/LTO related
+#define ipa_ref_list_referring_iterate(L,I,P) (L)->referring.iterate((I), &(P))
+#define ipa_ref_list_reference_iterate(L,I,P) (L)->reference.iterate((I), &(P))
@@ -112001,6 +112597,11 @@ index 0000000..19fedf2
+{
+ return dyn_cast<cgraph_node_ptr>(ref->referring);
+}
++
++static inline void ipa_remove_stmt_references(symtab_node *referring_node, gimple stmt)
++{
++ referring_node->remove_stmt_references(stmt);
++}
+#endif
+
+#endif
@@ -112214,7 +112815,7 @@ index 0000000..457d54e
+}
diff --git a/tools/gcc/kernexec_plugin.c b/tools/gcc/kernexec_plugin.c
new file mode 100644
-index 0000000..71716e7
+index 0000000..b0d8255
--- /dev/null
+++ b/tools/gcc/kernexec_plugin.c
@@ -0,0 +1,547 @@
@@ -112369,9 +112970,9 @@ index 0000000..71716e7
+ new_fptr = make_ssa_name(new_fptr, NULL);
+
+ // build asm volatile("orq %%r12, %0\n\t" : "=r"(new_fptr) : "0"(old_fptr));
-+ input = build_tree_list(NULL_TREE, build_string(1, "0"));
++ input = build_tree_list(NULL_TREE, build_string(2, "0"));
+ input = chainon(NULL_TREE, build_tree_list(input, old_fptr));
-+ output = build_tree_list(NULL_TREE, build_string(2, "=r"));
++ output = build_tree_list(NULL_TREE, build_string(3, "=r"));
+ output = chainon(NULL_TREE, build_tree_list(output, new_fptr));
+#if BUILDING_GCC_VERSION <= 4007
+ VEC_safe_push(tree, gc, inputs, input);
@@ -112767,10 +113368,10 @@ index 0000000..71716e7
+}
diff --git a/tools/gcc/latent_entropy_plugin.c b/tools/gcc/latent_entropy_plugin.c
new file mode 100644
-index 0000000..d383708
+index 0000000..ac6f9b4
--- /dev/null
+++ b/tools/gcc/latent_entropy_plugin.c
-@@ -0,0 +1,473 @@
+@@ -0,0 +1,474 @@
+/*
+ * Copyright 2012-2015 by the PaX Team <pageexec@freemail.hu>
+ * Licensed under the GPL v2
@@ -112789,7 +113390,7 @@ index 0000000..d383708
+ * - more instrumentation control via attribute parameters
+ *
+ * BUGS:
-+ * - LTO needs -flto-partition=none for now
++ * - none known
+ */
+
+#include "gcc-common.h"
@@ -112799,7 +113400,7 @@ index 0000000..d383708
+static GTY(()) tree latent_entropy_decl;
+
+static struct plugin_info latent_entropy_plugin_info = {
-+ .version = "201409101820",
++ .version = "201504282240",
+ .help = NULL
+};
+
@@ -113077,6 +113678,8 @@ index 0000000..d383708
+ FOR_EACH_VARIABLE(node) {
+ tree var = NODE_DECL(node);
+
++ if (DECL_NAME_LENGTH(var) < sizeof("latent_entropy") - 1)
++ continue;
+ if (strcmp(IDENTIFIER_POINTER(DECL_NAME(var)), "latent_entropy"))
+ continue;
+ latent_entropy_decl = var;
@@ -113237,8 +113840,7 @@ index 0000000..d383708
+
+ register_callback(plugin_name, PLUGIN_INFO, NULL, &latent_entropy_plugin_info);
+ register_callback(plugin_name, PLUGIN_START_UNIT, &latent_entropy_start_unit, NULL);
-+ if (!in_lto_p)
-+ register_callback(plugin_name, PLUGIN_REGISTER_GGC_ROOTS, NULL, (void *)&gt_ggc_r_gt_latent_entropy);
++ register_callback(plugin_name, PLUGIN_REGISTER_GGC_ROOTS, NULL, (void *)&gt_ggc_r_gt_latent_entropy);
+ register_callback(plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &latent_entropy_pass_info);
+ register_callback(plugin_name, PLUGIN_ATTRIBUTES, register_attributes, NULL);
+
@@ -114312,10 +114914,10 @@ index 0000000..12b1e3b
+exit 0
diff --git a/tools/gcc/size_overflow_plugin/insert_size_overflow_asm.c b/tools/gcc/size_overflow_plugin/insert_size_overflow_asm.c
new file mode 100644
-index 0000000..493fe76
+index 0000000..0b508b1
--- /dev/null
+++ b/tools/gcc/size_overflow_plugin/insert_size_overflow_asm.c
-@@ -0,0 +1,404 @@
+@@ -0,0 +1,409 @@
+/*
+ * Copyright 2011-2015 by Emese Revfy <re.emese@gmail.com>
+ * Licensed under the GPL v2, or (at your option) v3
@@ -114426,7 +115028,7 @@ index 0000000..493fe76
+{
+ char *asm_comment;
+ const char *mark_str;
-+ gimple asm_stmt;
++ gasm *asm_stmt;
+ gimple_stmt_iterator gsi;
+ tree str_input, str_output;
+#if BUILDING_GCC_VERSION <= 4007
@@ -114476,7 +115078,7 @@ index 0000000..493fe76
+ switch (gimple_code(stmt)) {
+ case GIMPLE_RETURN:
+ gcc_assert(argnum == 0);
-+ return gimple_return_retval(stmt);
++ return gimple_return_retval(as_a_greturn(stmt));
+ case GIMPLE_CALL:
+ gcc_assert(argnum != 0);
+ gcc_assert(gimple_call_num_args(stmt) >= argnum);
@@ -114489,7 +115091,7 @@ index 0000000..493fe76
+
+static tree get_so_asm_input(struct asm_data *asm_data)
+{
-+ gimple assign;
++ gassign *assign;
+ tree output_type, new_var;
+ gimple_stmt_iterator gsi;
+
@@ -114517,7 +115119,7 @@ index 0000000..493fe76
+ gimple_call_set_arg(asm_data->target_stmt, asm_data->argnum - 1, asm_data->output);
+ break;
+ case GIMPLE_RETURN:
-+ gimple_return_set_retval(asm_data->target_stmt, asm_data->output);
++ gimple_return_set_retval(as_a_greturn(asm_data->target_stmt), asm_data->output);
+ break;
+ default:
+ debug_gimple_stmt(asm_data->target_stmt);
@@ -114583,7 +115185,7 @@ index 0000000..493fe76
+
+ gcc_assert(attr);
+ for (attr_value = TREE_VALUE(attr); attr_value; attr_value = TREE_CHAIN(attr_value)) {
-+ argnum = TREE_INT_CST_LOW(TREE_VALUE(attr_value));
++ argnum = (unsigned int)tree_to_uhwi(TREE_VALUE(attr_value));
+ argnums[argnum] = true;
+ }
+}
@@ -114609,7 +115211,7 @@ index 0000000..493fe76
+ return mark;
+}
+
-+static void handle_size_overflow_attr_ret(gimple stmt)
++static void handle_size_overflow_attr_ret(greturn *stmt)
+{
+ enum intentional_mark mark;
+ bool orig_argnums[MAX_PARAM + 1] = {false};
@@ -114622,7 +115224,7 @@ index 0000000..493fe76
+}
+
+// If the argument(s) of the callee function are marked by an attribute then mark the call stmt with an asm stmt
-+static void handle_size_overflow_attr_call(gimple stmt)
++static void handle_size_overflow_attr_call(gcall *stmt)
+{
+ tree fndecl;
+ unsigned int argnum;
@@ -114656,9 +115258,9 @@ index 0000000..493fe76
+ gimple stmt = gsi_stmt(gsi);
+
+ if (is_gimple_call(stmt))
-+ handle_size_overflow_attr_call(stmt);
++ handle_size_overflow_attr_call(as_a_gcall(stmt));
+ else if (gimple_code(stmt) == GIMPLE_RETURN)
-+ handle_size_overflow_attr_ret(stmt);
++ handle_size_overflow_attr_ret(as_a_greturn(stmt));
+ }
+ }
+ return 0;
@@ -114680,7 +115282,8 @@ index 0000000..493fe76
+#if BUILDING_GCC_VERSION >= 4008
+ .optinfo_flags = OPTGROUP_NONE,
+#endif
-+#if BUILDING_GCC_VERSION >= 4009
++#if BUILDING_GCC_VERSION >= 5000
++#elif BUILDING_GCC_VERSION >= 4009
+ .has_gate = false,
+ .has_execute = true,
+#else
@@ -114706,7 +115309,11 @@ index 0000000..493fe76
+class insert_size_overflow_asm_pass : public gimple_opt_pass {
+public:
+ insert_size_overflow_asm_pass() : gimple_opt_pass(insert_size_overflow_asm_pass_data, g) {}
++#if BUILDING_GCC_VERSION >= 5000
++ virtual unsigned int execute(function *) { return search_interesting_functions(); }
++#else
+ unsigned int execute() { return search_interesting_functions(); }
++#endif
+};
+}
+
@@ -114722,10 +115329,10 @@ index 0000000..493fe76
+#endif
diff --git a/tools/gcc/size_overflow_plugin/intentional_overflow.c b/tools/gcc/size_overflow_plugin/intentional_overflow.c
new file mode 100644
-index 0000000..7f645dc
+index 0000000..d96cef2
--- /dev/null
+++ b/tools/gcc/size_overflow_plugin/intentional_overflow.c
-@@ -0,0 +1,951 @@
+@@ -0,0 +1,955 @@
+/*
+ * Copyright 2011-2015 by Emese Revfy <re.emese@gmail.com>
+ * Licensed under the GPL v2, or (at your option) v3
@@ -114747,25 +115354,22 @@ index 0000000..7f645dc
+
+#include "size_overflow.h"
+
-+static enum intentional_mark walk_use_def(struct pointer_set_t *visited, const_tree lhs);
++static enum intentional_mark walk_use_def(gimple_set *visited, const_tree lhs);
+
-+static const char *get_asm_string(const_gimple stmt)
++static const char *get_asm_string(const gasm *stmt)
+{
-+ if (!stmt)
-+ return NULL;
-+ if (gimple_code(stmt) != GIMPLE_ASM)
-+ return NULL;
-+
-+ return gimple_asm_string(stmt);
++ if (stmt)
++ return gimple_asm_string(stmt);
++ return NULL;
+}
+
-+tree get_size_overflow_asm_input(const_gimple stmt)
++tree get_size_overflow_asm_input(const gasm *stmt)
+{
+ gcc_assert(gimple_asm_ninputs(stmt) != 0);
+ return TREE_VALUE(gimple_asm_input_op(stmt, 0));
+}
+
-+bool is_size_overflow_insert_check_asm(const_gimple stmt)
++bool is_size_overflow_insert_check_asm(const gasm *stmt)
+{
+ const char *str;
+
@@ -114787,13 +115391,13 @@ index 0000000..7f645dc
+ if (gimple_code(stmt) != GIMPLE_ASM)
+ return false;
+
-+ str = get_asm_string(stmt);
++ str = get_asm_string(as_a_const_gasm(stmt));
+ if (!str)
+ return false;
+ return !strncmp(str, SO_ASM_STR, sizeof(SO_ASM_STR) - 1);
+}
+
-+static bool is_size_overflow_intentional_asm_turn_off(const_gimple stmt)
++static bool is_size_overflow_intentional_asm_turn_off(const gasm *stmt)
+{
+ const char *str;
+
@@ -114806,7 +115410,7 @@ index 0000000..7f645dc
+ return !strncmp(str, TURN_OFF_ASM_STR, sizeof(TURN_OFF_ASM_STR) - 1);
+}
+
-+static bool is_size_overflow_intentional_asm_end(const_gimple stmt)
++static bool is_size_overflow_intentional_asm_end(const gasm *stmt)
+{
+ const char *str;
+
@@ -114846,7 +115450,7 @@ index 0000000..7f645dc
+ if (param_head == NULL_TREE)
+ return false;
+
-+ if (TREE_INT_CST_HIGH(TREE_VALUE(param_head)) == -1)
++ if (tree_to_shwi(TREE_VALUE(param_head)) == -1)
+ return true;
+ return false;
+}
@@ -114860,7 +115464,7 @@ index 0000000..7f645dc
+ if (param_head == NULL_TREE)
+ return false;
+
-+ if (!TREE_INT_CST_LOW(TREE_VALUE(param_head)))
++ if (tree_to_shwi(TREE_VALUE(param_head)) == 0)
+ return true;
+ return false;
+}
@@ -114874,9 +115478,14 @@ index 0000000..7f645dc
+ return false;
+
+ param_head = get_attribute_param(decl);
-+ for (param = param_head; param; param = TREE_CHAIN(param))
-+ if (argnum == TREE_INT_CST_LOW(TREE_VALUE(param)))
++ for (param = param_head; param; param = TREE_CHAIN(param)) {
++ int argval = tree_to_shwi(TREE_VALUE(param));
++
++ if (argval <= 0)
++ continue;
++ if (argnum == (unsigned int)argval)
+ return true;
++ }
+ return false;
+}
+
@@ -114962,10 +115571,10 @@ index 0000000..7f645dc
+ return MARK_NO;
+}
+
-+static enum intentional_mark walk_use_def_phi(struct pointer_set_t *visited, const_tree result)
++static enum intentional_mark walk_use_def_phi(gimple_set *visited, const_tree result)
+{
+ enum intentional_mark mark = MARK_NO;
-+ gimple phi = get_def_stmt(result);
++ gphi *phi = as_a_gphi(get_def_stmt(result));
+ unsigned int i, n = gimple_phi_num_args(phi);
+
+ pointer_set_insert(visited, phi);
@@ -114980,11 +115589,11 @@ index 0000000..7f645dc
+ return mark;
+}
+
-+static enum intentional_mark walk_use_def_binary(struct pointer_set_t *visited, const_tree lhs)
++static enum intentional_mark walk_use_def_binary(gimple_set *visited, const_tree lhs)
+{
+ enum intentional_mark mark;
+ tree rhs1, rhs2;
-+ gimple def_stmt = get_def_stmt(lhs);
++ gassign *def_stmt = as_a_gassign(get_def_stmt(lhs));
+
+ rhs1 = gimple_assign_rhs1(def_stmt);
+ rhs2 = gimple_assign_rhs2(def_stmt);
@@ -114997,20 +115606,24 @@ index 0000000..7f645dc
+
+enum intentional_mark get_so_asm_type(const_gimple stmt)
+{
++ const gasm *asm_stmt;
++
+ if (!stmt)
+ return MARK_NO;
+ if (!is_size_overflow_asm(stmt))
+ return MARK_NO;
-+ if (is_size_overflow_insert_check_asm(stmt))
++
++ asm_stmt = as_a_const_gasm(stmt);
++ if (is_size_overflow_insert_check_asm(asm_stmt))
+ return MARK_NO;
-+ if (is_size_overflow_intentional_asm_turn_off(stmt))
++ if (is_size_overflow_intentional_asm_turn_off(asm_stmt))
+ return MARK_TURN_OFF;
-+ if (is_size_overflow_intentional_asm_end(stmt))
++ if (is_size_overflow_intentional_asm_end(asm_stmt))
+ return MARK_END_INTENTIONAL;
+ return MARK_YES;
+}
+
-+static enum intentional_mark walk_use_def(struct pointer_set_t *visited, const_tree lhs)
++static enum intentional_mark walk_use_def(gimple_set *visited, const_tree lhs)
+{
+ const_gimple def_stmt;
+
@@ -115030,7 +115643,7 @@ index 0000000..7f645dc
+ case GIMPLE_NOP:
+ return walk_use_def(visited, SSA_NAME_VAR(lhs));
+ case GIMPLE_ASM:
-+ return get_so_asm_type(def_stmt);
++ return get_so_asm_type(as_a_const_gasm(def_stmt));
+ case GIMPLE_PHI:
+ return walk_use_def_phi(visited, lhs);
+ case GIMPLE_ASSIGN:
@@ -115050,7 +115663,7 @@ index 0000000..7f645dc
+static enum intentional_mark check_intentional_size_overflow_asm_and_attribute(const_tree var)
+{
+ enum intentional_mark mark;
-+ struct pointer_set_t *visited;
++ gimple_set *visited;
+
+ visited = pointer_set_create();
+ mark = walk_use_def(visited, var);
@@ -115098,7 +115711,7 @@ index 0000000..7f645dc
+ if (is_end_intentional_intentional_attr(orig_cur_fndecl))
+ return MARK_END_INTENTIONAL;
+
-+ fndecl = get_interesting_orig_fndecl_from_stmt(stmt);
++ fndecl = get_interesting_orig_fndecl_from_stmt(as_a_const_gcall(stmt));
+ // handle MARK_TURN_OFF on the callee
+ if (is_turn_off_intentional_attr(fndecl))
+ return MARK_TURN_OFF;
@@ -115154,7 +115767,7 @@ index 0000000..7f645dc
+ switch (gimple_code(stmt)) {
+ case GIMPLE_RETURN:
+ gcc_assert(argnum == 0);
-+ arg = gimple_return_retval(stmt);
++ arg = gimple_return_retval(as_a_const_greturn(stmt));
+ break;
+ case GIMPLE_CALL:
+ gcc_assert(argnum != 0);
@@ -115162,8 +115775,8 @@ index 0000000..7f645dc
+ arg = gimple_call_arg(stmt, argnum - 1);
+ break;
+ case GIMPLE_ASM:
-+ gcc_assert(is_size_overflow_insert_check_asm(stmt));
-+ arg = get_size_overflow_asm_input(stmt);
++ gcc_assert(is_size_overflow_insert_check_asm(as_a_const_gasm(stmt)));
++ arg = get_size_overflow_asm_input(as_a_const_gasm(stmt));
+ break;
+ default:
+ debug_gimple_stmt((gimple)stmt);
@@ -115302,7 +115915,7 @@ index 0000000..7f645dc
+ return false;
+}
+
-+bool is_a_constant_overflow(const_gimple stmt, const_tree rhs)
++bool is_a_constant_overflow(const gassign *stmt, const_tree rhs)
+{
+ if (gimple_assign_rhs_code(stmt) == MIN_EXPR)
+ return false;
@@ -115316,20 +115929,18 @@ index 0000000..7f645dc
+ return true;
+}
+
-+static tree change_assign_rhs(struct visited *visited, gimple stmt, const_tree orig_rhs, tree new_rhs)
++static tree change_assign_rhs(struct visited *visited, gassign *stmt, const_tree orig_rhs, tree new_rhs)
+{
-+ gimple assign;
++ const_gimple assign;
+ gimple_stmt_iterator gsi = gsi_for_stmt(stmt);
+ tree origtype = TREE_TYPE(orig_rhs);
+
-+ gcc_assert(is_gimple_assign(stmt));
-+
+ assign = build_cast_stmt(visited, origtype, new_rhs, CREATE_NEW_VAR, &gsi, BEFORE_STMT, false);
+ pointer_set_insert(visited->my_stmts, assign);
-+ return gimple_assign_lhs(assign);
++ return get_lhs(assign);
+}
+
-+tree handle_intentional_overflow(struct visited *visited, bool check_overflow, gimple stmt, tree change_rhs, tree new_rhs2)
++tree handle_intentional_overflow(struct visited *visited, bool check_overflow, gassign *stmt, tree change_rhs, tree new_rhs2)
+{
+ tree new_rhs, orig_rhs;
+ void (*gimple_assign_set_rhs)(gimple, tree);
@@ -115360,7 +115971,7 @@ index 0000000..7f645dc
+ return create_assign(visited, stmt, lhs, AFTER_STMT);
+}
+
-+static bool is_subtraction_special(struct visited *visited, const_gimple stmt)
++static bool is_subtraction_special(struct visited *visited, const gassign *stmt)
+{
+ gimple rhs1_def_stmt, rhs2_def_stmt;
+ const_tree rhs1_def_stmt_rhs1, rhs2_def_stmt_rhs1, rhs1_def_stmt_lhs, rhs2_def_stmt_lhs;
@@ -115399,15 +116010,15 @@ index 0000000..7f645dc
+ return true;
+}
+
-+static gimple create_binary_assign(struct visited *visited, enum tree_code code, gimple stmt, tree rhs1, tree rhs2)
++static gassign *create_binary_assign(struct visited *visited, enum tree_code code, gassign *stmt, tree rhs1, tree rhs2)
+{
-+ gimple assign;
++ gassign *assign;
+ gimple_stmt_iterator gsi = gsi_for_stmt(stmt);
+ tree type = TREE_TYPE(rhs1);
+ tree lhs = create_new_var(type);
+
+ gcc_assert(types_compatible_p(type, TREE_TYPE(rhs2)));
-+ assign = gimple_build_assign_with_ops(code, lhs, rhs1, rhs2);
++ assign = as_a_gassign(gimple_build_assign_with_ops(code, lhs, rhs1, rhs2));
+ gimple_assign_set_lhs(assign, make_ssa_name(lhs, assign));
+
+ gsi_insert_before(&gsi, assign, GSI_NEW_STMT);
@@ -115416,10 +116027,10 @@ index 0000000..7f645dc
+ return assign;
+}
+
-+static tree cast_to_TI_type(struct visited *visited, gimple stmt, tree node)
++static tree cast_to_TI_type(struct visited *visited, gassign *stmt, tree node)
+{
+ gimple_stmt_iterator gsi;
-+ gimple cast_stmt;
++ const_gimple cast_stmt;
+ tree type = TREE_TYPE(node);
+
+ if (types_compatible_p(type, intTI_type_node))
@@ -115428,7 +116039,7 @@ index 0000000..7f645dc
+ gsi = gsi_for_stmt(stmt);
+ cast_stmt = build_cast_stmt(visited, intTI_type_node, node, CREATE_NEW_VAR, &gsi, BEFORE_STMT, false);
+ pointer_set_insert(visited->my_stmts, cast_stmt);
-+ return gimple_assign_lhs(cast_stmt);
++ return get_lhs(cast_stmt);
+}
+
+static tree get_def_stmt_rhs(struct visited *visited, const_tree var)
@@ -115467,7 +116078,7 @@ index 0000000..7f645dc
+{
+ tree new_rhs1, new_rhs2;
+ tree new_rhs1_def_stmt_rhs1, new_rhs2_def_stmt_rhs1, new_lhs;
-+ gimple assign, stmt = get_def_stmt(lhs);
++ gassign *assign, *stmt = as_a_gassign(get_def_stmt(lhs));
+ tree rhs1 = gimple_assign_rhs1(stmt);
+ tree rhs2 = gimple_assign_rhs2(stmt);
+
@@ -115495,7 +116106,7 @@ index 0000000..7f645dc
+ return dup_assign(visited, stmt, lhs, new_rhs1, new_rhs2, NULL_TREE);
+}
+
-+bool is_a_neg_overflow(const_gimple stmt, const_tree rhs)
++bool is_a_neg_overflow(const gassign *stmt, const_tree rhs)
+{
+ const_gimple def_stmt;
+
@@ -115561,7 +116172,7 @@ index 0000000..7f645dc
+ return true;
+}
+
-+enum intentional_overflow_type add_mul_intentional_overflow(const_gimple stmt)
++enum intentional_overflow_type add_mul_intentional_overflow(const gassign *stmt)
+{
+ const_gimple def_stmt_1, def_stmt_2;
+ const_tree rhs1, rhs2;
@@ -115582,13 +116193,13 @@ index 0000000..7f645dc
+ return NO_INTENTIONAL_OVERFLOW;
+}
+
-+static gimple get_dup_stmt(struct visited *visited, gimple stmt)
++static gassign *get_dup_stmt(struct visited *visited, gassign *stmt)
+{
-+ gimple my_stmt;
++ gassign *my_stmt;
+ gimple_stmt_iterator gsi = gsi_for_stmt(stmt);
+
+ gsi_next(&gsi);
-+ my_stmt = gsi_stmt(gsi);
++ my_stmt = as_a_gassign(gsi_stmt(gsi));
+
+ gcc_assert(pointer_set_contains(visited->my_stmts, my_stmt));
+ if (gimple_assign_rhs_code(stmt) != gimple_assign_rhs_code(my_stmt)) {
@@ -115639,10 +116250,10 @@ index 0000000..7f645dc
+ return is_call_or_cast(def_stmt);
+}
+
-+void unsigned_signed_cast_intentional_overflow(struct visited *visited, gimple stmt)
++void unsigned_signed_cast_intentional_overflow(struct visited *visited, gassign *stmt)
+{
+ unsigned int use_num;
-+ gimple so_stmt;
++ gassign *so_stmt;
+ const_gimple def_stmt;
+ const_tree rhs1, rhs2;
+ tree rhs = gimple_assign_rhs1(stmt);
@@ -115679,10 +116290,10 @@ index 0000000..7f645dc
+
diff --git a/tools/gcc/size_overflow_plugin/misc.c b/tools/gcc/size_overflow_plugin/misc.c
new file mode 100644
-index 0000000..69059ca
+index 0000000..c1b4773
--- /dev/null
+++ b/tools/gcc/size_overflow_plugin/misc.c
-@@ -0,0 +1,426 @@
+@@ -0,0 +1,441 @@
+/*
+ * Copyright 2011-2015 by Emese Revfy <re.emese@gmail.com>
+ * Licensed under the GPL v2, or (at your option) v3
@@ -115832,7 +116443,8 @@ index 0000000..69059ca
+
+gimple build_cast_stmt(struct visited *visited, tree dst_type, tree rhs, tree lhs, gimple_stmt_iterator *gsi, bool before, bool force)
+{
-+ gimple assign, def_stmt;
++ gassign *assign;
++ gimple def_stmt;
+
+ gcc_assert(dst_type != NULL_TREE && rhs != NULL_TREE);
+ gcc_assert(!is_gimple_constant(rhs));
@@ -116051,14 +116663,14 @@ index 0000000..69059ca
+ return (tree)clone_fndecl;
+}
+
-+static tree get_interesting_fndecl_from_stmt(const_gimple stmt)
++static tree get_interesting_fndecl_from_stmt(const gcall *stmt)
+{
+ if (gimple_call_num_args(stmt) == 0)
+ return NULL_TREE;
+ return gimple_call_fndecl(stmt);
+}
+
-+tree get_interesting_orig_fndecl_from_stmt(const_gimple stmt)
++tree get_interesting_orig_fndecl_from_stmt(const gcall *stmt)
+{
+ tree fndecl;
+
@@ -116109,9 +116721,23 @@ index 0000000..69059ca
+ return true;
+}
+
++tree get_lhs(const_gimple stmt)
++{
++ switch (gimple_code(stmt)) {
++ case GIMPLE_ASSIGN:
++ case GIMPLE_CALL:
++ return gimple_get_lhs(stmt);
++ case GIMPLE_PHI:
++ return gimple_phi_result(stmt);
++ default:
++ debug_gimple_stmt((gimple)stmt);
++ gcc_unreachable();
++ }
++}
++
diff --git a/tools/gcc/size_overflow_plugin/remove_unnecessary_dup.c b/tools/gcc/size_overflow_plugin/remove_unnecessary_dup.c
new file mode 100644
-index 0000000..c955c6b
+index 0000000..5622b51
--- /dev/null
+++ b/tools/gcc/size_overflow_plugin/remove_unnecessary_dup.c
@@ -0,0 +1,137 @@
@@ -116136,7 +116762,7 @@ index 0000000..c955c6b
+
+#include "size_overflow.h"
+
-+bool skip_expr_on_double_type(const_gimple stmt)
++bool skip_expr_on_double_type(const gassign *stmt)
+{
+ enum tree_code code = gimple_assign_rhs_code(stmt);
+
@@ -116158,19 +116784,19 @@ index 0000000..c955c6b
+ }
+}
+
-+void create_up_and_down_cast(struct visited *visited, gimple use_stmt, tree orig_type, tree rhs)
++void create_up_and_down_cast(struct visited *visited, gassign *use_stmt, tree orig_type, tree rhs)
+{
+ const_tree orig_rhs1;
+ tree down_lhs, new_lhs, dup_type = TREE_TYPE(rhs);
-+ gimple down_cast, up_cast;
++ const_gimple down_cast, up_cast;
+ gimple_stmt_iterator gsi = gsi_for_stmt(use_stmt);
+
+ down_cast = build_cast_stmt(visited, orig_type, rhs, CREATE_NEW_VAR, &gsi, BEFORE_STMT, false);
-+ down_lhs = gimple_assign_lhs(down_cast);
++ down_lhs = get_lhs(down_cast);
+
+ gsi = gsi_for_stmt(use_stmt);
+ up_cast = build_cast_stmt(visited, dup_type, down_lhs, CREATE_NEW_VAR, &gsi, BEFORE_STMT, false);
-+ new_lhs = gimple_assign_lhs(up_cast);
++ new_lhs = get_lhs(up_cast);
+
+ orig_rhs1 = gimple_assign_rhs1(use_stmt);
+ if (operand_equal_p(orig_rhs1, rhs, 0))
@@ -116214,7 +116840,7 @@ index 0000000..c955c6b
+ return new_type;
+}
+
-+static void insert_cast_rhs(struct visited *visited, gimple stmt, tree rhs)
++static void insert_cast_rhs(struct visited *visited, gassign *stmt, tree rhs)
+{
+ tree type;
+
@@ -116229,7 +116855,7 @@ index 0000000..c955c6b
+ create_up_and_down_cast(visited, stmt, type, rhs);
+}
+
-+static void insert_cast(struct visited *visited, gimple stmt, tree rhs)
++static void insert_cast(struct visited *visited, gassign *stmt, tree rhs)
+{
+ if (LONG_TYPE_SIZE == GET_MODE_BITSIZE(SImode) && !is_size_overflow_type(rhs))
+ return;
@@ -116237,7 +116863,7 @@ index 0000000..c955c6b
+ insert_cast_rhs(visited, stmt, rhs);
+}
+
-+void insert_cast_expr(struct visited *visited, gimple stmt, enum intentional_overflow_type type)
++void insert_cast_expr(struct visited *visited, gassign *stmt, enum intentional_overflow_type type)
+{
+ tree rhs1, rhs2;
+
@@ -116254,10 +116880,10 @@ index 0000000..c955c6b
+
diff --git a/tools/gcc/size_overflow_plugin/size_overflow.h b/tools/gcc/size_overflow_plugin/size_overflow.h
new file mode 100644
-index 0000000..516289f
+index 0000000..07e2ba7
--- /dev/null
+++ b/tools/gcc/size_overflow_plugin/size_overflow.h
-@@ -0,0 +1,226 @@
+@@ -0,0 +1,281 @@
+#ifndef SIZE_OVERFLOW_H
+#define SIZE_OVERFLOW_H
+
@@ -116308,13 +116934,6 @@ index 0000000..516289f
+ const char *fn_name;
+};
+
-+struct visited {
-+ struct pointer_set_t *stmts;
-+ struct pointer_set_t *my_stmts;
-+ struct pointer_set_t *skip_expr_casts;
-+ struct pointer_set_t *no_cast_check;
-+};
-+
+struct next_interesting_function;
+typedef struct next_interesting_function * next_interesting_function_t;
+
@@ -116323,6 +116942,67 @@ index 0000000..516289f
+DEF_VEC_ALLOC_P(next_interesting_function_t, heap);
+#endif
+
++#if BUILDING_GCC_VERSION >= 5000
++typedef struct hash_set<const_gimple> gimple_set;
++
++static inline bool pointer_set_insert(gimple_set *visited, const_gimple stmt)
++{
++ return visited->add(stmt);
++}
++
++static inline bool pointer_set_contains(gimple_set *visited, const_gimple stmt)
++{
++ return visited->contains(stmt);
++}
++
++static inline gimple_set* pointer_set_create(void)
++{
++ return new hash_set<const_gimple>;
++}
++
++static inline void pointer_set_destroy(gimple_set *visited)
++{
++ delete visited;
++}
++
++typedef struct hash_set<next_interesting_function_t> next_interesting_function_set;
++
++static inline bool pointer_set_insert(next_interesting_function_set *visited, next_interesting_function_t node)
++{
++ return visited->add(node);
++}
++
++static inline bool pointer_set_contains(next_interesting_function_set *visited, next_interesting_function_t node)
++{
++ return visited->contains(node);
++}
++
++static inline next_interesting_function_set *next_interesting_function_pointer_set_create(void)
++{
++ return new hash_set<next_interesting_function_t>;
++}
++
++static inline void pointer_set_destroy(next_interesting_function_set *visited)
++{
++ delete visited;
++}
++#else
++typedef struct pointer_set_t gimple_set;
++typedef struct pointer_set_t next_interesting_function_set;
++
++static inline next_interesting_function_set *next_interesting_function_pointer_set_create(void)
++{
++ return pointer_set_create();
++}
++#endif
++
++struct visited {
++ gimple_set *stmts;
++ gimple_set *my_stmts;
++ gimple_set *skip_expr_casts;
++ gimple_set *no_cast_check;
++};
++
+/*
+ * * children: callers with data flow into the integer parameter of decl
+ * * decl_name: name of the function or the field
@@ -116348,11 +117028,11 @@ index 0000000..516289f
+};
+
+// size_overflow_plugin.c
-+extern GTY(()) tree report_size_overflow_decl;
-+extern GTY(()) tree size_overflow_type_HI;
-+extern GTY(()) tree size_overflow_type_SI;
-+extern GTY(()) tree size_overflow_type_DI;
-+extern GTY(()) tree size_overflow_type_TI;
++extern tree report_size_overflow_decl;
++extern tree size_overflow_type_HI;
++extern tree size_overflow_type_SI;
++extern tree size_overflow_type_DI;
++extern tree size_overflow_type_TI;
+
+
+// size_overflow_plugin_hash.c
@@ -116372,20 +117052,20 @@ index 0000000..516289f
+
+
+// intentional_overflow.c
-+extern tree get_size_overflow_asm_input(const_gimple stmt);
++extern tree get_size_overflow_asm_input(const gasm *stmt);
+extern enum intentional_mark check_intentional_asm(const_gimple stmt, unsigned int argnum);
-+extern bool is_size_overflow_insert_check_asm(const_gimple stmt);
++extern bool is_size_overflow_insert_check_asm(const gasm *stmt);
+extern enum intentional_mark check_intentional_attribute(const_gimple stmt, unsigned int argnum);
+extern enum intentional_mark get_so_asm_type(const_gimple stmt);
+extern const_tree get_attribute(const char* attr_name, const_tree decl);
+extern bool is_a_cast_and_const_overflow(const_tree no_const_rhs);
+extern bool is_const_plus_unsigned_signed_truncation(const_tree lhs);
-+extern bool is_a_constant_overflow(const_gimple stmt, const_tree rhs);
-+extern tree handle_intentional_overflow(struct visited *visited, bool check_overflow, gimple stmt, tree change_rhs, tree new_rhs2);
++extern bool is_a_constant_overflow(const gassign *stmt, const_tree rhs);
++extern tree handle_intentional_overflow(struct visited *visited, bool check_overflow, gassign *stmt, tree change_rhs, tree new_rhs2);
+extern tree handle_integer_truncation(struct visited *visited, const_tree lhs);
-+extern bool is_a_neg_overflow(const_gimple stmt, const_tree rhs);
-+extern enum intentional_overflow_type add_mul_intentional_overflow(const_gimple def_stmt);
-+extern void unsigned_signed_cast_intentional_overflow(struct visited *visited, gimple stmt);
++extern bool is_a_neg_overflow(const gassign *stmt, const_tree rhs);
++extern enum intentional_overflow_type add_mul_intentional_overflow(const gassign *stmt);
++extern void unsigned_signed_cast_intentional_overflow(struct visited *visited, gassign *stmt);
+
+
+// insert_size_overflow_asm.c
@@ -116402,7 +117082,7 @@ index 0000000..516289f
+extern const char *get_type_name_from_field(const_tree field_decl);
+extern void set_dominance_info(void);
+extern void unset_dominance_info(void);
-+extern tree get_interesting_orig_fndecl_from_stmt(const_gimple stmt);
++extern tree get_interesting_orig_fndecl_from_stmt(const gcall *stmt);
+extern tree get_orig_fndecl(const_tree clone_fndecl);
+extern unsigned int get_correct_argnum(const_tree decl, const_tree correct_argnum_of_decl, unsigned int argnum);
+extern bool is_valid_cgraph_node(struct cgraph_node *node);
@@ -116416,6 +117096,7 @@ index 0000000..516289f
+extern bool is_size_overflow_type(const_tree var);
+extern bool made_by_compiler(const_tree decl);
+extern gimple get_fnptr_def_stmt(const_tree fn_ptr);
++extern tree get_lhs(const_gimple stmt);
+
+
+// size_overflow_transform.c
@@ -116426,15 +117107,15 @@ index 0000000..516289f
+// size_overflow_transform_core.c
+extern tree expand(struct visited *visited, tree lhs);
+extern void check_size_overflow(gimple stmt, tree size_overflow_type, tree cast_rhs, tree rhs, bool before);
-+extern tree dup_assign(struct visited *visited, gimple oldstmt, const_tree node, tree rhs1, tree rhs2, tree __unused rhs3);
++extern tree dup_assign(struct visited *visited, gassign *oldstmt, const_tree node, tree rhs1, tree rhs2, tree __unused rhs3);
+extern tree create_assign(struct visited *visited, gimple oldstmt, tree rhs1, bool before);
+
+
+// remove_unnecessary_dup.c
+extern struct opt_pass *make_remove_unnecessary_dup_pass(void);
-+extern void insert_cast_expr(struct visited *visited, gimple stmt, enum intentional_overflow_type type);
-+extern bool skip_expr_on_double_type(const_gimple stmt);
-+extern void create_up_and_down_cast(struct visited *visited, gimple use_stmt, tree orig_type, tree rhs);
++extern void insert_cast_expr(struct visited *visited, gassign *stmt, enum intentional_overflow_type type);
++extern bool skip_expr_on_double_type(const gassign *stmt);
++extern void create_up_and_down_cast(struct visited *visited, gassign *use_stmt, tree orig_type, tree rhs);
+
+
+// size_overflow_ipa.c
@@ -116468,7 +117149,7 @@ index 0000000..516289f
+#endif
+
+// size_overflow_fnptrs.c
-+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);
++extern next_interesting_function_t handle_function_ptr_ret(gimple_set *visited, next_interesting_function_t next_cnodes_head, const_tree fn_ptr);
+extern void check_local_variables(next_interesting_function_t next_node);
+extern void check_global_variables(next_interesting_function_t cur_global);
+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);
@@ -144476,10 +145157,10 @@ index 0000000..560cd7b
+zpios_read_64734 zpios_read 3 64734 NULL
diff --git a/tools/gcc/size_overflow_plugin/size_overflow_ipa.c b/tools/gcc/size_overflow_plugin/size_overflow_ipa.c
new file mode 100644
-index 0000000..f888b36
+index 0000000..9846ab0
--- /dev/null
+++ b/tools/gcc/size_overflow_plugin/size_overflow_ipa.c
-@@ -0,0 +1,908 @@
+@@ -0,0 +1,913 @@
+/*
+ * Copyright 2011-2015 by Emese Revfy <re.emese@gmail.com>
+ * Licensed under the GPL v2, or (at your option) v3
@@ -144501,7 +145182,7 @@ index 0000000..f888b36
+
+#include "size_overflow.h"
+
-+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);
++static next_interesting_function_t walk_use_def_next_functions(gimple_set *visited, next_interesting_function_t next_cnodes_head, const_tree lhs);
+
+next_interesting_function_t global_next_interesting_function[GLOBAL_NIFN_LEN];
+
@@ -144789,9 +145470,9 @@ index 0000000..f888b36
+ return new_node;
+}
+
-+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)
++static next_interesting_function_t walk_use_def_next_functions_phi(gimple_set *visited, next_interesting_function_t next_cnodes_head, const_tree result)
+{
-+ gimple phi = get_def_stmt(result);
++ gphi *phi = as_a_gphi(get_def_stmt(result));
+ unsigned int i, n = gimple_phi_num_args(phi);
+
+ pointer_set_insert(visited, phi);
@@ -144804,9 +145485,9 @@ index 0000000..f888b36
+ return next_cnodes_head;
+}
+
-+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)
++static next_interesting_function_t walk_use_def_next_functions_binary(gimple_set *visited, next_interesting_function_t next_cnodes_head, const_tree lhs)
+{
-+ gimple def_stmt = get_def_stmt(lhs);
++ gassign *def_stmt = as_a_gassign(get_def_stmt(lhs));
+ tree rhs1, rhs2;
+
+ rhs1 = gimple_assign_rhs1(def_stmt);
@@ -144816,7 +145497,7 @@ index 0000000..f888b36
+ return walk_use_def_next_functions(visited, next_cnodes_head, rhs2);
+}
+
-+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)
++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)
+{
+ return next_cnodes_head;
+}
@@ -144825,7 +145506,7 @@ index 0000000..f888b36
+ *
+ * Encountered functions are added to the children vector (next_interesting_function_t).
+ */
-+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)
++static next_interesting_function_t walk_use_def_next_functions(gimple_set *visited, next_interesting_function_t next_cnodes_head, const_tree lhs)
+{
+ const_gimple def_stmt;
+
@@ -144850,7 +145531,7 @@ index 0000000..f888b36
+ return walk_use_def_next_functions(visited, next_cnodes_head, SSA_NAME_VAR(lhs));
+ case GIMPLE_ASM:
+ if (is_size_overflow_asm(def_stmt))
-+ return walk_use_def_next_functions(visited, next_cnodes_head, get_size_overflow_asm_input(def_stmt));
++ return walk_use_def_next_functions(visited, next_cnodes_head, get_size_overflow_asm_input(as_a_const_gasm(def_stmt)));
+ return next_cnodes_head;
+ case GIMPLE_CALL: {
+ tree fndecl = gimple_call_fndecl(def_stmt);
@@ -144879,7 +145560,7 @@ index 0000000..f888b36
+// Start the search for next_interesting_function_t children based on the (next_interesting_function_t) parent node
+static next_interesting_function_t search_next_functions(const_tree node)
+{
-+ struct pointer_set_t *visited;
++ gimple_set *visited;
+ next_interesting_function_t next_cnodes_head;
+
+ visited = pointer_set_create();
@@ -144988,16 +145669,16 @@ index 0000000..f888b36
+
+ switch (gimple_code(stmt)) {
+ case GIMPLE_ASM:
-+ if (!is_size_overflow_insert_check_asm(stmt))
++ if (!is_size_overflow_insert_check_asm(as_a_const_gasm(stmt)))
+ return;
-+ start_var = get_size_overflow_asm_input(stmt);
++ start_var = get_size_overflow_asm_input(as_a_const_gasm(stmt));
+ gcc_assert(start_var != NULL_TREE);
+ break;
+ case GIMPLE_CALL:
+ start_var = gimple_call_arg(stmt, num - 1);
+ break;
+ case GIMPLE_RETURN:
-+ start_var = gimple_return_retval(stmt);
++ start_var = gimple_return_retval(as_a_const_greturn(stmt));
+ if (start_var == NULL_TREE)
+ return;
+ break;
@@ -145253,7 +145934,7 @@ index 0000000..f888b36
+}
+
+// Do a depth-first recursive dump of the next_interesting_function_t children vector
-+static void print_missing_functions(struct pointer_set_t *visited, next_interesting_function_t parent)
++static void print_missing_functions(next_interesting_function_set *visited, next_interesting_function_t parent)
+{
+ unsigned int i;
+ next_interesting_function_t child;
@@ -145283,10 +145964,10 @@ index 0000000..f888b36
+static unsigned int size_overflow_execute(void)
+{
+ unsigned int i;
-+ struct pointer_set_t *visited;
++ next_interesting_function_set *visited;
+ next_interesting_function_t cur_global;
+
-+ visited = pointer_set_create();
++ visited = next_interesting_function_pointer_set_create();
+
+ for (i = 0; i < GLOBAL_NIFN_LEN; i++) {
+ for (cur_global = global_next_interesting_function[i]; cur_global; cur_global = cur_global->next) {
@@ -145327,7 +146008,8 @@ index 0000000..f888b36
+#if BUILDING_GCC_VERSION >= 4008
+ .optinfo_flags = OPTGROUP_NONE,
+#endif
-+#if BUILDING_GCC_VERSION >= 4009
++#if BUILDING_GCC_VERSION >= 5000
++#elif BUILDING_GCC_VERSION >= 4009
+ .has_gate = false,
+ .has_execute = true,
+#else
@@ -145374,7 +146056,11 @@ index 0000000..f888b36
+ 0,
+ size_overflow_transform,
+ NULL) {}
++#if BUILDING_GCC_VERSION >= 5000
++ virtual unsigned int execute(function *) { return size_overflow_execute(); }
++#else
+ unsigned int execute() { return size_overflow_execute(); }
++#endif
+};
+}
+
@@ -145390,10 +146076,10 @@ index 0000000..f888b36
+#endif
diff --git a/tools/gcc/size_overflow_plugin/size_overflow_plugin.c b/tools/gcc/size_overflow_plugin/size_overflow_plugin.c
new file mode 100644
-index 0000000..036dc3f
+index 0000000..cf8320d
--- /dev/null
+++ b/tools/gcc/size_overflow_plugin/size_overflow_plugin.c
-@@ -0,0 +1,231 @@
+@@ -0,0 +1,256 @@
+/*
+ * Copyright 2011-2015 by Emese Revfy <re.emese@gmail.com>
+ * Licensed under the GPL v2, or (at your option) v3
@@ -145425,7 +146111,7 @@ index 0000000..036dc3f
+tree size_overflow_type_TI;
+
+static struct plugin_info size_overflow_plugin_info = {
-+ .version = "20150311",
++ .version = "20150429",
+ .help = "no-size-overflow\tturn off size overflow checking\n",
+};
+
@@ -145449,10 +146135,21 @@ index 0000000..036dc3f
+ }
+
+ for (; args; args = TREE_CHAIN(args)) {
++ int cur_val;
+ tree position = TREE_VALUE(args);
-+ if (TREE_CODE(position) != INTEGER_CST || TREE_INT_CST_LOW(position) > arg_count ) {
-+ error("%s: parameter %u is outside range.", __func__, (unsigned int)TREE_INT_CST_LOW(position));
++
++ if (TREE_CODE(position) != INTEGER_CST) {
++ error("%s: parameter isn't an integer", __func__);
++ debug_tree(args);
++ *no_add_attrs = true;
++ return NULL_TREE;
++ }
++
++ cur_val = tree_to_shwi(position);
++ if (cur_val < 0 || arg_count < (unsigned int)cur_val) {
++ error("%s: parameter %d is outside range.", __func__, cur_val);
+ *no_add_attrs = true;
++ return NULL_TREE;
+ }
+ }
+ return NULL_TREE;
@@ -145461,6 +146158,7 @@ index 0000000..036dc3f
+static tree handle_intentional_overflow_attribute(tree *node, tree __unused name, tree args, int __unused flags, bool *no_add_attrs)
+{
+ unsigned int arg_count;
++ HOST_WIDE_INT s_first_arg;
+ enum tree_code code = TREE_CODE(*node);
+
+ switch (code) {
@@ -145479,14 +146177,27 @@ index 0000000..036dc3f
+ return NULL_TREE;
+ }
+
-+ if (TREE_INT_CST_HIGH(TREE_VALUE(args)) != 0)
++ s_first_arg = tree_to_shwi(TREE_VALUE(args));
++ if (s_first_arg == -1)
+ return NULL_TREE;
++ if (s_first_arg < -1)
++ error("%s: parameter %d is outside range.", __func__, (int)s_first_arg);
+
+ for (; args; args = TREE_CHAIN(args)) {
-+ tree position = TREE_VALUE(args);
-+ if (TREE_CODE(position) != INTEGER_CST || TREE_INT_CST_LOW(position) > arg_count ) {
-+ error("%s: parameter %u is outside range.", __func__, (unsigned int)TREE_INT_CST_LOW(position));
++ unsigned int cur_val;
++
++ if (TREE_CODE(TREE_VALUE(args)) != INTEGER_CST) {
++ error("%s: parameter isn't an integer", __func__);
++ debug_tree(args);
++ *no_add_attrs = true;
++ return NULL_TREE;
++ }
++
++ cur_val = (unsigned int)tree_to_uhwi(TREE_VALUE(args));
++ if (cur_val > arg_count ) {
++ error("%s: parameter %u is outside range. (arg_count: %u)", __func__, cur_val, arg_count);
+ *no_add_attrs = true;
++ return NULL_TREE;
+ }
+ }
+ return NULL_TREE;
@@ -145627,7 +146338,7 @@ index 0000000..036dc3f
+}
diff --git a/tools/gcc/size_overflow_plugin/size_overflow_plugin_hash.c b/tools/gcc/size_overflow_plugin/size_overflow_plugin_hash.c
new file mode 100644
-index 0000000..2384252
+index 0000000..1d9ddb6
--- /dev/null
+++ b/tools/gcc/size_overflow_plugin/size_overflow_plugin_hash.c
@@ -0,0 +1,345 @@
@@ -145832,13 +146543,13 @@ index 0000000..2384252
+ struct decl_hash decl_hash_data;
+ enum tree_code code = TREE_CODE(decl);
+
-+ decl_hash_data.fn_name = decl_name;
+ gcc_assert(code == FIELD_DECL || code == FUNCTION_DECL || code == VAR_DECL);
+
+ // skip builtins __builtin_constant_p
+ if (code == FUNCTION_DECL && DECL_BUILT_IN(decl))
+ return NO_HASH;
+
++ decl_hash_data.fn_name = decl_name;
+ decl_hash_data.decl = decl;
+ decl_hash_data.tree_codes_len = 0;
+
@@ -145978,10 +146689,10 @@ index 0000000..2384252
+
diff --git a/tools/gcc/size_overflow_plugin/size_overflow_transform.c b/tools/gcc/size_overflow_plugin/size_overflow_transform.c
new file mode 100644
-index 0000000..b02158b
+index 0000000..13c610e
--- /dev/null
+++ b/tools/gcc/size_overflow_plugin/size_overflow_transform.c
-@@ -0,0 +1,430 @@
+@@ -0,0 +1,431 @@
+/*
+ * Copyright 2011-2015 by Emese Revfy <re.emese@gmail.com>
+ * Licensed under the GPL v2, or (at your option) v3
@@ -146010,10 +146721,10 @@ index 0000000..b02158b
+ gimple_stmt_iterator gsi = gsi_for_stmt(stmt);
+
+ assign = build_cast_stmt(visited, orig_type, new_node, CREATE_NEW_VAR, &gsi, BEFORE_STMT, false);
-+ return gimple_assign_lhs(assign);
++ return get_lhs(assign);
+}
+
-+static void change_size_overflow_asm_input(gimple stmt, tree new_input)
++static void change_size_overflow_asm_input(gasm *stmt, tree new_input)
+{
+ tree list;
+
@@ -146030,13 +146741,13 @@ index 0000000..b02158b
+
+ switch (gimple_code(stmt)) {
+ case GIMPLE_RETURN:
-+ gimple_return_set_retval(stmt, cast_lhs);
++ gimple_return_set_retval(as_a_greturn(stmt), cast_lhs);
+ break;
+ case GIMPLE_CALL:
+ gimple_call_set_arg(stmt, num - 1, cast_lhs);
+ break;
+ case GIMPLE_ASM:
-+ change_size_overflow_asm_input(stmt, cast_lhs);
++ change_size_overflow_asm_input(as_a_gasm(stmt), cast_lhs);
+ break;
+ default:
+ debug_gimple_stmt(stmt);
@@ -146221,7 +146932,7 @@ index 0000000..b02158b
+ return field;
+}
+
-+static tree get_fn_or_fnptr_decl(const_gimple call_stmt)
++static tree get_fn_or_fnptr_decl(const gcall *call_stmt)
+{
+ const_tree fnptr;
+ const_gimple def_stmt;
@@ -146239,7 +146950,7 @@ index 0000000..b02158b
+}
+
+// Start stmt duplication on marked function parameters
-+static struct interesting_stmts *search_interesting_calls(struct interesting_stmts *head, gimple call_stmt)
++static struct interesting_stmts *search_interesting_calls(struct interesting_stmts *head, gcall *call_stmt)
+{
+ tree decl;
+ unsigned int i, len;
@@ -146285,21 +146996,21 @@ index 0000000..b02158b
+
+ switch (gimple_code(stmt)) {
+ case GIMPLE_ASM:
-+ if (!is_size_overflow_insert_check_asm(stmt))
++ if (!is_size_overflow_insert_check_asm(as_a_gasm(stmt)))
+ continue;
-+ first_node = get_size_overflow_asm_input(stmt);
++ first_node = get_size_overflow_asm_input(as_a_gasm(stmt));
+ head = search_interesting_stmt(head, stmt, first_node, 0);
+ break;
+ case GIMPLE_RETURN:
+ if (!search_ret)
+ continue;
-+ first_node = gimple_return_retval(stmt);
++ first_node = gimple_return_retval(as_a_greturn(stmt));
+ if (first_node == NULL_TREE)
+ break;
+ head = search_interesting_stmt(head, stmt, first_node, 0);
+ break;
+ case GIMPLE_CALL:
-+ head = search_interesting_calls(head, stmt);
++ head = search_interesting_calls(head, as_a_gcall(stmt));
+ break;
+ default:
+ break;
@@ -146334,9 +147045,9 @@ index 0000000..b02158b
+}
+
+// Remove the size_overflow asm stmt and create an assignment from the input and output of the asm
-+static void replace_size_overflow_asm_with_assign(gimple asm_stmt, tree lhs, tree rhs)
++static void replace_size_overflow_asm_with_assign(gasm *asm_stmt, tree lhs, tree rhs)
+{
-+ gimple assign;
++ gassign *assign;
+ gimple_stmt_iterator gsi;
+
+ // already removed
@@ -146360,16 +147071,17 @@ index 0000000..b02158b
+ if (!is_size_overflow_asm(stmt))
+ return;
+
-+ if (gimple_asm_noutputs(stmt) == 0) {
++ if (gimple_asm_noutputs(as_a_gasm(stmt)) == 0) {
+ gsi = gsi_for_stmt(stmt);
-+ ipa_remove_stmt_references(cgraph_get_create_node(current_function_decl), stmt);
++
++ ipa_remove_stmt_references(cgraph_get_node(current_function_decl), stmt);
+ gsi_remove(&gsi, true);
+ return;
+ }
+
-+ input = gimple_asm_input_op(stmt, 0);
-+ output = gimple_asm_output_op(stmt, 0);
-+ replace_size_overflow_asm_with_assign(stmt, TREE_VALUE(output), TREE_VALUE(input));
++ input = gimple_asm_input_op(as_a_gasm(stmt), 0);
++ output = gimple_asm_output_op(as_a_gasm(stmt), 0);
++ replace_size_overflow_asm_with_assign(as_a_gasm(stmt), TREE_VALUE(output), TREE_VALUE(input));
+}
+
+static void remove_all_size_overflow_asm(void)
@@ -146414,10 +147126,10 @@ index 0000000..b02158b
+}
diff --git a/tools/gcc/size_overflow_plugin/size_overflow_transform_core.c b/tools/gcc/size_overflow_plugin/size_overflow_transform_core.c
new file mode 100644
-index 0000000..fd4aa92
+index 0000000..ec1596a
--- /dev/null
+++ b/tools/gcc/size_overflow_plugin/size_overflow_transform_core.c
-@@ -0,0 +1,956 @@
+@@ -0,0 +1,941 @@
+/*
+ * Copyright 2011-2015 by Emese Revfy <re.emese@gmail.com>
+ * Licensed under the GPL v2, or (at your option) v3
@@ -146487,23 +147199,9 @@ index 0000000..fd4aa92
+ return new_type;
+}
+
-+static tree get_lhs(const_gimple stmt)
-+{
-+ switch (gimple_code(stmt)) {
-+ case GIMPLE_ASSIGN:
-+ case GIMPLE_CALL:
-+ return gimple_get_lhs(stmt);
-+ case GIMPLE_PHI:
-+ return gimple_phi_result(stmt);
-+ default:
-+ return NULL_TREE;
-+ }
-+}
-+
+static tree cast_to_new_size_overflow_type(struct visited *visited, gimple stmt, tree rhs, tree size_overflow_type, bool before)
+{
+ gimple_stmt_iterator gsi;
-+ tree lhs;
+ gimple new_stmt;
+
+ if (rhs == NULL_TREE)
@@ -146515,9 +147213,7 @@ index 0000000..fd4aa92
+ gimple_assign_set_rhs_code(new_stmt, CONVERT_EXPR);
+ pointer_set_insert(visited->my_stmts, new_stmt);
+
-+ lhs = get_lhs(new_stmt);
-+ gcc_assert(lhs != NULL_TREE);
-+ return lhs;
++ return get_lhs(new_stmt);
+}
+
+tree create_assign(struct visited *visited, gimple oldstmt, tree rhs1, bool before)
@@ -146578,9 +147274,9 @@ index 0000000..fd4aa92
+ return cast_to_new_size_overflow_type(visited, oldstmt, rhs1, dst_type, before);
+}
+
-+tree dup_assign(struct visited *visited, gimple oldstmt, const_tree node, tree rhs1, tree rhs2, tree __unused rhs3)
++tree dup_assign(struct visited *visited, gassign *oldstmt, const_tree node, tree rhs1, tree rhs2, tree __unused rhs3)
+{
-+ gimple stmt;
++ gassign *stmt;
+ gimple_stmt_iterator gsi;
+ tree size_overflow_type, new_var, lhs = gimple_assign_lhs(oldstmt);
+
@@ -146596,7 +147292,7 @@ index 0000000..fd4aa92
+ rhs2 = create_assign(visited, oldstmt, rhs2, BEFORE_STMT);
+ }
+
-+ stmt = gimple_copy(oldstmt);
++ stmt = as_a_gassign(gimple_copy(oldstmt));
+ gimple_set_location(stmt, gimple_location(oldstmt));
+ pointer_set_insert(visited->my_stmts, stmt);
+
@@ -146630,7 +147326,7 @@ index 0000000..fd4aa92
+
+static tree cast_parm_decl(struct visited *visited, tree phi_ssa_name, tree arg, tree size_overflow_type, basic_block bb)
+{
-+ gimple assign;
++ const_gimple assign;
+ gimple_stmt_iterator gsi;
+ basic_block first_bb;
+
@@ -146646,14 +147342,14 @@ index 0000000..fd4aa92
+ gsi = gsi_after_labels(bb);
+ assign = build_cast_stmt(visited, size_overflow_type, arg, phi_ssa_name, &gsi, BEFORE_STMT, false);
+ pointer_set_insert(visited->my_stmts, assign);
-+
-+ return gimple_assign_lhs(assign);
++ return get_lhs(assign);
+}
+
+static tree use_phi_ssa_name(struct visited *visited, tree ssa_name_var, tree new_arg)
+{
+ gimple_stmt_iterator gsi;
-+ gimple assign, def_stmt = get_def_stmt(new_arg);
++ const_gimple assign;
++ gimple def_stmt = get_def_stmt(new_arg);
+
+ if (gimple_code(def_stmt) == GIMPLE_PHI) {
+ gsi = gsi_after_labels(gimple_bb(def_stmt));
@@ -146664,7 +147360,7 @@ index 0000000..fd4aa92
+ }
+
+ pointer_set_insert(visited->my_stmts, assign);
-+ return gimple_assign_lhs(assign);
++ return get_lhs(assign);
+}
+
+static tree cast_visited_phi_arg(struct visited *visited, tree ssa_name_var, tree arg, tree size_overflow_type)
@@ -146672,7 +147368,7 @@ index 0000000..fd4aa92
+ basic_block bb;
+ gimple_stmt_iterator gsi;
+ const_gimple def_stmt;
-+ gimple assign;
++ const_gimple assign;
+
+ def_stmt = get_def_stmt(arg);
+ bb = gimple_bb(def_stmt);
@@ -146681,10 +147377,10 @@ index 0000000..fd4aa92
+
+ assign = build_cast_stmt(visited, size_overflow_type, arg, ssa_name_var, &gsi, BEFORE_STMT, false);
+ pointer_set_insert(visited->my_stmts, assign);
-+ return gimple_assign_lhs(assign);
++ return get_lhs(assign);
+}
+
-+static tree create_new_phi_arg(struct visited *visited, tree ssa_name_var, tree new_arg, gimple oldstmt, unsigned int i)
++static tree create_new_phi_arg(struct visited *visited, tree ssa_name_var, tree new_arg, gphi *oldstmt, unsigned int i)
+{
+ tree size_overflow_type;
+ tree arg;
@@ -146709,12 +147405,13 @@ index 0000000..fd4aa92
+ }
+ case GIMPLE_ASM: {
+ gimple_stmt_iterator gsi;
-+ gimple assign, stmt = get_def_stmt(arg);
++ const_gimple assign;
++ gimple stmt = get_def_stmt(arg);
+
+ gsi = gsi_for_stmt(stmt);
+ assign = build_cast_stmt(visited, size_overflow_type, arg, ssa_name_var, &gsi, AFTER_STMT, false);
+ pointer_set_insert(visited->my_stmts, assign);
-+ return gimple_assign_lhs(assign);
++ return get_lhs(assign);
+ }
+ default:
+ gcc_assert(new_arg != NULL_TREE);
@@ -146723,10 +147420,10 @@ index 0000000..fd4aa92
+ }
+}
+
-+static gimple overflow_create_phi_node(struct visited *visited, gimple oldstmt, tree result)
++static gphi *overflow_create_phi_node(struct visited *visited, gphi *oldstmt, tree result)
+{
+ basic_block bb;
-+ gimple phi;
++ gphi *phi;
+ gimple_seq seq;
+ gimple_stmt_iterator gsi = gsi_for_stmt(oldstmt);
+
@@ -146754,10 +147451,10 @@ index 0000000..fd4aa92
+#if BUILDING_GCC_VERSION <= 4007
+static tree create_new_phi_node(struct visited *visited, VEC(tree, heap) **args, tree ssa_name_var, gimple oldstmt)
+#else
-+static tree create_new_phi_node(struct visited *visited, vec<tree, va_heap, vl_embed> *&args, tree ssa_name_var, gimple oldstmt)
++static tree create_new_phi_node(struct visited *visited, vec<tree, va_heap, vl_embed> *&args, tree ssa_name_var, gphi *oldstmt)
+#endif
+{
-+ gimple new_phi;
++ gphi *new_phi;
+ unsigned int i;
+ tree arg, result;
+ location_t loc = gimple_location(oldstmt);
@@ -146799,7 +147496,7 @@ index 0000000..fd4aa92
+#else
+ vec<tree, va_heap, vl_embed> *args = NULL;
+#endif
-+ gimple oldstmt = get_def_stmt(orig_result);
++ gphi *oldstmt = as_a_gphi(get_def_stmt(orig_result));
+ unsigned int i, len = gimple_phi_num_args(oldstmt);
+
+ pointer_set_insert(visited->stmts, oldstmt);
@@ -146832,7 +147529,7 @@ index 0000000..fd4aa92
+#endif
+}
+
-+static tree create_cast_assign(struct visited *visited, gimple stmt)
++static tree create_cast_assign(struct visited *visited, gassign *stmt)
+{
+ tree rhs1 = gimple_assign_rhs1(stmt);
+ tree lhs = gimple_assign_lhs(stmt);
@@ -146845,7 +147542,7 @@ index 0000000..fd4aa92
+ return create_assign(visited, stmt, rhs1, AFTER_STMT);
+}
+
-+static bool skip_lhs_cast_check(const_gimple stmt)
++static bool skip_lhs_cast_check(const gassign *stmt)
+{
+ const_tree rhs = gimple_assign_rhs1(stmt);
+ const_gimple def_stmt = get_def_stmt(rhs);
@@ -146879,7 +147576,7 @@ index 0000000..fd4aa92
+
+static void insert_cond(basic_block cond_bb, tree arg, enum tree_code cond_code, tree type_value)
+{
-+ gimple cond_stmt;
++ gcond *cond_stmt;
+ gimple_stmt_iterator gsi = gsi_last_bb(cond_bb);
+
+ cond_stmt = gimple_build_cond(cond_code, arg, type_value, NULL_TREE, NULL_TREE);
@@ -146889,7 +147586,7 @@ index 0000000..fd4aa92
+
+static void insert_cond_result(basic_block bb_true, const_gimple stmt, const_tree arg, bool min)
+{
-+ gimple func_stmt;
++ gcall *func_stmt;
+ const_gimple def_stmt;
+ const_tree loc_line;
+ tree loc_file, ssa_name, current_func;
@@ -147012,7 +147709,7 @@ index 0000000..fd4aa92
+ insert_check_size_overflow(stmt, LT_EXPR, cast_rhs, type_min, before, MIN_CHECK);
+}
+
-+static tree create_cast_overflow_check(struct visited *visited, tree new_rhs1, gimple stmt)
++static tree create_cast_overflow_check(struct visited *visited, tree new_rhs1, gassign *stmt)
+{
+ bool cast_lhs, cast_rhs;
+ tree lhs = gimple_assign_lhs(stmt);
@@ -147065,7 +147762,7 @@ index 0000000..fd4aa92
+ return dup_assign(visited, stmt, lhs, new_rhs1, NULL_TREE, NULL_TREE);
+}
+
-+static tree handle_unary_rhs(struct visited *visited, gimple stmt)
++static tree handle_unary_rhs(struct visited *visited, gassign *stmt)
+{
+ enum tree_code rhs_code;
+ tree rhs1, new_rhs1, lhs = gimple_assign_lhs(stmt);
@@ -147100,7 +147797,7 @@ index 0000000..fd4aa92
+ return create_cast_overflow_check(visited, new_rhs1, stmt);
+}
+
-+static tree handle_unary_ops(struct visited *visited, gimple stmt)
++static tree handle_unary_ops(struct visited *visited, gassign *stmt)
+{
+ tree rhs1, lhs = gimple_assign_lhs(stmt);
+ gimple def_stmt = get_def_stmt(lhs);
@@ -147113,7 +147810,7 @@ index 0000000..fd4aa92
+
+ switch (TREE_CODE(rhs1)) {
+ case SSA_NAME: {
-+ tree ret = handle_unary_rhs(visited, def_stmt);
++ tree ret = handle_unary_rhs(visited, as_a_gassign(def_stmt));
+
+ if (gimple_assign_cast_p(stmt))
+ unsigned_signed_cast_intentional_overflow(visited, stmt);
@@ -147162,7 +147859,7 @@ index 0000000..fd4aa92
+}
+
+// Skip duplication when there is a minus expr and the type of rhs1 or rhs2 is a pointer_type.
-+static bool is_ptr_diff(gimple stmt)
++static bool is_ptr_diff(gassign *stmt)
+{
+ const_tree rhs1, rhs2, ptr1_rhs, ptr2_rhs;
+
@@ -147190,7 +147887,7 @@ index 0000000..fd4aa92
+{
+ enum intentional_overflow_type res;
+ tree rhs1, rhs2, new_lhs;
-+ gimple def_stmt = get_def_stmt(lhs);
++ gassign *def_stmt = as_a_gassign(get_def_stmt(lhs));
+ tree new_rhs1 = NULL_TREE;
+ tree new_rhs2 = NULL_TREE;
+
@@ -147231,13 +147928,13 @@ index 0000000..fd4aa92
+ res = add_mul_intentional_overflow(def_stmt);
+ if (res != NO_INTENTIONAL_OVERFLOW) {
+ new_lhs = dup_assign(visited, def_stmt, lhs, new_rhs1, new_rhs2, NULL_TREE);
-+ insert_cast_expr(visited, get_def_stmt(new_lhs), res);
++ insert_cast_expr(visited, as_a_gassign(get_def_stmt(new_lhs)), res);
+ return new_lhs;
+ }
+
+ if (skip_expr_on_double_type(def_stmt)) {
+ new_lhs = dup_assign(visited, def_stmt, lhs, new_rhs1, new_rhs2, NULL_TREE);
-+ insert_cast_expr(visited, get_def_stmt(new_lhs), NO_INTENTIONAL_OVERFLOW);
++ insert_cast_expr(visited, as_a_gassign(get_def_stmt(new_lhs)), NO_INTENTIONAL_OVERFLOW);
+ return new_lhs;
+ }
+
@@ -147274,7 +147971,7 @@ index 0000000..fd4aa92
+static tree handle_ternary_ops(struct visited *visited, tree lhs)
+{
+ tree rhs1, rhs2, rhs3, new_rhs1, new_rhs2, new_rhs3, size_overflow_type;
-+ gimple def_stmt = get_def_stmt(lhs);
++ gassign *def_stmt = as_a_gassign(get_def_stmt(lhs));
+
+ size_overflow_type = get_size_overflow_type(visited, def_stmt, lhs);
+
@@ -147355,12 +148052,12 @@ index 0000000..fd4aa92
+ case GIMPLE_CALL:
+ case GIMPLE_ASM:
+ if (is_size_overflow_asm(def_stmt))
-+ return expand(visited, get_size_overflow_asm_input(def_stmt));
++ return expand(visited, get_size_overflow_asm_input(as_a_gasm(def_stmt)));
+ return create_assign(visited, def_stmt, lhs, AFTER_STMT);
+ case GIMPLE_ASSIGN:
+ switch (gimple_num_ops(def_stmt)) {
+ case 2:
-+ return handle_unary_ops(visited, def_stmt);
++ return handle_unary_ops(visited, as_a_gassign(def_stmt));
+ case 3:
+ return handle_binary_ops(visited, lhs);
+#if BUILDING_GCC_VERSION >= 4006
@@ -147376,10 +148073,10 @@ index 0000000..fd4aa92
+}
diff --git a/tools/gcc/stackleak_plugin.c b/tools/gcc/stackleak_plugin.c
new file mode 100644
-index 0000000..51dc09d
+index 0000000..1d296ce
--- /dev/null
+++ b/tools/gcc/stackleak_plugin.c
-@@ -0,0 +1,408 @@
+@@ -0,0 +1,432 @@
+/*
+ * Copyright 2011-2015 by the PaX Team <pageexec@freemail.hu>
+ * Licensed under the GPL v2
@@ -147412,29 +148109,49 @@ index 0000000..51dc09d
+static bool init_locals;
+
+static struct plugin_info stackleak_plugin_info = {
-+ .version = "201408011900",
++ .version = "201504282245",
+ .help = "track-lowest-sp=nn\ttrack sp in functions whose frame size is at least nn bytes\n"
+// "initialize-locals\t\tforcibly initialize all stack frames\n"
+};
+
+static void stackleak_check_alloca(gimple_stmt_iterator *gsi)
+{
-+ gimple check_alloca;
++ gcall *check_alloca;
+ tree alloca_size;
++ cgraph_node_ptr node;
++ int frequency;
++ basic_block bb;
+
+ // insert call to void pax_check_alloca(unsigned long size)
+ alloca_size = gimple_call_arg(gsi_stmt(*gsi), 0);
+ check_alloca = gimple_build_call(check_function_decl, 1, alloca_size);
+ gsi_insert_before(gsi, check_alloca, GSI_SAME_STMT);
++
++ // update the cgraph
++ bb = gimple_bb(check_alloca);
++ node = cgraph_get_create_node(check_function_decl);
++ gcc_assert(node);
++ frequency = compute_call_stmt_bb_frequency(current_function_decl, bb);
++ cgraph_create_edge(cgraph_get_node(current_function_decl), node, check_alloca, bb->count, frequency, bb->loop_depth);
+}
+
+static void stackleak_add_instrumentation(gimple_stmt_iterator *gsi)
+{
-+ gimple track_stack;
++ gcall *track_stack;
++ cgraph_node_ptr node;
++ int frequency;
++ basic_block bb;
+
+ // insert call to void pax_track_stack(void)
+ track_stack = gimple_build_call(track_function_decl, 0);
+ gsi_insert_after(gsi, track_stack, GSI_CONTINUE_LINKING);
++
++ // update the cgraph
++ bb = gimple_bb(track_stack);
++ node = cgraph_get_create_node(track_function_decl);
++ gcc_assert(node);
++ frequency = compute_call_stmt_bb_frequency(current_function_decl, bb);
++ cgraph_create_edge(cgraph_get_node(current_function_decl), node, track_stack, bb->count, frequency, bb->loop_depth);
+}
+
+static bool is_alloca(gimple stmt)
@@ -147589,16 +148306,20 @@ index 0000000..51dc09d
+ track_function_decl = build_fn_decl(track_function, fntype);
+ DECL_ASSEMBLER_NAME(track_function_decl); // for LTO
+ TREE_PUBLIC(track_function_decl) = 1;
++ TREE_USED(track_function_decl) = 1;
+ DECL_EXTERNAL(track_function_decl) = 1;
+ DECL_ARTIFICIAL(track_function_decl) = 1;
++ DECL_PRESERVE_P(track_function_decl) = 1;
+
+ // void pax_check_alloca(unsigned long)
+ fntype = build_function_type_list(void_type_node, long_unsigned_type_node, NULL_TREE);
+ check_function_decl = build_fn_decl(check_function, fntype);
+ DECL_ASSEMBLER_NAME(check_function_decl); // for LTO
+ TREE_PUBLIC(check_function_decl) = 1;
++ TREE_USED(check_function_decl) = 1;
+ DECL_EXTERNAL(check_function_decl) = 1;
+ DECL_ARTIFICIAL(check_function_decl) = 1;
++ DECL_PRESERVE_P(check_function_decl) = 1;
+}
+
+#if BUILDING_GCC_VERSION >= 4009
diff --git a/3.2.68/0000_README b/3.2.68/0000_README
index 15188a5..bd504a3 100644
--- a/3.2.68/0000_README
+++ b/3.2.68/0000_README
@@ -190,7 +190,7 @@ Patch: 1067_linux-3.2.68.patch
From: http://www.kernel.org
Desc: Linux 3.2.68
-Patch: 4420_grsecurity-3.1-3.2.68-201504270825.patch
+Patch: 4420_grsecurity-3.1-3.2.68-201504302116.patch
From: http://www.grsecurity.net
Desc: hardened-sources base patch from upstream grsecurity
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
index 5f8c996..bf41e91 100644
--- 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
@@ -14766,8 +14766,21 @@ index 8ca8283..8dc71fa 100644
#endif /* __ASSEMBLY__ */
#include <asm-generic/memory_model.h>
+diff --git a/arch/x86/include/asm/page_32.h b/arch/x86/include/asm/page_32.h
+index da4e762..592f614 100644
+--- a/arch/x86/include/asm/page_32.h
++++ b/arch/x86/include/asm/page_32.h
+@@ -11,7 +11,7 @@
+
+ #define __phys_addr_nodebug(x) ((x) - PAGE_OFFSET)
+ #ifdef CONFIG_DEBUG_VIRTUAL
+-extern unsigned long __phys_addr(unsigned long);
++extern unsigned long __intentional_overflow(-1) __phys_addr(unsigned long);
+ #else
+ #define __phys_addr(x) __phys_addr_nodebug(x)
+ #endif
diff --git a/arch/x86/include/asm/page_64_types.h b/arch/x86/include/asm/page_64_types.h
-index a9e9937..2bf88cc 100644
+index a9e9937..a398cb4 100644
--- a/arch/x86/include/asm/page_64_types.h
+++ b/arch/x86/include/asm/page_64_types.h
@@ -1,7 +1,7 @@
@@ -14779,15 +14792,18 @@ index a9e9937..2bf88cc 100644
#define THREAD_SIZE (PAGE_SIZE << THREAD_ORDER)
#define CURRENT_MASK (~(THREAD_SIZE - 1))
-@@ -55,7 +55,7 @@ void copy_page(void *to, void *from);
+@@ -55,9 +55,9 @@ void copy_page(void *to, void *from);
/* duplicated to the one in bootmem.h */
extern unsigned long max_pfn;
-extern unsigned long phys_base;
+extern const unsigned long phys_base;
- extern unsigned long __phys_addr(unsigned long);
+-extern unsigned long __phys_addr(unsigned long);
++extern unsigned long __intentional_overflow(-1) __phys_addr(unsigned long);
#define __phys_reloc_hide(x) (x)
+
+ #define vmemmap ((struct page *)VMEMMAP_START)
diff --git a/arch/x86/include/asm/paravirt.h b/arch/x86/include/asm/paravirt.h
index 91e758b..cac1cd6 100644
--- a/arch/x86/include/asm/paravirt.h
@@ -16466,7 +16482,7 @@ index d7ef849..b1b009a 100644
#endif
#endif /* _ASM_X86_THREAD_INFO_H */
diff --git a/arch/x86/include/asm/uaccess.h b/arch/x86/include/asm/uaccess.h
-index 36361bf..9efdc12 100644
+index 36361bf..916c53c 100644
--- a/arch/x86/include/asm/uaccess.h
+++ b/arch/x86/include/asm/uaccess.h
@@ -7,6 +7,7 @@
@@ -16536,7 +16552,32 @@ index 36361bf..9efdc12 100644
/*
* The exception table consists of pairs of addresses: the first is the
-@@ -182,12 +216,20 @@ extern int __get_user_bad(void);
+@@ -126,6 +160,15 @@ extern int __get_user_bad(void);
+ /* Careful: we have to cast the result to the type of the pointer
+ * for sign reasons */
+
++/*
++ * This is a type: either (un)signed int, if the argument fits into
++ * that type, or otherwise (un)signed long long.
++ */
++#define __inttype(x) \
++__typeof__(__builtin_choose_expr(sizeof(x) > sizeof(0U), \
++ __builtin_choose_expr(__type_is_unsigned(__typeof__(x)), 0ULL, 0LL),\
++ __builtin_choose_expr(__type_is_unsigned(__typeof__(x)), 0U, 0)))
++
+ /**
+ * get_user: - Get a simple variable from user space.
+ * @x: Variable to store result.
+@@ -154,7 +197,7 @@ extern int __get_user_bad(void);
+ #define get_user(x, ptr) \
+ ({ \
+ int __ret_gu; \
+- unsigned long __val_gu; \
++ __inttype(*(ptr)) __val_gu; \
+ __chk_user_ptr(ptr); \
+ might_fault(); \
+ switch (sizeof(*(ptr))) { \
+@@ -182,12 +225,20 @@ extern int __get_user_bad(void);
asm volatile("call __put_user_" #size : "=a" (__ret_pu) \
: "0" ((typeof(*(ptr)))(x)), "c" (ptr) : "ebx")
@@ -16560,7 +16601,7 @@ index 36361bf..9efdc12 100644
"3:\n" \
".section .fixup,\"ax\"\n" \
"4: movl %3,%0\n" \
-@@ -199,8 +241,8 @@ extern int __get_user_bad(void);
+@@ -199,8 +250,8 @@ extern int __get_user_bad(void);
: "A" (x), "r" (addr), "i" (errret), "0" (err))
#define __put_user_asm_ex_u64(x, addr) \
@@ -16571,7 +16612,7 @@ index 36361bf..9efdc12 100644
"3:\n" \
_ASM_EXTABLE(1b, 2b - 1b) \
_ASM_EXTABLE(2b, 3b - 2b) \
-@@ -252,7 +294,7 @@ extern void __put_user_8(void);
+@@ -252,7 +303,7 @@ extern void __put_user_8(void);
__typeof__(*(ptr)) __pu_val; \
__chk_user_ptr(ptr); \
might_fault(); \
@@ -16580,7 +16621,7 @@ index 36361bf..9efdc12 100644
switch (sizeof(*(ptr))) { \
case 1: \
__put_user_x(1, __pu_val, ptr, __ret_pu); \
-@@ -373,7 +415,7 @@ do { \
+@@ -373,7 +424,7 @@ do { \
} while (0)
#define __get_user_asm(x, addr, err, itype, rtype, ltype, errret) \
@@ -16589,7 +16630,7 @@ index 36361bf..9efdc12 100644
"2:\n" \
".section .fixup,\"ax\"\n" \
"3: mov %3,%0\n" \
-@@ -381,7 +423,7 @@ do { \
+@@ -381,7 +432,7 @@ do { \
" jmp 2b\n" \
".previous\n" \
_ASM_EXTABLE(1b, 3b) \
@@ -16598,7 +16639,7 @@ index 36361bf..9efdc12 100644
: "m" (__m(addr)), "i" (errret), "0" (err))
#define __get_user_size_ex(x, ptr, size) \
-@@ -406,7 +448,7 @@ do { \
+@@ -406,7 +457,7 @@ do { \
} while (0)
#define __get_user_asm_ex(x, addr, itype, rtype, ltype) \
@@ -16607,7 +16648,7 @@ index 36361bf..9efdc12 100644
"2:\n" \
_ASM_EXTABLE(1b, 2b - 1b) \
: ltype(x) : "m" (__m(addr)))
-@@ -423,13 +465,24 @@ do { \
+@@ -423,13 +474,24 @@ do { \
int __gu_err; \
unsigned long __gu_val; \
__get_user_size(__gu_val, (ptr), (size), __gu_err, -EFAULT); \
@@ -16634,7 +16675,7 @@ index 36361bf..9efdc12 100644
/*
* Tell gcc we read from memory instead of writing: this is because
-@@ -437,7 +490,7 @@ struct __large_struct { unsigned long buf[100]; };
+@@ -437,7 +499,7 @@ struct __large_struct { unsigned long buf[100]; };
* aliasing issues.
*/
#define __put_user_asm(x, addr, err, itype, rtype, ltype, errret) \
@@ -16643,7 +16684,7 @@ index 36361bf..9efdc12 100644
"2:\n" \
".section .fixup,\"ax\"\n" \
"3: mov %3,%0\n" \
-@@ -445,10 +498,10 @@ struct __large_struct { unsigned long buf[100]; };
+@@ -445,10 +507,10 @@ struct __large_struct { unsigned long buf[100]; };
".previous\n" \
_ASM_EXTABLE(1b, 3b) \
: "=r"(err) \
@@ -16656,7 +16697,7 @@ index 36361bf..9efdc12 100644
"2:\n" \
_ASM_EXTABLE(1b, 2b - 1b) \
: : ltype(x), "m" (__m(addr)))
-@@ -487,8 +540,12 @@ struct __large_struct { unsigned long buf[100]; };
+@@ -487,8 +549,12 @@ struct __large_struct { unsigned long buf[100]; };
* On error, the variable @x is set to zero.
*/
@@ -16669,7 +16710,7 @@ index 36361bf..9efdc12 100644
/**
* __put_user: - Write a simple value into user space, with less checking.
-@@ -510,8 +567,12 @@ struct __large_struct { unsigned long buf[100]; };
+@@ -510,8 +576,12 @@ struct __large_struct { unsigned long buf[100]; };
* Returns zero on success, or -EFAULT on error.
*/
@@ -16682,7 +16723,7 @@ index 36361bf..9efdc12 100644
#define __get_user_unaligned __get_user
#define __put_user_unaligned __put_user
-@@ -529,7 +590,7 @@ struct __large_struct { unsigned long buf[100]; };
+@@ -529,7 +599,7 @@ struct __large_struct { unsigned long buf[100]; };
#define get_user_ex(x, ptr) do { \
unsigned long __gue_val; \
__get_user_size_ex((__gue_val), (ptr), (sizeof(*(ptr)))); \
@@ -17662,7 +17703,7 @@ index 5d513bc..6a51935 100644
.name = "es7000",
.probe = probe_es7000,
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
-index 6d939d7..75d1260 100644
+index 6d939d7..a93a87e 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -1096,7 +1096,7 @@ int IO_APIC_get_PCI_irq_vector(int bus, int slot, int pin,
@@ -17701,7 +17742,7 @@ index 6d939d7..75d1260 100644
eoi_ioapic_irq(irq, cfg);
}
-@@ -2634,13 +2634,16 @@ static void ir_print_prefix(struct irq_data *data, struct seq_file *p)
+@@ -2634,17 +2634,20 @@ static void ir_print_prefix(struct irq_data *data, struct seq_file *p)
static void irq_remap_modify_chip_defaults(struct irq_chip *chip)
{
@@ -17722,6 +17763,20 @@ index 6d939d7..75d1260 100644
}
#endif /* CONFIG_IRQ_REMAP */
+-static struct irq_chip ioapic_chip __read_mostly = {
++static struct irq_chip ioapic_chip = {
+ .name = "IO-APIC",
+ .irq_startup = startup_ioapic_irq,
+ .irq_mask = mask_ioapic_irq,
+@@ -2715,7 +2718,7 @@ static void ack_lapic_irq(struct irq_data *data)
+ ack_APIC_irq();
+ }
+
+-static struct irq_chip lapic_chip __read_mostly = {
++static struct irq_chip lapic_chip = {
+ .name = "local-APIC",
+ .irq_mask = mask_lapic_irq,
+ .irq_unmask = unmask_lapic_irq,
diff --git a/arch/x86/kernel/apic/numaq_32.c b/arch/x86/kernel/apic/numaq_32.c
index c4a61ca..4c63d32 100644
--- a/arch/x86/kernel/apic/numaq_32.c
@@ -17811,7 +17866,7 @@ index 79b05b8..bc1d972 100644
.name = "UV large system",
.probe = uv_probe,
diff --git a/arch/x86/kernel/apm_32.c b/arch/x86/kernel/apm_32.c
-index a46bd38..6b906d7 100644
+index a46bd38..92f6c9c 100644
--- a/arch/x86/kernel/apm_32.c
+++ b/arch/x86/kernel/apm_32.c
@@ -411,7 +411,7 @@ static DEFINE_MUTEX(apm_mutex);
@@ -17869,6 +17924,15 @@ index a46bd38..6b906d7 100644
put_cpu();
return error;
}
+@@ -2037,7 +2051,7 @@ static int __init swab_apm_power_in_minutes(const struct dmi_system_id *d)
+ return 0;
+ }
+
+-static struct dmi_system_id __initdata apm_dmi_table[] = {
++static const struct dmi_system_id __initconst apm_dmi_table[] = {
+ {
+ print_if_true,
+ KERN_WARNING "IBM T23 - BIOS 1.03b+ and controller firmware 1.02+ may be needed for Linux APM.",
@@ -2347,12 +2361,15 @@ static int __init apm_init(void)
* code to that CPU.
*/
@@ -23450,7 +23514,7 @@ index 42eb330..139955c 100644
return ret;
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
-index f411aca..bd2aa3b 100644
+index f411aca..e436e0a 100644
--- a/arch/x86/kernel/reboot.c
+++ b/arch/x86/kernel/reboot.c
@@ -35,7 +35,7 @@ void (*pm_power_off)(void);
@@ -23462,6 +23526,15 @@ index f411aca..bd2aa3b 100644
enum reboot_type reboot_type = BOOT_ACPI;
int reboot_force;
+@@ -145,7 +145,7 @@ static int __init set_kbd_reboot(const struct dmi_system_id *d)
+ return 0;
+ }
+
+-static struct dmi_system_id __initdata reboot_dmi_table[] = {
++static const struct dmi_system_id __initconst reboot_dmi_table[] = {
+ { /* Handle problems with rebooting on Dell E520's */
+ .callback = set_bios_reboot,
+ .ident = "Dell E520",
@@ -324,13 +324,17 @@ core_initcall(reboot_init);
extern const unsigned char machine_real_restart_asm[];
extern const u64 machine_real_restart_gdt[3];
@@ -33156,6 +33229,23 @@ index ba92046..2d5921a 100644
if (!ret)
kobject_uevent(&pinst->kobj, KOBJ_ADD);
+diff --git a/crypto/zlib.c b/crypto/zlib.c
+index d980788..2422b3d 100644
+--- a/crypto/zlib.c
++++ b/crypto/zlib.c
+@@ -95,10 +95,10 @@ static int zlib_compress_setup(struct crypto_pcomp *tfm, void *params,
+ zlib_comp_exit(ctx);
+
+ window_bits = tb[ZLIB_COMP_WINDOWBITS]
+- ? nla_get_u32(tb[ZLIB_COMP_WINDOWBITS])
++ ? nla_get_s32(tb[ZLIB_COMP_WINDOWBITS])
+ : MAX_WBITS;
+ mem_level = tb[ZLIB_COMP_MEMLEVEL]
+- ? nla_get_u32(tb[ZLIB_COMP_MEMLEVEL])
++ ? nla_get_s32(tb[ZLIB_COMP_MEMLEVEL])
+ : DEF_MEM_LEVEL;
+
+ workspacesize = zlib_deflate_workspacesize(window_bits, mem_level);
diff --git a/drivers/acpi/apei/apei-internal.h b/drivers/acpi/apei/apei-internal.h
index f57050e..7ccfc74 100644
--- a/drivers/acpi/apei/apei-internal.h
@@ -33232,6 +33322,28 @@ index cb96296..b81293b 100644
{
.callback = dmi_disable_osi_vista,
.ident = "Fujitsu Siemens",
+diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
+index 3a0e92a..4348f2a 100644
+--- a/drivers/acpi/bus.c
++++ b/drivers/acpi/bus.c
+@@ -72,7 +72,7 @@ static int set_copy_dsdt(const struct dmi_system_id *id)
+ }
+ #endif
+
+-static struct dmi_system_id dsdt_dmi_table[] __initdata = {
++static const struct dmi_system_id dsdt_dmi_table[] __initconst = {
+ /*
+ * Invoke DSDT corruption work-around on all Toshiba Satellite.
+ * https://bugzilla.kernel.org/show_bug.cgi?id=14679
+@@ -88,7 +88,7 @@ static struct dmi_system_id dsdt_dmi_table[] __initdata = {
+ {}
+ };
+ #else
+-static struct dmi_system_id dsdt_dmi_table[] __initdata = {
++static const struct dmi_system_id dsdt_dmi_table[] __initconst = {
+ {}
+ };
+ #endif
diff --git a/drivers/acpi/custom_method.c b/drivers/acpi/custom_method.c
index 5d42c24..4964b94 100644
--- a/drivers/acpi/custom_method.c
@@ -33247,6 +33359,19 @@ index 5d42c24..4964b94 100644
if (!(*ppos)) {
/* parse the table header to get the table length */
if (count <= sizeof(struct acpi_table_header))
+diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
+index 30229af..eaddfaf 100644
+--- a/drivers/acpi/ec.c
++++ b/drivers/acpi/ec.c
+@@ -1018,7 +1018,7 @@ static int ec_clear_on_resume(const struct dmi_system_id *id)
+ return 0;
+ }
+
+-static struct dmi_system_id __initdata ec_dmi_table[] = {
++static const struct dmi_system_id __initconst ec_dmi_table[] = {
+ {
+ ec_skip_dsdt_scan, "Compal JFL92", {
+ DMI_MATCH(DMI_BIOS_VENDOR, "COMPAL"),
diff --git a/drivers/acpi/ec_sys.c b/drivers/acpi/ec_sys.c
index 6c47ae9..abfdd63 100644
--- a/drivers/acpi/ec_sys.c
@@ -33300,6 +33425,19 @@ index 6c47ae9..abfdd63 100644
err = ec_write(*off, byte_write);
if (err)
return err;
+diff --git a/drivers/acpi/pci_slot.c b/drivers/acpi/pci_slot.c
+index 07f7fea..118388f 100644
+--- a/drivers/acpi/pci_slot.c
++++ b/drivers/acpi/pci_slot.c
+@@ -336,7 +336,7 @@ static int do_sta_before_sun(const struct dmi_system_id *d)
+ return 0;
+ }
+
+-static struct dmi_system_id acpi_pci_slot_dmi_table[] __initdata = {
++static const struct dmi_system_id acpi_pci_slot_dmi_table[] __initconst = {
+ /*
+ * Fujitsu Primequest machines will return 1023 to indicate an
+ * error if the _SUN method is evaluated on SxFy objects that
diff --git a/drivers/acpi/proc.c b/drivers/acpi/proc.c
index 251c7b62..feab1d6 100644
--- a/drivers/acpi/proc.c
@@ -33325,6 +33463,19 @@ index 251c7b62..feab1d6 100644
sscanf(strbuf, "%s", str);
mutex_lock(&acpi_device_lock);
+diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
+index eff7222..fea8ae4 100644
+--- a/drivers/acpi/processor_core.c
++++ b/drivers/acpi/processor_core.c
+@@ -28,7 +28,7 @@ static int __init set_no_mwait(const struct dmi_system_id *id)
+ return 0;
+ }
+
+-static struct dmi_system_id __initdata processor_idle_dmi_table[] = {
++static const struct dmi_system_id __initconst processor_idle_dmi_table[] = {
+ {
+ set_no_mwait, "Extensa 5220", {
+ DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies LTD"),
diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c
index ac28db3..0848b37 100644
--- a/drivers/acpi/processor_driver.c
@@ -33351,6 +33502,19 @@ index 388ba10..d509dbb 100644
struct cpuidle_driver *drv = &acpi_idle_driver;
if (!pr->flags.power_setup_done)
+diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
+index cc9d020..b72fc03 100644
+--- a/drivers/acpi/sleep.c
++++ b/drivers/acpi/sleep.c
+@@ -120,7 +120,7 @@ static int __init init_nvs_nosave(const struct dmi_system_id *d)
+ return 0;
+ }
+
+-static struct dmi_system_id __initdata acpisleep_dmi_table[] = {
++static const struct dmi_system_id __initconst acpisleep_dmi_table[] = {
+ {
+ .callback = init_old_suspend_ordering,
+ .ident = "Abit KN9 (nForce4 variant)",
diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c
index 240a244..bc6239e 100644
--- a/drivers/acpi/sysfs.c
@@ -33369,6 +33533,32 @@ index 240a244..bc6239e 100644
static void delete_gpe_attr_array(void)
{
+diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
+index 48fbc64..d0a31d4 100644
+--- a/drivers/acpi/thermal.c
++++ b/drivers/acpi/thermal.c
+@@ -1110,7 +1110,7 @@ static int thermal_psv(const struct dmi_system_id *d) {
+ return 0;
+ }
+
+-static struct dmi_system_id thermal_dmi_table[] __initdata = {
++static const struct dmi_system_id thermal_dmi_table[] __initconst = {
+ /*
+ * Award BIOS on this AOpen makes thermal control almost worthless.
+ * http://bugzilla.kernel.org/show_bug.cgi?id=8842
+diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
+index 2ebfdd2..fa1ce82 100644
+--- a/drivers/acpi/video.c
++++ b/drivers/acpi/video.c
+@@ -395,7 +395,7 @@ static int video_ignore_initial_backlight(const struct dmi_system_id *d)
+ return 0;
+ }
+
+-static struct dmi_system_id video_dmi_table[] __initdata = {
++static const struct dmi_system_id video_dmi_table[] __initconst = {
+ /*
+ * Broken _BQC workaround http://bugzilla.kernel.org/show_bug.cgi?id=13121
+ */
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
index de2802c..2260da9 100644
--- a/drivers/ata/libahci.c
@@ -35598,6 +35788,19 @@ index 86fe45c..c0ea948 100644
return -EBUSY;
}
+diff --git a/drivers/char/i8k.c b/drivers/char/i8k.c
+index 51efcbc..980f934 100644
+--- a/drivers/char/i8k.c
++++ b/drivers/char/i8k.c
+@@ -607,7 +607,7 @@ static void __exit i8k_exit_hwmon(void)
+ hwmon_device_unregister(i8k_hwmon_dev);
+ }
+
+-static struct dmi_system_id __initdata i8k_dmi_table[] = {
++static const struct dmi_system_id __initconst i8k_dmi_table[] = {
+ {
+ .ident = "Dell Inspiron",
+ .matches = {
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c
index 58c0e63..46c16bf 100644
--- a/drivers/char/ipmi/ipmi_msghandler.c
@@ -37247,7 +37450,7 @@ index edf45ae..2b94e16 100644
/*
* randomize_range() returns a start address such that
diff --git a/drivers/char/sonypi.c b/drivers/char/sonypi.c
-index 1ee8ce7..b778bef 100644
+index 1ee8ce7..586718d 100644
--- a/drivers/char/sonypi.c
+++ b/drivers/char/sonypi.c
@@ -55,6 +55,7 @@
@@ -37288,6 +37491,15 @@ index 1ee8ce7..b778bef 100644
mutex_unlock(&sonypi_device.lock);
return 0;
+@@ -1497,7 +1498,7 @@ static struct platform_driver sonypi_driver = {
+
+ static struct platform_device *sonypi_platform_device;
+
+-static struct dmi_system_id __initdata sonypi_dmi_table[] = {
++static const struct dmi_system_id __initconst sonypi_dmi_table[] = {
+ {
+ .ident = "Sony Vaio",
+ .matches = {
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c
index c234b9e..34c325d 100644
--- a/drivers/char/tpm/tpm.c
@@ -38147,10 +38359,32 @@ index 2a64e69..ac8fe51 100644
/*
* For now we register the efi subsystem with the firmware subsystem
+diff --git a/drivers/firmware/google/gsmi.c b/drivers/firmware/google/gsmi.c
+index c4e7c59..c85004e 100644
+--- a/drivers/firmware/google/gsmi.c
++++ b/drivers/firmware/google/gsmi.c
+@@ -718,7 +718,7 @@ static u32 __init hash_oem_table_id(char s[8])
+ return local_hash_64(input, 32);
+ }
+
+-static struct dmi_system_id gsmi_dmi_table[] __initdata = {
++static const struct dmi_system_id gsmi_dmi_table[] __initconst = {
+ {
+ .ident = "Google Board",
+ .matches = {
diff --git a/drivers/firmware/google/memconsole.c b/drivers/firmware/google/memconsole.c
-index 2a90ba6..07f3733 100644
+index 2a90ba6..72379aa 100644
--- a/drivers/firmware/google/memconsole.c
+++ b/drivers/firmware/google/memconsole.c
+@@ -126,7 +126,7 @@ static bool found_memconsole(void)
+ return false;
+ }
+
+-static struct dmi_system_id memconsole_dmi_table[] __initdata = {
++static const struct dmi_system_id memconsole_dmi_table[] __initconst = {
+ {
+ .ident = "Google Board",
+ .matches = {
@@ -147,7 +147,9 @@ static int __init memconsole_init(void)
if (!found_memconsole())
return -ENODEV;
@@ -40231,7 +40465,7 @@ index f58067f..ed59814 100644
child_device_obj->device.bus = &hv_bus;
child_device_obj->device.parent = &hv_acpi_dev->dev;
diff --git a/drivers/hwmon/acpi_power_meter.c b/drivers/hwmon/acpi_power_meter.c
-index 66f6729..4de8c4a 100644
+index 66f6729..7b6cb19 100644
--- a/drivers/hwmon/acpi_power_meter.c
+++ b/drivers/hwmon/acpi_power_meter.c
@@ -124,7 +124,7 @@ struct rw_sensor_template {
@@ -40270,6 +40504,15 @@ index 66f6729..4de8c4a 100644
&resource->sensors[resource->num_sensors];
int res = 0;
+@@ -981,7 +979,7 @@ static int __init enable_cap_knobs(const struct dmi_system_id *d)
+ return 0;
+ }
+
+-static struct dmi_system_id __initdata pm_dmi_table[] = {
++static const struct dmi_system_id __initconst pm_dmi_table[] = {
+ {
+ enable_cap_knobs, "IBM Active Energy Manager",
+ {
diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
index 0b86d47..8066c3f 100644
--- a/drivers/hwmon/applesmc.c
@@ -42098,6 +42341,19 @@ index 4d4cd14..d6fdd87 100644
kref_init(&serio_raw->kref);
INIT_LIST_HEAD(&serio_raw->client_list);
init_waitqueue_head(&serio_raw->wait);
+diff --git a/drivers/input/touchscreen/htcpen.c b/drivers/input/touchscreen/htcpen.c
+index 62811de..2e1bd7f 100644
+--- a/drivers/input/touchscreen/htcpen.c
++++ b/drivers/input/touchscreen/htcpen.c
+@@ -227,7 +227,7 @@ static struct isa_driver htcpen_isa_driver = {
+ }
+ };
+
+-static struct dmi_system_id __initdata htcshift_dmi_table[] = {
++static const struct dmi_system_id __initconst htcshift_dmi_table[] = {
+ {
+ .ident = "Shift",
+ .matches = {
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
index 486982f..1e8058b 100644
--- a/drivers/iommu/amd_iommu.c
@@ -43295,9 +43551,39 @@ index abac83a..3652f35 100644
rdev_dec_pending(rdev, mddev);
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
-index c293d9c..73e0cd7 100644
+index c293d9c..808ae97 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
+@@ -598,23 +598,23 @@ async_copy_data(int frombio, struct bio *bio, struct page *page,
+ struct bio_vec *bvl;
+ struct page *bio_page;
+ int i;
+- int page_offset;
++ s64 page_offset;
+ struct async_submit_ctl submit;
+ enum async_tx_flags flags = 0;
+
+ if (bio->bi_sector >= sector)
+- page_offset = (signed)(bio->bi_sector - sector) * 512;
++ page_offset = (s64)(bio->bi_sector - sector) * 512;
+ else
+- page_offset = (signed)(sector - bio->bi_sector) * -512;
++ page_offset = (s64)(sector - bio->bi_sector) * -512;
+
+ if (frombio)
+ flags |= ASYNC_TX_FENCE;
+ init_async_submit(&submit, flags, tx, NULL, NULL, NULL);
+
+ bio_for_each_segment(bvl, bio, i) {
+- int len = bvl->bv_len;
+- int clen;
+- int b_offset = 0;
++ s64 len = bvl->bv_len;
++ s64 clen;
++ s64 b_offset = 0;
+
+ if (page_offset < 0) {
+ b_offset = -page_offset;
@@ -1364,6 +1364,10 @@ static int grow_one_stripe(struct r5conf *conf)
return 1;
}
@@ -45937,6 +46223,19 @@ index d4d2bc1..14b8672 100644
};
static int stmmac_init_fs(struct net_device *dev)
+diff --git a/drivers/net/ethernet/via/via-rhine.c b/drivers/net/ethernet/via/via-rhine.c
+index f37e0ae..a273c4a 100644
+--- a/drivers/net/ethernet/via/via-rhine.c
++++ b/drivers/net/ethernet/via/via-rhine.c
+@@ -2299,7 +2299,7 @@ static struct pci_driver rhine_driver = {
+ .shutdown = rhine_shutdown,
+ };
+
+-static struct dmi_system_id __initdata rhine_dmi_table[] = {
++static const struct dmi_system_id __initconst rhine_dmi_table[] = {
+ {
+ .ident = "EPIA-M",
+ .matches = {
diff --git a/drivers/net/ifb.c b/drivers/net/ifb.c
index 00f1367..bfcb2f6 100644
--- a/drivers/net/ifb.c
@@ -47716,6 +48015,19 @@ index c73ed00..cc3edec 100644
#define ASPM_STATE_L0S (ASPM_STATE_L0S_UP | ASPM_STATE_L0S_DW)
#define ASPM_STATE_ALL (ASPM_STATE_L0S | ASPM_STATE_L1)
+diff --git a/drivers/pci/pcie/portdrv_pci.c b/drivers/pci/pcie/portdrv_pci.c
+index 7e41b70..6e34f30 100644
+--- a/drivers/pci/pcie/portdrv_pci.c
++++ b/drivers/pci/pcie/portdrv_pci.c
+@@ -337,7 +337,7 @@ static int __init dmi_pcie_pme_disable_msi(const struct dmi_system_id *d)
+ return 0;
+ }
+
+-static struct dmi_system_id __initdata pcie_portdrv_dmi_table[] = {
++static const struct dmi_system_id __initconst pcie_portdrv_dmi_table[] = {
+ /*
+ * Boxes that should not use MSI for PCIe PME signaling.
+ */
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index bc92c47..47e01d7 100644
--- a/drivers/pci/probe.c
@@ -47787,10 +48099,71 @@ index 26fba2d..693b4d3 100644
status = wmi_evaluate_method(ASUS_WMI_MGMT_GUID,
1, asus->debug.method_id,
&input, &output);
+diff --git a/drivers/platform/x86/compal-laptop.c b/drivers/platform/x86/compal-laptop.c
+index 8877b83..024cf2c 100644
+--- a/drivers/platform/x86/compal-laptop.c
++++ b/drivers/platform/x86/compal-laptop.c
+@@ -775,7 +775,7 @@ static int dmi_check_cb_extra(const struct dmi_system_id *id)
+ return 1;
+ }
+
+-static struct dmi_system_id __initdata compal_dmi_table[] = {
++static const struct dmi_system_id __initconst compal_dmi_table[] = {
+ {
+ .ident = "FL90/IFL90",
+ .matches = {
+diff --git a/drivers/platform/x86/hdaps.c b/drivers/platform/x86/hdaps.c
+index 5a34973..bb006d3 100644
+--- a/drivers/platform/x86/hdaps.c
++++ b/drivers/platform/x86/hdaps.c
+@@ -511,7 +511,7 @@ static int __init hdaps_dmi_match_invert(const struct dmi_system_id *id)
+ "ThinkPad T42p", so the order of the entries matters.
+ If your ThinkPad is not recognized, please update to latest
+ BIOS. This is especially the case for some R52 ThinkPads. */
+-static struct dmi_system_id __initdata hdaps_whitelist[] = {
++static const struct dmi_system_id __initconst hdaps_whitelist[] = {
+ HDAPS_DMI_MATCH_INVERT("IBM", "ThinkPad R50p", HDAPS_BOTH_AXES),
+ HDAPS_DMI_MATCH_NORMAL("IBM", "ThinkPad R50"),
+ HDAPS_DMI_MATCH_NORMAL("IBM", "ThinkPad R51"),
+diff --git a/drivers/platform/x86/ibm_rtl.c b/drivers/platform/x86/ibm_rtl.c
+index 2704386..2229492 100644
+--- a/drivers/platform/x86/ibm_rtl.c
++++ b/drivers/platform/x86/ibm_rtl.c
+@@ -238,7 +238,7 @@ static void rtl_teardown_sysfs(void) {
+ }
+
+
+-static struct dmi_system_id __initdata ibm_rtl_dmi_table[] = {
++static const struct dmi_system_id __initconst ibm_rtl_dmi_table[] = {
+ { \
+ .matches = { \
+ DMI_MATCH(DMI_SYS_VENDOR, "IBM"), \
+diff --git a/drivers/platform/x86/intel_oaktrail.c b/drivers/platform/x86/intel_oaktrail.c
+index 7f88c79..3b5a7a2 100644
+--- a/drivers/platform/x86/intel_oaktrail.c
++++ b/drivers/platform/x86/intel_oaktrail.c
+@@ -303,7 +303,7 @@ static int dmi_check_cb(const struct dmi_system_id *id)
+ return 0;
+ }
+
+-static struct dmi_system_id __initdata oaktrail_dmi_table[] = {
++static const struct dmi_system_id __initconst oaktrail_dmi_table[] = {
+ {
+ .ident = "OakTrail platform",
+ .matches = {
diff --git a/drivers/platform/x86/msi-laptop.c b/drivers/platform/x86/msi-laptop.c
-index f204643..9ccea74 100644
+index f204643..df8cb2e 100644
--- a/drivers/platform/x86/msi-laptop.c
+++ b/drivers/platform/x86/msi-laptop.c
+@@ -451,7 +451,7 @@ static int dmi_check_cb(const struct dmi_system_id *id)
+ return 1;
+ }
+
+-static struct dmi_system_id __initdata msi_dmi_table[] = {
++static const struct dmi_system_id __initconst msi_dmi_table[] = {
+ {
+ .ident = "MSI S270",
+ .matches = {
@@ -815,12 +815,14 @@ static int __init load_scm_model_init(struct platform_device *sdev)
int result;
@@ -47825,6 +48198,45 @@ index b96766b..909c5a0 100644
union acpi_object *obj;
ktime_t cur;
acpi_status status;
+diff --git a/drivers/platform/x86/samsung-laptop.c b/drivers/platform/x86/samsung-laptop.c
+index 64e1f2d..fbd2115 100644
+--- a/drivers/platform/x86/samsung-laptop.c
++++ b/drivers/platform/x86/samsung-laptop.c
+@@ -543,7 +543,7 @@ static DEVICE_ATTR(performance_level, S_IWUSR | S_IRUGO,
+ get_performance_level, set_performance_level);
+
+
+-static struct dmi_system_id __initdata samsung_dmi_table[] = {
++static const struct dmi_system_id __initconst samsung_dmi_table[] = {
+ {
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR,
+diff --git a/drivers/platform/x86/samsung-q10.c b/drivers/platform/x86/samsung-q10.c
+index 1e54ae7..bb6f7b2 100644
+--- a/drivers/platform/x86/samsung-q10.c
++++ b/drivers/platform/x86/samsung-q10.c
+@@ -130,7 +130,7 @@ static int __init dmi_check_callback(const struct dmi_system_id *id)
+ return 1;
+ }
+
+-static struct dmi_system_id __initdata samsungq10_dmi_table[] = {
++static const struct dmi_system_id __initconst samsungq10_dmi_table[] = {
+ {
+ .ident = "Samsung Q10",
+ .matches = {
+diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c
+index 40c4705..d4d41b70 100644
+--- a/drivers/platform/x86/sony-laptop.c
++++ b/drivers/platform/x86/sony-laptop.c
+@@ -3385,7 +3385,7 @@ static struct acpi_driver sony_pic_driver = {
+ },
+ };
+
+-static struct dmi_system_id __initdata sonypi_dmi_table[] = {
++static const struct dmi_system_id __initconst sonypi_dmi_table[] = {
+ {
+ .ident = "Sony Vaio",
+ .matches = {
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
index 2a8d6aa..29b1bcb 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
@@ -48030,6 +48442,19 @@ index b859d16..5cc6b1a 100644
+
+ pax_close_kernel();
}
+diff --git a/drivers/pnp/pnpbios/core.c b/drivers/pnp/pnpbios/core.c
+index cfe8685..524a913 100644
+--- a/drivers/pnp/pnpbios/core.c
++++ b/drivers/pnp/pnpbios/core.c
+@@ -492,7 +492,7 @@ static int __init exploding_pnp_bios(const struct dmi_system_id *d)
+ return 0;
+ }
+
+-static struct dmi_system_id pnpbios_dmi_table[] __initdata = {
++static const struct dmi_system_id pnpbios_dmi_table[] __initconst = {
+ { /* PnPBIOS GPF on boot */
+ .callback = exploding_pnp_bios,
+ .ident = "Higraded P14H",
diff --git a/drivers/pnp/resource.c b/drivers/pnp/resource.c
index b0ecacb..7c9da2e 100644
--- a/drivers/pnp/resource.c
@@ -56200,6 +56625,37 @@ index 4a88ac3..d2e1657 100644
}
EXPORT_SYMBOL_GPL(virtqueue_kick);
+diff --git a/drivers/xen/events.c b/drivers/xen/events.c
+index f6227cc..3e22fab 100644
+--- a/drivers/xen/events.c
++++ b/drivers/xen/events.c
+@@ -1632,7 +1632,7 @@ void xen_irq_resume(void)
+ restore_pirqs();
+ }
+
+-static struct irq_chip xen_dynamic_chip __read_mostly = {
++static struct irq_chip xen_dynamic_chip = {
+ .name = "xen-dyn",
+
+ .irq_disable = disable_dynirq,
+@@ -1646,7 +1646,7 @@ static struct irq_chip xen_dynamic_chip __read_mostly = {
+ .irq_retrigger = retrigger_dynirq,
+ };
+
+-static struct irq_chip xen_pirq_chip __read_mostly = {
++static struct irq_chip xen_pirq_chip = {
+ .name = "xen-pirq",
+
+ .irq_startup = startup_pirq,
+@@ -1666,7 +1666,7 @@ static struct irq_chip xen_pirq_chip __read_mostly = {
+ .irq_retrigger = retrigger_dynirq,
+ };
+
+-static struct irq_chip xen_percpu_chip __read_mostly = {
++static struct irq_chip xen_percpu_chip = {
+ .name = "xen-percpu",
+
+ .irq_disable = disable_dynirq,
diff --git a/drivers/xen/xenfs/super.c b/drivers/xen/xenfs/super.c
index 1aa3897..3a6b3f1 100644
--- a/drivers/xen/xenfs/super.c
@@ -60740,7 +61196,7 @@ index 9d1c995..7685971 100644
static int __init
vxfs_init(void)
diff --git a/fs/fs_struct.c b/fs/fs_struct.c
-index 78b519c..b6e3076 100644
+index 78b519c..8445fa6 100644
--- a/fs/fs_struct.c
+++ b/fs/fs_struct.c
@@ -4,6 +4,7 @@
@@ -60813,7 +61269,7 @@ index 78b519c..b6e3076 100644
fs->in_exec = 0;
spin_lock_init(&fs->lock);
seqcount_init(&fs->seq);
-@@ -132,6 +146,9 @@ struct fs_struct *copy_fs_struct(struct fs_struct *old)
+@@ -132,9 +146,13 @@ struct fs_struct *copy_fs_struct(struct fs_struct *old)
spin_lock(&old->lock);
fs->root = old->root;
path_get_longterm(&fs->root);
@@ -60823,7 +61279,11 @@ index 78b519c..b6e3076 100644
fs->pwd = old->pwd;
path_get_longterm(&fs->pwd);
spin_unlock(&old->lock);
-@@ -150,8 +167,9 @@ int unshare_fs_struct(void)
++ gr_inc_chroot_refcnts(fs->root.dentry, fs->root.mnt);
+ }
+ return fs;
+ }
+@@ -150,8 +168,9 @@ int unshare_fs_struct(void)
task_lock(current);
spin_lock(&fs->lock);
@@ -60834,7 +61294,7 @@ index 78b519c..b6e3076 100644
spin_unlock(&fs->lock);
task_unlock(current);
-@@ -164,13 +182,13 @@ EXPORT_SYMBOL_GPL(unshare_fs_struct);
+@@ -164,13 +183,13 @@ EXPORT_SYMBOL_GPL(unshare_fs_struct);
int current_umask(void)
{
@@ -60850,7 +61310,7 @@ index 78b519c..b6e3076 100644
.lock = __SPIN_LOCK_UNLOCKED(init_fs.lock),
.seq = SEQCNT_ZERO,
.umask = 0022,
-@@ -186,12 +204,13 @@ void daemonize_fs_struct(void)
+@@ -186,12 +205,13 @@ void daemonize_fs_struct(void)
task_lock(current);
spin_lock(&init_fs.lock);
@@ -80456,7 +80916,7 @@ index cdd1cc2..2401b2e 100644
* (asm goto is automatically volatile - the naming reflects this.)
*/
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
-index 7c7546b..92ea3ae 100644
+index 7c7546b..588d7d2 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -5,31 +5,51 @@
@@ -80577,7 +81037,16 @@ index 7c7546b..92ea3ae 100644
/* Simple shorthand for a section definition */
#ifndef __section
# define __section(S) __attribute__ ((__section__(#S)))
-@@ -296,6 +358,18 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);
+@@ -287,6 +349,8 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);
+ # define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
+ #endif
+
++#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))
++
+ /* Compile time object size, -1 for unknown */
+ #ifndef __compiletime_object_size
+ # define __compiletime_object_size(obj) -1
+@@ -296,6 +360,18 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);
#endif
#ifndef __compiletime_error
# define __compiletime_error(message)
@@ -80596,7 +81065,7 @@ index 7c7546b..92ea3ae 100644
#endif
/*
-@@ -310,6 +384,7 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);
+@@ -310,6 +386,7 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);
* use is to mediate communication between process-level code and irq/NMI
* handlers, all running on the same CPU.
*/
@@ -83605,6 +84074,19 @@ index de3a321..8fb84fc 100644
static inline void mm_init_cpumask(struct mm_struct *mm)
{
+diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h
+index 174a844..11483c2 100644
+--- a/include/linux/mmc/core.h
++++ b/include/linux/mmc/core.h
+@@ -76,7 +76,7 @@ struct mmc_command {
+ #define mmc_cmd_type(cmd) ((cmd)->flags & MMC_CMD_MASK)
+
+ unsigned int retries; /* max number of retries */
+- unsigned int error; /* command error */
++ int error; /* command error */
+
+ /*
+ * Standard errno values are used for errors, but some have specific
diff --git a/include/linux/mmiotrace.h b/include/linux/mmiotrace.h
index c5d5278..f0b68c8 100644
--- a/include/linux/mmiotrace.h
@@ -85909,10 +86391,10 @@ index ea0c02f..0eed39d 100644
#ifdef __arch_swab64
return __arch_swab64(val);
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
-index 86a24b11..e6974f1 100644
+index 86a24b11..b6048c1 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
-@@ -83,12 +83,20 @@ struct file_handle;
+@@ -83,12 +83,19 @@ struct file_handle;
#define __SC_DECL5(t5, a5, ...) t5 a5, __SC_DECL4(__VA_ARGS__)
#define __SC_DECL6(t6, a6, ...) t6 a6, __SC_DECL5(__VA_ARGS__)
@@ -85922,12 +86404,11 @@ index 86a24b11..e6974f1 100644
-#define __SC_LONG4(t4, a4, ...) long a4, __SC_LONG3(__VA_ARGS__)
-#define __SC_LONG5(t5, a5, ...) long a5, __SC_LONG4(__VA_ARGS__)
-#define __SC_LONG6(t6, a6, ...) long a6, __SC_LONG5(__VA_ARGS__)
-+#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))
+#define __SC_TYPE(t, a) __typeof( \
+ __builtin_choose_expr( \
+ sizeof(t) > sizeof(int), \
+ (t) 0, \
-+ __builtin_choose_expr(__TYPE_IS_U(t), 0UL, 0L) \
++ __builtin_choose_expr(__type_is_unsigned(t), 0UL, 0L) \
+ )) a
+
+#define __SC_LONG1(t1, a1) __SC_TYPE(t1, a1)
@@ -85939,7 +86420,7 @@ index 86a24b11..e6974f1 100644
#define __SC_CAST1(t1, a1) (t1) a1
#define __SC_CAST2(t2, a2, ...) (t2) a2, __SC_CAST1(__VA_ARGS__)
-@@ -392,11 +400,11 @@ asmlinkage long sys_sync(void);
+@@ -392,11 +399,11 @@ asmlinkage long sys_sync(void);
asmlinkage long sys_fsync(unsigned int fd);
asmlinkage long sys_fdatasync(unsigned int fd);
asmlinkage long sys_bdflush(int func, long data);
@@ -85955,7 +86436,7 @@ index 86a24b11..e6974f1 100644
asmlinkage long sys_truncate(const char __user *path, long length);
asmlinkage long sys_ftruncate(unsigned int fd, unsigned long length);
asmlinkage long sys_stat(const char __user *filename,
-@@ -608,7 +616,7 @@ asmlinkage long sys_getsockname(int, struct sockaddr __user *, int __user *);
+@@ -608,7 +615,7 @@ asmlinkage long sys_getsockname(int, struct sockaddr __user *, int __user *);
asmlinkage long sys_getpeername(int, struct sockaddr __user *, int __user *);
asmlinkage long sys_send(int, void __user *, size_t, unsigned);
asmlinkage long sys_sendto(int, void __user *, size_t, unsigned,
@@ -87217,10 +87698,18 @@ index 252fd10..aa1421f 100644
extern int nf_register_queue_handler(u_int8_t pf,
const struct nf_queue_handler *qh);
diff --git a/include/net/netlink.h b/include/net/netlink.h
-index cb1f350..3279d2c 100644
+index cb1f350..55e1f96 100644
--- a/include/net/netlink.h
+++ b/include/net/netlink.h
-@@ -569,7 +569,7 @@ static inline void *nlmsg_get_pos(struct sk_buff *skb)
+@@ -135,6 +135,7 @@
+ * nla_get_u16(nla) get payload for a u16 attribute
+ * nla_get_u32(nla) get payload for a u32 attribute
+ * nla_get_u64(nla) get payload for a u64 attribute
++ * nla_get_s32(nla) get payload for a s32 attribute
+ * nla_get_flag(nla) return 1 if flag is true
+ * nla_get_msecs(nla) get payload for a msecs attribute
+ *
+@@ -569,7 +570,7 @@ static inline void *nlmsg_get_pos(struct sk_buff *skb)
static inline void nlmsg_trim(struct sk_buff *skb, const void *mark)
{
if (mark)
@@ -87229,6 +87718,22 @@ index cb1f350..3279d2c 100644
}
/**
+@@ -998,6 +999,15 @@ static inline __be64 nla_get_be64(const struct nlattr *nla)
+ }
+
+ /**
++ * nla_get_s32 - return payload of s32 attribute
++ * @nla: s32 netlink attribute
++ */
++static inline s32 nla_get_s32(const struct nlattr *nla)
++{
++ return *(s32 *) nla_data(nla);
++}
++
++/**
+ * nla_get_flag - return payload of flag attribute
+ * @nla: flag netlink attribute
+ */
diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h
index d786b4f..4c3dd41 100644
--- a/include/net/netns/ipv4.h
@@ -97470,7 +97975,7 @@ index d53adf9..03a24bf 100644
set_fs(old_fs);
diff --git a/mm/madvise.c b/mm/madvise.c
-index 23d3a6b..e10d35a 100644
+index 23d3a6b..76f0f839 100644
--- a/mm/madvise.c
+++ b/mm/madvise.c
@@ -46,6 +46,10 @@ static long madvise_behavior(struct vm_area_struct * vma,
@@ -97523,9 +98028,9 @@ index 23d3a6b..e10d35a 100644
+ .nonlinear_vma = vma_m,
+ .last_index = ULONG_MAX,
+ };
-+ zap_page_range(vma, start + SEGMEXEC_TASK_SIZE, end - start, &details);
++ zap_page_range(vma_m, start + SEGMEXEC_TASK_SIZE, end - start, &details);
+ } else
-+ zap_page_range(vma, start + SEGMEXEC_TASK_SIZE, end - start, NULL);
++ zap_page_range(vma_m, start + SEGMEXEC_TASK_SIZE, end - start, NULL);
+ }
+#endif
+
@@ -107278,6 +107783,19 @@ index dc8d7ef..9d37285 100644
} while (!res);
return res;
}
+diff --git a/net/l2tp/l2tp_ip.c b/net/l2tp/l2tp_ip.c
+index 334a93d..ee97cfd 100644
+--- a/net/l2tp/l2tp_ip.c
++++ b/net/l2tp/l2tp_ip.c
+@@ -667,7 +667,7 @@ static struct inet_protosw l2tp_ip_protosw = {
+ .no_check = 0,
+ };
+
+-static struct net_protocol l2tp_ip_protocol __read_mostly = {
++static const struct net_protocol l2tp_ip_protocol = {
+ .handler = l2tp_ip_recv,
+ };
+
diff --git a/net/l2tp/l2tp_netlink.c b/net/l2tp/l2tp_netlink.c
index 93a41a0..d4b4edb 100644
--- a/net/l2tp/l2tp_netlink.c
@@ -115299,7 +115817,7 @@ index 0000000..60e7af2
+randomize_layout_hash.h
diff --git a/tools/gcc/Makefile b/tools/gcc/Makefile
new file mode 100644
-index 0000000..7b8921f
+index 0000000..a51677e
--- /dev/null
+++ b/tools/gcc/Makefile
@@ -0,0 +1,52 @@
@@ -115315,7 +115833,7 @@ index 0000000..7b8921f
+export HOST_EXTRACFLAGS
+else
+HOSTLIBS := hostcxxlibs
-+HOST_EXTRACXXFLAGS += -I$(GCCPLUGINS_DIR)/include -I$(src) -std=gnu++98 -fno-rtti -ggdb -Wno-unused-parameter -Wno-narrowing -Wno-unused-variable
++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
+export HOST_EXTRACXXFLAGS
+endif
+
@@ -116303,10 +116821,10 @@ index 0000000..93b181d
+}
diff --git a/tools/gcc/gcc-common.h b/tools/gcc/gcc-common.h
new file mode 100644
-index 0000000..19fedf2
+index 0000000..d8ec362
--- /dev/null
+++ b/tools/gcc/gcc-common.h
-@@ -0,0 +1,540 @@
+@@ -0,0 +1,666 @@
+#ifndef GCC_COMMON_H_INCLUDED
+#define GCC_COMMON_H_INCLUDED
+
@@ -116629,13 +117147,6 @@ index 0000000..19fedf2
+}
+#endif
+
-+#if BUILDING_GCC_VERSION >= 4007
-+#define cgraph_create_edge(caller, callee, call_stmt, count, freq, nest) \
-+ cgraph_create_edge((caller), (callee), (call_stmt), (count), (freq))
-+#define cgraph_create_edge_including_clones(caller, callee, old_call_stmt, call_stmt, count, freq, nest, reason) \
-+ cgraph_create_edge_including_clones((caller), (callee), (old_call_stmt), (call_stmt), (count), (freq), (reason))
-+#endif
-+
+#if BUILDING_GCC_VERSION == 4007 || BUILDING_GCC_VERSION == 4008
+static inline struct cgraph_node *cgraph_alias_target(struct cgraph_node *n)
+{
@@ -116643,6 +117154,13 @@ index 0000000..19fedf2
+}
+#endif
+
++#if BUILDING_GCC_VERSION >= 4007 && BUILDING_GCC_VERSION <= 4009
++#define cgraph_create_edge(caller, callee, call_stmt, count, freq, nest) \
++ cgraph_create_edge((caller), (callee), (call_stmt), (count), (freq))
++#define cgraph_create_edge_including_clones(caller, callee, old_call_stmt, call_stmt, count, freq, nest, reason) \
++ cgraph_create_edge_including_clones((caller), (callee), (old_call_stmt), (call_stmt), (count), (freq), (reason))
++#endif
++
+#if BUILDING_GCC_VERSION <= 4008
+#define ENTRY_BLOCK_PTR_FOR_FN(FN) ENTRY_BLOCK_PTR_FOR_FUNCTION(FN)
+#define EXIT_BLOCK_PTR_FOR_FN(FN) EXIT_BLOCK_PTR_FOR_FUNCTION(FN)
@@ -116655,6 +117173,40 @@ index 0000000..19fedf2
+#define BASIC_BLOCK_FOR_FN(FN, N) BASIC_BLOCK_FOR_FUNCTION((FN), (N))
+#define NODE_IMPLICIT_ALIAS(node) (node)->same_body_alias
+
++static inline bool tree_fits_shwi_p(const_tree t)
++{
++ if (t == NULL_TREE || TREE_CODE(t) != INTEGER_CST)
++ return false;
++
++ if (TREE_INT_CST_HIGH(t) == 0 && (HOST_WIDE_INT)TREE_INT_CST_LOW(t) >= 0)
++ return true;
++
++ if (TREE_INT_CST_HIGH(t) == -1 && (HOST_WIDE_INT)TREE_INT_CST_LOW(t) < 0 && !TYPE_UNSIGNED(TREE_TYPE(t)))
++ return true;
++
++ return false;
++}
++
++static inline bool tree_fits_uhwi_p(const_tree t)
++{
++ if (t == NULL_TREE || TREE_CODE(t) != INTEGER_CST)
++ return false;
++
++ return TREE_INT_CST_HIGH(t) == 0;
++}
++
++static inline HOST_WIDE_INT tree_to_shwi(const_tree t)
++{
++ gcc_assert(tree_fits_shwi_p(t));
++ return TREE_INT_CST_LOW(t);
++}
++
++static inline unsigned HOST_WIDE_INT tree_to_uhwi(const_tree t)
++{
++ gcc_assert(tree_fits_uhwi_p(t));
++ return TREE_INT_CST_LOW(t);
++}
++
+static inline const char *get_tree_code_name(enum tree_code code)
+{
+ gcc_assert(code < MAX_TREE_CODES);
@@ -116665,6 +117217,7 @@ index 0000000..19fedf2
+typedef union gimple_statement_d gasm;
+typedef union gimple_statement_d gassign;
+typedef union gimple_statement_d gcall;
++typedef union gimple_statement_d gcond;
+typedef union gimple_statement_d gdebug;
+typedef union gimple_statement_d gphi;
+typedef union gimple_statement_d greturn;
@@ -116692,6 +117245,7 @@ index 0000000..19fedf2
+typedef struct gimple_statement_base gasm;
+typedef struct gimple_statement_base gassign;
+typedef struct gimple_statement_base gcall;
++typedef struct gimple_statement_base gcond;
+typedef struct gimple_statement_base gdebug;
+typedef struct gimple_statement_base gphi;
+typedef struct gimple_statement_base greturn;
@@ -116705,15 +117259,50 @@ index 0000000..19fedf2
+ return stmt;
+}
+
++static inline const gasm *as_a_const_gasm(const_gimple stmt)
++{
++ return stmt;
++}
++
++static inline gassign *as_a_gassign(gimple stmt)
++{
++ return stmt;
++}
++
++static inline const gassign *as_a_const_gassign(const_gimple stmt)
++{
++ return stmt;
++}
++
+static inline gcall *as_a_gcall(gimple stmt)
+{
+ return stmt;
+}
+
++static inline const gcall *as_a_const_gcall(const_gimple stmt)
++{
++ return stmt;
++}
++
++static inline gphi *as_a_gphi(gimple stmt)
++{
++ return stmt;
++}
++
++static inline const gphi *as_a_const_gphi(const_gimple stmt)
++{
++ return stmt;
++}
++
+static inline greturn *as_a_greturn(gimple stmt)
+{
+ return stmt;
+}
++
++static inline const greturn *as_a_const_greturn(const_gimple stmt)
++{
++ return stmt;
++}
+#endif
+
+#if BUILDING_GCC_VERSION >= 4009
@@ -116730,17 +117319,23 @@ index 0000000..19fedf2
+#define TODO_verify_stmts TODO_verify_il
+#define TODO_verify_rtl_sharing TODO_verify_il
+
-+#define TREE_INT_CST_HIGH(NODE) ({ TREE_INT_CST_EXT_NUNITS(NODE) > 1 ? (unsigned HOST_WIDE_INT)TREE_INT_CST_ELT(NODE, 1) : 0; })
++//#define TREE_INT_CST_HIGH(NODE) ({ TREE_INT_CST_EXT_NUNITS(NODE) > 1 ? (unsigned HOST_WIDE_INT)TREE_INT_CST_ELT(NODE, 1) : 0; })
+
+#define INSN_DELETED_P(insn) (insn)->deleted()
+
+// symtab/cgraph related
+#define debug_cgraph_node(node) (node)->debug()
+#define cgraph_get_node(decl) cgraph_node::get(decl)
++#define cgraph_get_create_node(decl) cgraph_node::get_create(decl)
+#define cgraph_n_nodes symtab->cgraph_count
+#define cgraph_max_uid symtab->cgraph_max_uid
+#define varpool_get_node(decl) varpool_node::get(decl)
+
++#define cgraph_create_edge(caller, callee, call_stmt, count, freq, nest) \
++ (caller)->create_edge((callee), (call_stmt), (count), (freq))
++#define cgraph_create_edge_including_clones(caller, callee, old_call_stmt, call_stmt, count, freq, nest, reason) \
++ (caller)->create_edge_including_clones((callee), (old_call_stmt), (call_stmt), (count), (freq), (reason))
++
+typedef struct cgraph_node *cgraph_node_ptr;
+typedef struct cgraph_edge *cgraph_edge_p;
+typedef struct varpool_node *varpool_node_ptr;
@@ -116816,26 +117411,70 @@ index 0000000..19fedf2
+ return gimple_build_assign(lhs, subcode, op1, op2 PASS_MEM_STAT);
+}
+
++template <>
++template <>
++inline bool is_a_helper<const gassign *>::test(const_gimple gs)
++{
++ return gs->code == GIMPLE_ASSIGN;
++}
++
++template <>
++template <>
++inline bool is_a_helper<const greturn *>::test(const_gimple gs)
++{
++ return gs->code == GIMPLE_RETURN;
++}
++
+static inline gasm *as_a_gasm(gimple stmt)
+{
+ return as_a<gasm *>(stmt);
+}
+
-+static inline const gasm *as_a_gasm(const_gimple stmt)
++static inline const gasm *as_a_const_gasm(const_gimple stmt)
+{
+ return as_a<const gasm *>(stmt);
+}
+
++static inline gassign *as_a_gassign(gimple stmt)
++{
++ return as_a<gassign *>(stmt);
++}
++
++static inline const gassign *as_a_const_gassign(const_gimple stmt)
++{
++ return as_a<const gassign *>(stmt);
++}
++
+static inline gcall *as_a_gcall(gimple stmt)
+{
+ return as_a<gcall *>(stmt);
+}
+
++static inline const gcall *as_a_const_gcall(const_gimple stmt)
++{
++ return as_a<const gcall *>(stmt);
++}
++
++static inline gphi *as_a_gphi(gimple stmt)
++{
++ return as_a<gphi *>(stmt);
++}
++
++static inline const gphi *as_a_const_gphi(const_gimple stmt)
++{
++ return as_a<const gphi *>(stmt);
++}
++
+static inline greturn *as_a_greturn(gimple stmt)
+{
+ return as_a<greturn *>(stmt);
+}
+
++static inline const greturn *as_a_const_greturn(const_gimple stmt)
++{
++ return as_a<const greturn *>(stmt);
++}
++
+// IPA/LTO related
+#define ipa_ref_list_referring_iterate(L,I,P) (L)->referring.iterate((I), &(P))
+#define ipa_ref_list_reference_iterate(L,I,P) (L)->reference.iterate((I), &(P))
@@ -116844,6 +117483,11 @@ index 0000000..19fedf2
+{
+ return dyn_cast<cgraph_node_ptr>(ref->referring);
+}
++
++static inline void ipa_remove_stmt_references(symtab_node *referring_node, gimple stmt)
++{
++ referring_node->remove_stmt_references(stmt);
++}
+#endif
+
+#endif
@@ -117057,7 +117701,7 @@ index 0000000..457d54e
+}
diff --git a/tools/gcc/kernexec_plugin.c b/tools/gcc/kernexec_plugin.c
new file mode 100644
-index 0000000..71716e7
+index 0000000..b0d8255
--- /dev/null
+++ b/tools/gcc/kernexec_plugin.c
@@ -0,0 +1,547 @@
@@ -117212,9 +117856,9 @@ index 0000000..71716e7
+ new_fptr = make_ssa_name(new_fptr, NULL);
+
+ // build asm volatile("orq %%r12, %0\n\t" : "=r"(new_fptr) : "0"(old_fptr));
-+ input = build_tree_list(NULL_TREE, build_string(1, "0"));
++ input = build_tree_list(NULL_TREE, build_string(2, "0"));
+ input = chainon(NULL_TREE, build_tree_list(input, old_fptr));
-+ output = build_tree_list(NULL_TREE, build_string(2, "=r"));
++ output = build_tree_list(NULL_TREE, build_string(3, "=r"));
+ output = chainon(NULL_TREE, build_tree_list(output, new_fptr));
+#if BUILDING_GCC_VERSION <= 4007
+ VEC_safe_push(tree, gc, inputs, input);
@@ -117610,10 +118254,10 @@ index 0000000..71716e7
+}
diff --git a/tools/gcc/latent_entropy_plugin.c b/tools/gcc/latent_entropy_plugin.c
new file mode 100644
-index 0000000..d383708
+index 0000000..ac6f9b4
--- /dev/null
+++ b/tools/gcc/latent_entropy_plugin.c
-@@ -0,0 +1,473 @@
+@@ -0,0 +1,474 @@
+/*
+ * Copyright 2012-2015 by the PaX Team <pageexec@freemail.hu>
+ * Licensed under the GPL v2
@@ -117632,7 +118276,7 @@ index 0000000..d383708
+ * - more instrumentation control via attribute parameters
+ *
+ * BUGS:
-+ * - LTO needs -flto-partition=none for now
++ * - none known
+ */
+
+#include "gcc-common.h"
@@ -117642,7 +118286,7 @@ index 0000000..d383708
+static GTY(()) tree latent_entropy_decl;
+
+static struct plugin_info latent_entropy_plugin_info = {
-+ .version = "201409101820",
++ .version = "201504282240",
+ .help = NULL
+};
+
@@ -117920,6 +118564,8 @@ index 0000000..d383708
+ FOR_EACH_VARIABLE(node) {
+ tree var = NODE_DECL(node);
+
++ if (DECL_NAME_LENGTH(var) < sizeof("latent_entropy") - 1)
++ continue;
+ if (strcmp(IDENTIFIER_POINTER(DECL_NAME(var)), "latent_entropy"))
+ continue;
+ latent_entropy_decl = var;
@@ -118080,8 +118726,7 @@ index 0000000..d383708
+
+ register_callback(plugin_name, PLUGIN_INFO, NULL, &latent_entropy_plugin_info);
+ register_callback(plugin_name, PLUGIN_START_UNIT, &latent_entropy_start_unit, NULL);
-+ if (!in_lto_p)
-+ register_callback(plugin_name, PLUGIN_REGISTER_GGC_ROOTS, NULL, (void *)&gt_ggc_r_gt_latent_entropy);
++ register_callback(plugin_name, PLUGIN_REGISTER_GGC_ROOTS, NULL, (void *)&gt_ggc_r_gt_latent_entropy);
+ register_callback(plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &latent_entropy_pass_info);
+ register_callback(plugin_name, PLUGIN_ATTRIBUTES, register_attributes, NULL);
+
@@ -129225,10 +129870,10 @@ index 0000000..0888f6c
+
diff --git a/tools/gcc/stackleak_plugin.c b/tools/gcc/stackleak_plugin.c
new file mode 100644
-index 0000000..51dc09d
+index 0000000..1d296ce
--- /dev/null
+++ b/tools/gcc/stackleak_plugin.c
-@@ -0,0 +1,408 @@
+@@ -0,0 +1,432 @@
+/*
+ * Copyright 2011-2015 by the PaX Team <pageexec@freemail.hu>
+ * Licensed under the GPL v2
@@ -129261,29 +129906,49 @@ index 0000000..51dc09d
+static bool init_locals;
+
+static struct plugin_info stackleak_plugin_info = {
-+ .version = "201408011900",
++ .version = "201504282245",
+ .help = "track-lowest-sp=nn\ttrack sp in functions whose frame size is at least nn bytes\n"
+// "initialize-locals\t\tforcibly initialize all stack frames\n"
+};
+
+static void stackleak_check_alloca(gimple_stmt_iterator *gsi)
+{
-+ gimple check_alloca;
++ gcall *check_alloca;
+ tree alloca_size;
++ cgraph_node_ptr node;
++ int frequency;
++ basic_block bb;
+
+ // insert call to void pax_check_alloca(unsigned long size)
+ alloca_size = gimple_call_arg(gsi_stmt(*gsi), 0);
+ check_alloca = gimple_build_call(check_function_decl, 1, alloca_size);
+ gsi_insert_before(gsi, check_alloca, GSI_SAME_STMT);
++
++ // update the cgraph
++ bb = gimple_bb(check_alloca);
++ node = cgraph_get_create_node(check_function_decl);
++ gcc_assert(node);
++ frequency = compute_call_stmt_bb_frequency(current_function_decl, bb);
++ cgraph_create_edge(cgraph_get_node(current_function_decl), node, check_alloca, bb->count, frequency, bb->loop_depth);
+}
+
+static void stackleak_add_instrumentation(gimple_stmt_iterator *gsi)
+{
-+ gimple track_stack;
++ gcall *track_stack;
++ cgraph_node_ptr node;
++ int frequency;
++ basic_block bb;
+
+ // insert call to void pax_track_stack(void)
+ track_stack = gimple_build_call(track_function_decl, 0);
+ gsi_insert_after(gsi, track_stack, GSI_CONTINUE_LINKING);
++
++ // update the cgraph
++ bb = gimple_bb(track_stack);
++ node = cgraph_get_create_node(track_function_decl);
++ gcc_assert(node);
++ frequency = compute_call_stmt_bb_frequency(current_function_decl, bb);
++ cgraph_create_edge(cgraph_get_node(current_function_decl), node, track_stack, bb->count, frequency, bb->loop_depth);
+}
+
+static bool is_alloca(gimple stmt)
@@ -129438,16 +130103,20 @@ index 0000000..51dc09d
+ track_function_decl = build_fn_decl(track_function, fntype);
+ DECL_ASSEMBLER_NAME(track_function_decl); // for LTO
+ TREE_PUBLIC(track_function_decl) = 1;
++ TREE_USED(track_function_decl) = 1;
+ DECL_EXTERNAL(track_function_decl) = 1;
+ DECL_ARTIFICIAL(track_function_decl) = 1;
++ DECL_PRESERVE_P(track_function_decl) = 1;
+
+ // void pax_check_alloca(unsigned long)
+ fntype = build_function_type_list(void_type_node, long_unsigned_type_node, NULL_TREE);
+ check_function_decl = build_fn_decl(check_function, fntype);
+ DECL_ASSEMBLER_NAME(check_function_decl); // for LTO
+ TREE_PUBLIC(check_function_decl) = 1;
++ TREE_USED(check_function_decl) = 1;
+ DECL_EXTERNAL(check_function_decl) = 1;
+ DECL_ARTIFICIAL(check_function_decl) = 1;
++ DECL_PRESERVE_P(check_function_decl) = 1;
+}
+
+#if BUILDING_GCC_VERSION >= 4009