aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2014-09-30 08:59:34 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2014-09-30 08:59:34 +0000
commit74c81998100cce63d20a36a89444f90b8231c9b4 (patch)
tree549c892c32f84b61cb87e1e076795823f6ad92fe
parent20d4ce42697fe9498f3e7b38058f159245dcde5f (diff)
downloadalpine_aports-74c81998100cce63d20a36a89444f90b8231c9b4.tar.bz2
alpine_aports-74c81998100cce63d20a36a89444f90b8231c9b4.tar.xz
alpine_aports-74c81998100cce63d20a36a89444f90b8231c9b4.zip
main/linux-grsec: upgrade to grsecurity-3.0-3.14.19-201409282024
-rw-r--r--main/linux-grsec/APKBUILD10
-rw-r--r--main/linux-grsec/grsecurity-3.0-3.14.19-201409282024.patch (renamed from main/linux-grsec/grsecurity-3.0-3.14.19-201409180900.patch)765
2 files changed, 678 insertions, 97 deletions
diff --git a/main/linux-grsec/APKBUILD b/main/linux-grsec/APKBUILD
index c2a78c55ee..d7e0760c5d 100644
--- a/main/linux-grsec/APKBUILD
+++ b/main/linux-grsec/APKBUILD
@@ -7,7 +7,7 @@ case $pkgver in
7*.*.*) _kernver=${pkgver%.*};; 7*.*.*) _kernver=${pkgver%.*};;
8*.*) _kernver=${pkgver};; 8*.*) _kernver=${pkgver};;
9esac 9esac
10pkgrel=0 10pkgrel=1
11pkgdesc="Linux kernel with grsecurity" 11pkgdesc="Linux kernel with grsecurity"
12url=http://grsecurity.net 12url=http://grsecurity.net
13depends="mkinitfs linux-firmware" 13depends="mkinitfs linux-firmware"
@@ -17,7 +17,7 @@ _config=${config:-kernelconfig.${CARCH}}
17install= 17install=
18source="http://ftp.kernel.org/pub/linux/kernel/v3.x/linux-$_kernver.tar.xz 18source="http://ftp.kernel.org/pub/linux/kernel/v3.x/linux-$_kernver.tar.xz
19 http://ftp.kernel.org/pub/linux/kernel/v3.x/patch-$pkgver.xz 19 http://ftp.kernel.org/pub/linux/kernel/v3.x/patch-$pkgver.xz
20 grsecurity-3.0-3.14.19-201409180900.patch 20 grsecurity-3.0-3.14.19-201409282024.patch
21 21
22 fix-memory-map-for-PIE-applications.patch 22 fix-memory-map-for-PIE-applications.patch
23 imx6q-no-unclocked-sleep.patch 23 imx6q-no-unclocked-sleep.patch
@@ -166,7 +166,7 @@ dev() {
166 166
167md5sums="b621207b3f6ecbb67db18b13258f8ea8 linux-3.14.tar.xz 167md5sums="b621207b3f6ecbb67db18b13258f8ea8 linux-3.14.tar.xz
168648647b8a4eb17f057bb64afabdb1d54 patch-3.14.19.xz 168648647b8a4eb17f057bb64afabdb1d54 patch-3.14.19.xz
169467fcb071fd99c070fbcec5a610de079 grsecurity-3.0-3.14.19-201409180900.patch 16916d0d944ffb7d3889828f6777c5ff227 grsecurity-3.0-3.14.19-201409282024.patch
170c6a4ae7e8ca6159e1631545515805216 fix-memory-map-for-PIE-applications.patch 170c6a4ae7e8ca6159e1631545515805216 fix-memory-map-for-PIE-applications.patch
1711a307fc1d63231bf01d22493a4f14378 imx6q-no-unclocked-sleep.patch 1711a307fc1d63231bf01d22493a4f14378 imx6q-no-unclocked-sleep.patch
172673f80f1d47c0a086782d74d97a4fca1 kernelconfig.x86 172673f80f1d47c0a086782d74d97a4fca1 kernelconfig.x86
@@ -174,7 +174,7 @@ b98f73c3b6b466140ad7bb3ffed7d5fe kernelconfig.x86_64
1743d79d27ce4aea637042bb70055c35a3d kernelconfig.armhf" 1743d79d27ce4aea637042bb70055c35a3d kernelconfig.armhf"
175sha256sums="61558aa490855f42b6340d1a1596be47454909629327c49a5e4e10268065dffa linux-3.14.tar.xz 175sha256sums="61558aa490855f42b6340d1a1596be47454909629327c49a5e4e10268065dffa linux-3.14.tar.xz
1768f168278944be5109f7bcb7488578acb9fdba985ae9fc44a04eefd4fe27d8591 patch-3.14.19.xz 1768f168278944be5109f7bcb7488578acb9fdba985ae9fc44a04eefd4fe27d8591 patch-3.14.19.xz
177b2f4a4fe2f6ff9fca7fb33427c0f0f09be8bad0684c57cc973d0a75ae320fbce grsecurity-3.0-3.14.19-201409180900.patch 17715738fd826a0bdf2c5fceecde3ec59f8eacbcaa59b5fa099f0a64fc32975b217 grsecurity-3.0-3.14.19-201409282024.patch
178500f3577310be52e87b9fecdc2e9c4ca43210fd97d69089f9005d484563f74c7 fix-memory-map-for-PIE-applications.patch 178500f3577310be52e87b9fecdc2e9c4ca43210fd97d69089f9005d484563f74c7 fix-memory-map-for-PIE-applications.patch
17921179fbb22a5b74af0a609350ae1a170e232908572b201d02e791d2ce0a685d3 imx6q-no-unclocked-sleep.patch 17921179fbb22a5b74af0a609350ae1a170e232908572b201d02e791d2ce0a685d3 imx6q-no-unclocked-sleep.patch
180da40c2648a5c9c7ee14c0bb8188d11e8ba95e86712f04869a509c27eeea5286e kernelconfig.x86 180da40c2648a5c9c7ee14c0bb8188d11e8ba95e86712f04869a509c27eeea5286e kernelconfig.x86
@@ -182,7 +182,7 @@ da40c2648a5c9c7ee14c0bb8188d11e8ba95e86712f04869a509c27eeea5286e kernelconfig.x
182a2dc0e30e1d1d691768543a17b51efccfc11ef17c04ac08f2b54c95f25dab75d kernelconfig.armhf" 182a2dc0e30e1d1d691768543a17b51efccfc11ef17c04ac08f2b54c95f25dab75d kernelconfig.armhf"
183sha512sums="5730d83a7a81134c1e77c0bf89e42dee4f8251ad56c1ac2be20c59e26fdfaa7bea55f277e7af156b637f22e1584914a46089af85039177cb43485089c74ac26e linux-3.14.tar.xz 183sha512sums="5730d83a7a81134c1e77c0bf89e42dee4f8251ad56c1ac2be20c59e26fdfaa7bea55f277e7af156b637f22e1584914a46089af85039177cb43485089c74ac26e linux-3.14.tar.xz
184be2cb79e7a9282244db9073160d426497dbb1815ce38050354181adc5d84dff09f597ff6980a3c29553300a2d38aa161ee25b53b8e122eb1891cfbdd950ba3eb patch-3.14.19.xz 184be2cb79e7a9282244db9073160d426497dbb1815ce38050354181adc5d84dff09f597ff6980a3c29553300a2d38aa161ee25b53b8e122eb1891cfbdd950ba3eb patch-3.14.19.xz
185a565914f92c2b4375a40ea1c0f17de1678195a7f3e3b51688a4aa541739016670fcb391f301634855df7d4b3d4dd0dbac0ed60e94b6d724f2c0a1a67360e6aa1 grsecurity-3.0-3.14.19-201409180900.patch 185e7fb38331f2564b100a0ab5c20912066c16c608081097adaabde9387003de9d7be09b27c4f957becef65627856a340d56270818401ac82077a228e2165cc21ce grsecurity-3.0-3.14.19-201409282024.patch
1864665c56ae1bbac311f9205d64918e84ee8b01d47d6e2396ff6b8adfb10aada7f7254531ce62e31edbb65c2a54a830f09ad05d314dfcd75d6272f4068945ad7c7 fix-memory-map-for-PIE-applications.patch 1864665c56ae1bbac311f9205d64918e84ee8b01d47d6e2396ff6b8adfb10aada7f7254531ce62e31edbb65c2a54a830f09ad05d314dfcd75d6272f4068945ad7c7 fix-memory-map-for-PIE-applications.patch
18787d1ad59732f265a5b0db54490dc1762c14ea4b868e7eb1aedc3ce57b48046de7bbc08cf5cfcf6f1380fa84063b0edb16ba3d5e3c5670be9bbb229275c88b221 imx6q-no-unclocked-sleep.patch 18787d1ad59732f265a5b0db54490dc1762c14ea4b868e7eb1aedc3ce57b48046de7bbc08cf5cfcf6f1380fa84063b0edb16ba3d5e3c5670be9bbb229275c88b221 imx6q-no-unclocked-sleep.patch
1880afde4aad7f5b33768adbf60a5d0945f2aea75615227263051af09a63c519b9d58bea66c5f4f3d1e64f6d3d4d42b2b17bb44e2e09ac83b202757f7c9534783aa kernelconfig.x86 1880afde4aad7f5b33768adbf60a5d0945f2aea75615227263051af09a63c519b9d58bea66c5f4f3d1e64f6d3d4d42b2b17bb44e2e09ac83b202757f7c9534783aa kernelconfig.x86
diff --git a/main/linux-grsec/grsecurity-3.0-3.14.19-201409180900.patch b/main/linux-grsec/grsecurity-3.0-3.14.19-201409282024.patch
index 3cb0c39c14..6d974541bb 100644
--- a/main/linux-grsec/grsecurity-3.0-3.14.19-201409180900.patch
+++ b/main/linux-grsec/grsecurity-3.0-3.14.19-201409282024.patch
@@ -2166,6 +2166,95 @@ index 71a06b2..8bb9ae1 100644
2166 2166
2167 /* 2167 /*
2168 * Change these and you break ASM code in entry-common.S 2168 * Change these and you break ASM code in entry-common.S
2169diff --git a/arch/arm/include/asm/tls.h b/arch/arm/include/asm/tls.h
2170index 83259b8..8c7e01d 100644
2171--- a/arch/arm/include/asm/tls.h
2172+++ b/arch/arm/include/asm/tls.h
2173@@ -1,6 +1,9 @@
2174 #ifndef __ASMARM_TLS_H
2175 #define __ASMARM_TLS_H
2176
2177+#include <linux/compiler.h>
2178+#include <asm/thread_info.h>
2179+
2180 #ifdef __ASSEMBLY__
2181 #include <asm/asm-offsets.h>
2182 .macro switch_tls_none, base, tp, tpuser, tmp1, tmp2
2183@@ -50,6 +53,50 @@
2184 #endif
2185
2186 #ifndef __ASSEMBLY__
2187+#include <asm/pgtable.h>
2188+
2189+static inline void set_tls(unsigned long val)
2190+{
2191+ struct thread_info *thread;
2192+
2193+ thread = current_thread_info();
2194+
2195+ thread->tp_value[0] = val;
2196+
2197+ /*
2198+ * This code runs with preemption enabled and therefore must
2199+ * be reentrant with respect to switch_tls.
2200+ *
2201+ * We need to ensure ordering between the shadow state and the
2202+ * hardware state, so that we don't corrupt the hardware state
2203+ * with a stale shadow state during context switch.
2204+ *
2205+ * If we're preempted here, switch_tls will load TPIDRURO from
2206+ * thread_info upon resuming execution and the following mcr
2207+ * is merely redundant.
2208+ */
2209+ barrier();
2210+
2211+ if (!tls_emu) {
2212+ if (has_tls_reg) {
2213+ asm("mcr p15, 0, %0, c13, c0, 3"
2214+ : : "r" (val));
2215+ } else {
2216+ /*
2217+ * User space must never try to access this
2218+ * directly. Expect your app to break
2219+ * eventually if you do so. The user helper
2220+ * at 0xffff0fe0 must be used instead. (see
2221+ * entry-armv.S for details)
2222+ */
2223+ pax_open_kernel();
2224+ *((unsigned int *)0xffff0ff0) = val;
2225+ pax_close_kernel();
2226+ }
2227+
2228+ }
2229+}
2230+
2231 static inline unsigned long get_tpuser(void)
2232 {
2233 unsigned long reg = 0;
2234@@ -59,5 +106,23 @@ static inline unsigned long get_tpuser(void)
2235
2236 return reg;
2237 }
2238+
2239+static inline void set_tpuser(unsigned long val)
2240+{
2241+ /* Since TPIDRURW is fully context-switched (unlike TPIDRURO),
2242+ * we need not update thread_info.
2243+ */
2244+ if (has_tls_reg && !tls_emu) {
2245+ asm("mcr p15, 0, %0, c13, c0, 2"
2246+ : : "r" (val));
2247+ }
2248+}
2249+
2250+static inline void flush_tls(void)
2251+{
2252+ set_tls(0);
2253+ set_tpuser(0);
2254+}
2255+
2256 #endif
2257 #endif /* __ASMARM_TLS_H */
2169diff --git a/arch/arm/include/asm/uaccess.h b/arch/arm/include/asm/uaccess.h 2258diff --git a/arch/arm/include/asm/uaccess.h b/arch/arm/include/asm/uaccess.h
2170index 7f3f3cc..bdf0665 100644 2259index 7f3f3cc..bdf0665 100644
2171--- a/arch/arm/include/asm/uaccess.h 2260--- a/arch/arm/include/asm/uaccess.h
@@ -2841,7 +2930,7 @@ index 07314af..c46655c 100644
2841 flush_icache_range((uintptr_t)(addr), 2930 flush_icache_range((uintptr_t)(addr),
2842 (uintptr_t)(addr) + size); 2931 (uintptr_t)(addr) + size);
2843diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c 2932diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
2844index 92f7b15..7048500 100644 2933index 92f7b15..b5e6630 100644
2845--- a/arch/arm/kernel/process.c 2934--- a/arch/arm/kernel/process.c
2846+++ b/arch/arm/kernel/process.c 2935+++ b/arch/arm/kernel/process.c
2847@@ -217,6 +217,7 @@ void machine_power_off(void) 2936@@ -217,6 +217,7 @@ void machine_power_off(void)
@@ -2872,7 +2961,16 @@ index 92f7b15..7048500 100644
2872 printk("pc : [<%08lx>] lr : [<%08lx>] psr: %08lx\n" 2961 printk("pc : [<%08lx>] lr : [<%08lx>] psr: %08lx\n"
2873 "sp : %08lx ip : %08lx fp : %08lx\n", 2962 "sp : %08lx ip : %08lx fp : %08lx\n",
2874 regs->ARM_pc, regs->ARM_lr, regs->ARM_cpsr, 2963 regs->ARM_pc, regs->ARM_lr, regs->ARM_cpsr,
2875@@ -425,12 +426,6 @@ unsigned long get_wchan(struct task_struct *p) 2964@@ -334,6 +335,8 @@ void flush_thread(void)
2965 memset(&tsk->thread.debug, 0, sizeof(struct debug_info));
2966 memset(&thread->fpstate, 0, sizeof(union fp_state));
2967
2968+ flush_tls();
2969+
2970 thread_notify(THREAD_NOTIFY_FLUSH, thread);
2971 }
2972
2973@@ -425,12 +428,6 @@ unsigned long get_wchan(struct task_struct *p)
2876 return 0; 2974 return 0;
2877 } 2975 }
2878 2976
@@ -2885,7 +2983,7 @@ index 92f7b15..7048500 100644
2885 #ifdef CONFIG_MMU 2983 #ifdef CONFIG_MMU
2886 #ifdef CONFIG_KUSER_HELPERS 2984 #ifdef CONFIG_KUSER_HELPERS
2887 /* 2985 /*
2888@@ -446,7 +441,7 @@ static struct vm_area_struct gate_vma = { 2986@@ -446,7 +443,7 @@ static struct vm_area_struct gate_vma = {
2889 2987
2890 static int __init gate_vma_init(void) 2988 static int __init gate_vma_init(void)
2891 { 2989 {
@@ -2894,7 +2992,7 @@ index 92f7b15..7048500 100644
2894 return 0; 2992 return 0;
2895 } 2993 }
2896 arch_initcall(gate_vma_init); 2994 arch_initcall(gate_vma_init);
2897@@ -472,41 +467,16 @@ int in_gate_area_no_mm(unsigned long addr) 2995@@ -472,41 +469,16 @@ int in_gate_area_no_mm(unsigned long addr)
2898 2996
2899 const char *arch_vma_name(struct vm_area_struct *vma) 2997 const char *arch_vma_name(struct vm_area_struct *vma)
2900 { 2998 {
@@ -3139,8 +3237,21 @@ index 7a3be1d..b00c7de 100644
3139 pr_debug("CPU ITCM: copied code from %p - %p\n", 3237 pr_debug("CPU ITCM: copied code from %p - %p\n",
3140 start, end); 3238 start, end);
3141 itcm_present = true; 3239 itcm_present = true;
3240diff --git a/arch/arm/kernel/thumbee.c b/arch/arm/kernel/thumbee.c
3241index 7b8403b..80f0d69 100644
3242--- a/arch/arm/kernel/thumbee.c
3243+++ b/arch/arm/kernel/thumbee.c
3244@@ -45,7 +45,7 @@ static int thumbee_notifier(struct notifier_block *self, unsigned long cmd, void
3245
3246 switch (cmd) {
3247 case THREAD_NOTIFY_FLUSH:
3248- thread->thumbee_state = 0;
3249+ teehbr_write(0);
3250 break;
3251 case THREAD_NOTIFY_SWITCH:
3252 current_thread_info()->thumbee_state = teehbr_read();
3142diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c 3253diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
3143index 172ee18..ce4ec3d 100644 3254index 172ee18..381ce44 100644
3144--- a/arch/arm/kernel/traps.c 3255--- a/arch/arm/kernel/traps.c
3145+++ b/arch/arm/kernel/traps.c 3256+++ b/arch/arm/kernel/traps.c
3146@@ -62,7 +62,7 @@ static void dump_mem(const char *, const char *, unsigned long, unsigned long); 3257@@ -62,7 +62,7 @@ static void dump_mem(const char *, const char *, unsigned long, unsigned long);
@@ -3171,17 +3282,38 @@ index 172ee18..ce4ec3d 100644
3171 if (signr) 3282 if (signr)
3172 do_exit(signr); 3283 do_exit(signr);
3173 } 3284 }
3174@@ -642,7 +647,9 @@ asmlinkage int arm_syscall(int no, struct pt_regs *regs) 3285@@ -578,7 +583,6 @@ do_cache_op(unsigned long start, unsigned long end, int flags)
3175 * The user helper at 0xffff0fe0 must be used instead. 3286 #define NR(x) ((__ARM_NR_##x) - __ARM_NR_BASE)
3176 * (see entry-armv.S for details) 3287 asmlinkage int arm_syscall(int no, struct pt_regs *regs)
3177 */ 3288 {
3178+ pax_open_kernel(); 3289- struct thread_info *thread = current_thread_info();
3179 *((unsigned int *)0xffff0ff0) = regs->ARM_r0; 3290 siginfo_t info;
3180+ pax_close_kernel(); 3291
3181 } 3292 if ((no >> 16) != (__ARM_NR_BASE>> 16))
3293@@ -629,21 +633,7 @@ asmlinkage int arm_syscall(int no, struct pt_regs *regs)
3294 return regs->ARM_r0;
3295
3296 case NR(set_tls):
3297- thread->tp_value[0] = regs->ARM_r0;
3298- if (tls_emu)
3299- return 0;
3300- if (has_tls_reg) {
3301- asm ("mcr p15, 0, %0, c13, c0, 3"
3302- : : "r" (regs->ARM_r0));
3303- } else {
3304- /*
3305- * User space must never try to access this directly.
3306- * Expect your app to break eventually if you do so.
3307- * The user helper at 0xffff0fe0 must be used instead.
3308- * (see entry-armv.S for details)
3309- */
3310- *((unsigned int *)0xffff0ff0) = regs->ARM_r0;
3311- }
3312+ set_tls(regs->ARM_r0);
3182 return 0; 3313 return 0;
3183 3314
3184@@ -899,7 +906,11 @@ void __init early_trap_init(void *vectors_base) 3315 #ifdef CONFIG_NEEDS_SYSCALL_FOR_CMPXCHG
3316@@ -899,7 +889,11 @@ void __init early_trap_init(void *vectors_base)
3185 kuser_init(vectors_base); 3317 kuser_init(vectors_base);
3186 3318
3187 flush_icache_range(vectors, vectors + PAGE_SIZE * 2); 3319 flush_icache_range(vectors, vectors + PAGE_SIZE * 2);
@@ -18010,10 +18142,10 @@ index ed5903b..c7fe163 100644
18010 #define MODULES_END VMALLOC_END 18142 #define MODULES_END VMALLOC_END
18011 #define MODULES_LEN (MODULES_VADDR - MODULES_END) 18143 #define MODULES_LEN (MODULES_VADDR - MODULES_END)
18012diff --git a/arch/x86/include/asm/pgtable_64.h b/arch/x86/include/asm/pgtable_64.h 18144diff --git a/arch/x86/include/asm/pgtable_64.h b/arch/x86/include/asm/pgtable_64.h
18013index e22c1db..23a625a 100644 18145index e22c1db..82f2923 100644
18014--- a/arch/x86/include/asm/pgtable_64.h 18146--- a/arch/x86/include/asm/pgtable_64.h
18015+++ b/arch/x86/include/asm/pgtable_64.h 18147+++ b/arch/x86/include/asm/pgtable_64.h
18016@@ -16,10 +16,14 @@ 18148@@ -16,10 +16,15 @@
18017 18149
18018 extern pud_t level3_kernel_pgt[512]; 18150 extern pud_t level3_kernel_pgt[512];
18019 extern pud_t level3_ident_pgt[512]; 18151 extern pud_t level3_ident_pgt[512];
@@ -18026,11 +18158,12 @@ index e22c1db..23a625a 100644
18026-extern pmd_t level2_ident_pgt[512]; 18158-extern pmd_t level2_ident_pgt[512];
18027-extern pgd_t init_level4_pgt[]; 18159-extern pgd_t init_level4_pgt[];
18028+extern pmd_t level2_ident_pgt[512*2]; 18160+extern pmd_t level2_ident_pgt[512*2];
18161+extern pte_t level1_fixmap_pgt[512];
18029+extern pgd_t init_level4_pgt[512]; 18162+extern pgd_t init_level4_pgt[512];
18030 18163
18031 #define swapper_pg_dir init_level4_pgt 18164 #define swapper_pg_dir init_level4_pgt
18032 18165
18033@@ -61,7 +65,9 @@ static inline void native_set_pte_atomic(pte_t *ptep, pte_t pte) 18166@@ -61,7 +66,9 @@ static inline void native_set_pte_atomic(pte_t *ptep, pte_t pte)
18034 18167
18035 static inline void native_set_pmd(pmd_t *pmdp, pmd_t pmd) 18168 static inline void native_set_pmd(pmd_t *pmdp, pmd_t pmd)
18036 { 18169 {
@@ -18040,7 +18173,7 @@ index e22c1db..23a625a 100644
18040 } 18173 }
18041 18174
18042 static inline void native_pmd_clear(pmd_t *pmd) 18175 static inline void native_pmd_clear(pmd_t *pmd)
18043@@ -97,7 +103,9 @@ static inline pmd_t native_pmdp_get_and_clear(pmd_t *xp) 18176@@ -97,7 +104,9 @@ static inline pmd_t native_pmdp_get_and_clear(pmd_t *xp)
18044 18177
18045 static inline void native_set_pud(pud_t *pudp, pud_t pud) 18178 static inline void native_set_pud(pud_t *pudp, pud_t pud)
18046 { 18179 {
@@ -18050,7 +18183,7 @@ index e22c1db..23a625a 100644
18050 } 18183 }
18051 18184
18052 static inline void native_pud_clear(pud_t *pud) 18185 static inline void native_pud_clear(pud_t *pud)
18053@@ -107,6 +115,13 @@ static inline void native_pud_clear(pud_t *pud) 18186@@ -107,6 +116,13 @@ static inline void native_pud_clear(pud_t *pud)
18054 18187
18055 static inline void native_set_pgd(pgd_t *pgdp, pgd_t pgd) 18188 static inline void native_set_pgd(pgd_t *pgdp, pgd_t pgd)
18056 { 18189 {
@@ -21775,7 +21908,7 @@ index f6dfd93..892ade4 100644
21775 21908
21776 .__cr3 = __pa_nodebug(swapper_pg_dir), 21909 .__cr3 = __pa_nodebug(swapper_pg_dir),
21777diff --git a/arch/x86/kernel/dumpstack.c b/arch/x86/kernel/dumpstack.c 21910diff --git a/arch/x86/kernel/dumpstack.c b/arch/x86/kernel/dumpstack.c
21778index d9c12d3..7858b62 100644 21911index d9c12d3..3e70198 100644
21779--- a/arch/x86/kernel/dumpstack.c 21912--- a/arch/x86/kernel/dumpstack.c
21780+++ b/arch/x86/kernel/dumpstack.c 21913+++ b/arch/x86/kernel/dumpstack.c
21781@@ -2,6 +2,9 @@ 21914@@ -2,6 +2,9 @@
@@ -21788,7 +21921,15 @@ index d9c12d3..7858b62 100644
21788 #include <linux/kallsyms.h> 21921 #include <linux/kallsyms.h>
21789 #include <linux/kprobes.h> 21922 #include <linux/kprobes.h>
21790 #include <linux/uaccess.h> 21923 #include <linux/uaccess.h>
21791@@ -40,16 +43,14 @@ void printk_address(unsigned long address) 21924@@ -33,23 +36,21 @@ static void printk_stack_address(unsigned long address, int reliable)
21925
21926 void printk_address(unsigned long address)
21927 {
21928- pr_cont(" [<%p>] %pS\n", (void *)address, (void *)address);
21929+ pr_cont(" [<%p>] %pA\n", (void *)address, (void *)address);
21930 }
21931
21932 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
21792 static void 21933 static void
21793 print_ftrace_graph_addr(unsigned long addr, void *data, 21934 print_ftrace_graph_addr(unsigned long addr, void *data,
21794 const struct stacktrace_ops *ops, 21935 const struct stacktrace_ops *ops,
@@ -35857,7 +35998,7 @@ index 201d09a..e4723e5 100644
35857 35998
35858 #ifdef CONFIG_ACPI_NUMA 35999 #ifdef CONFIG_ACPI_NUMA
35859diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c 36000diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
35860index 2423ef0..4f6fb5b 100644 36001index 2423ef0..a5f0379 100644
35861--- a/arch/x86/xen/mmu.c 36002--- a/arch/x86/xen/mmu.c
35862+++ b/arch/x86/xen/mmu.c 36003+++ b/arch/x86/xen/mmu.c
35863@@ -379,7 +379,7 @@ static pteval_t pte_mfn_to_pfn(pteval_t val) 36004@@ -379,7 +379,7 @@ static pteval_t pte_mfn_to_pfn(pteval_t val)
@@ -35869,17 +36010,63 @@ index 2423ef0..4f6fb5b 100644
35869 { 36010 {
35870 if (val & _PAGE_PRESENT) { 36011 if (val & _PAGE_PRESENT) {
35871 unsigned long pfn = (val & PTE_PFN_MASK) >> PAGE_SHIFT; 36012 unsigned long pfn = (val & PTE_PFN_MASK) >> PAGE_SHIFT;
35872@@ -1904,6 +1904,9 @@ void __init xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn) 36013@@ -1866,12 +1866,11 @@ static void __init check_pt_base(unsigned long *pt_base, unsigned long *pt_end,
36014 *
36015 * We can construct this by grafting the Xen provided pagetable into
36016 * head_64.S's preconstructed pagetables. We copy the Xen L2's into
36017- * level2_ident_pgt, level2_kernel_pgt and level2_fixmap_pgt. This
36018- * means that only the kernel has a physical mapping to start with -
36019- * but that's enough to get __va working. We need to fill in the rest
36020- * of the physical mapping once some sort of allocator has been set
36021- * up.
36022- * NOTE: for PVH, the page tables are native.
36023+ * level2_ident_pgt, and level2_kernel_pgt. This means that only the
36024+ * kernel has a physical mapping to start with - but that's enough to
36025+ * get __va working. We need to fill in the rest of the physical
36026+ * mapping once some sort of allocator has been set up. NOTE: for
36027+ * PVH, the page tables are native.
36028 */
36029 void __init xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn)
36030 {
36031@@ -1902,8 +1901,14 @@ void __init xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn)
36032 /* L3_i[0] -> level2_ident_pgt */
36033 convert_pfn_mfn(level3_ident_pgt);
35873 /* L3_k[510] -> level2_kernel_pgt 36034 /* L3_k[510] -> level2_kernel_pgt
35874 * L3_i[511] -> level2_fixmap_pgt */ 36035- * L3_i[511] -> level2_fixmap_pgt */
36036+ * L3_k[511] -> level2_fixmap_pgt */
35875 convert_pfn_mfn(level3_kernel_pgt); 36037 convert_pfn_mfn(level3_kernel_pgt);
35876+ convert_pfn_mfn(level3_vmalloc_start_pgt); 36038+ convert_pfn_mfn(level3_vmalloc_start_pgt);
35877+ convert_pfn_mfn(level3_vmalloc_end_pgt); 36039+ convert_pfn_mfn(level3_vmalloc_end_pgt);
35878+ convert_pfn_mfn(level3_vmemmap_pgt); 36040+ convert_pfn_mfn(level3_vmemmap_pgt);
36041+
36042+ /* L3_k[511][506] -> level1_fixmap_pgt */
36043+ convert_pfn_mfn(level2_fixmap_pgt);
35879 } 36044 }
35880 /* We get [511][511] and have Xen's version of level2_kernel_pgt */ 36045 /* We get [511][511] and have Xen's version of level2_kernel_pgt */
35881 l3 = m2v(pgd[pgd_index(__START_KERNEL_map)].pgd); 36046 l3 = m2v(pgd[pgd_index(__START_KERNEL_map)].pgd);
35882@@ -1933,8 +1936,12 @@ void __init xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn) 36047@@ -1913,30 +1918,29 @@ void __init xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn)
36048 addr[1] = (unsigned long)l3;
36049 addr[2] = (unsigned long)l2;
36050 /* Graft it onto L4[272][0]. Note that we creating an aliasing problem:
36051- * Both L4[272][0] and L4[511][511] have entries that point to the same
36052+ * Both L4[272][0] and L4[511][510] have entries that point to the same
36053 * L2 (PMD) tables. Meaning that if you modify it in __va space
36054 * it will be also modified in the __ka space! (But if you just
36055 * modify the PMD table to point to other PTE's or none, then you
36056 * are OK - which is what cleanup_highmap does) */
36057 copy_page(level2_ident_pgt, l2);
36058- /* Graft it onto L4[511][511] */
36059+ /* Graft it onto L4[511][510] */
36060 copy_page(level2_kernel_pgt, l2);
36061
36062- /* Get [511][510] and graft that in level2_fixmap_pgt */
36063- l3 = m2v(pgd[pgd_index(__START_KERNEL_map + PMD_SIZE)].pgd);
36064- l2 = m2v(l3[pud_index(__START_KERNEL_map + PMD_SIZE)].pud);
36065- copy_page(level2_fixmap_pgt, l2);
36066- /* Note that we don't do anything with level1_fixmap_pgt which
36067- * we don't need. */
36068 if (!xen_feature(XENFEAT_auto_translated_physmap)) {
36069 /* Make pagetable pieces RO */
35883 set_page_prot(init_level4_pgt, PAGE_KERNEL_RO); 36070 set_page_prot(init_level4_pgt, PAGE_KERNEL_RO);
35884 set_page_prot(level3_ident_pgt, PAGE_KERNEL_RO); 36071 set_page_prot(level3_ident_pgt, PAGE_KERNEL_RO);
35885 set_page_prot(level3_kernel_pgt, PAGE_KERNEL_RO); 36072 set_page_prot(level3_kernel_pgt, PAGE_KERNEL_RO);
@@ -35891,8 +36078,11 @@ index 2423ef0..4f6fb5b 100644
35891+ set_page_prot(level2_vmemmap_pgt, PAGE_KERNEL_RO); 36078+ set_page_prot(level2_vmemmap_pgt, PAGE_KERNEL_RO);
35892 set_page_prot(level2_kernel_pgt, PAGE_KERNEL_RO); 36079 set_page_prot(level2_kernel_pgt, PAGE_KERNEL_RO);
35893 set_page_prot(level2_fixmap_pgt, PAGE_KERNEL_RO); 36080 set_page_prot(level2_fixmap_pgt, PAGE_KERNEL_RO);
36081+ set_page_prot(level1_fixmap_pgt, PAGE_KERNEL_RO);
35894 36082
35895@@ -2123,6 +2130,7 @@ static void __init xen_post_allocator_init(void) 36083 /* Pin down new L4 */
36084 pin_pagetable_pfn(MMUEXT_PIN_L4_TABLE,
36085@@ -2123,6 +2127,7 @@ static void __init xen_post_allocator_init(void)
35896 pv_mmu_ops.set_pud = xen_set_pud; 36086 pv_mmu_ops.set_pud = xen_set_pud;
35897 #if PAGETABLE_LEVELS == 4 36087 #if PAGETABLE_LEVELS == 4
35898 pv_mmu_ops.set_pgd = xen_set_pgd; 36088 pv_mmu_ops.set_pgd = xen_set_pgd;
@@ -35900,7 +36090,7 @@ index 2423ef0..4f6fb5b 100644
35900 #endif 36090 #endif
35901 36091
35902 /* This will work as long as patching hasn't happened yet 36092 /* This will work as long as patching hasn't happened yet
35903@@ -2201,6 +2209,7 @@ static const struct pv_mmu_ops xen_mmu_ops __initconst = { 36093@@ -2201,6 +2206,7 @@ static const struct pv_mmu_ops xen_mmu_ops __initconst = {
35904 .pud_val = PV_CALLEE_SAVE(xen_pud_val), 36094 .pud_val = PV_CALLEE_SAVE(xen_pud_val),
35905 .make_pud = PV_CALLEE_SAVE(xen_make_pud), 36095 .make_pud = PV_CALLEE_SAVE(xen_make_pud),
35906 .set_pgd = xen_set_pgd_hyper, 36096 .set_pgd = xen_set_pgd_hyper,
@@ -36120,6 +36310,18 @@ index d8f80e7..5f41702 100644
36120 done: 36310 done:
36121 spin_lock_init(&blkcg->lock); 36311 spin_lock_init(&blkcg->lock);
36122 INIT_RADIX_TREE(&blkcg->blkg_tree, GFP_ATOMIC); 36312 INIT_RADIX_TREE(&blkcg->blkg_tree, GFP_ATOMIC);
36313diff --git a/block/blk-exec.c b/block/blk-exec.c
36314index dbf4502..3394b6e 100644
36315--- a/block/blk-exec.c
36316+++ b/block/blk-exec.c
36317@@ -56,6 +56,7 @@ void blk_execute_rq_nowait(struct request_queue *q, struct gendisk *bd_disk,
36318 bool is_pm_resume;
36319
36320 WARN_ON(irqs_disabled());
36321+ WARN_ON(rq->cmd_type == REQ_TYPE_FS);
36322
36323 rq->rq_disk = bd_disk;
36324 rq->end_io = done;
36123diff --git a/block/blk-iopoll.c b/block/blk-iopoll.c 36325diff --git a/block/blk-iopoll.c b/block/blk-iopoll.c
36124index 1855bf5..af12b06 100644 36326index 1855bf5..af12b06 100644
36125--- a/block/blk-iopoll.c 36327--- a/block/blk-iopoll.c
@@ -36146,6 +36348,28 @@ index ae4ae10..c470b8d 100644
36146 if (do_copy) 36348 if (do_copy)
36147 bio = bio_copy_kern(q, kbuf, len, gfp_mask, reading); 36349 bio = bio_copy_kern(q, kbuf, len, gfp_mask, reading);
36148 else 36350 else
36351diff --git a/block/blk-mq.c b/block/blk-mq.c
36352index 883f720..37322f0 100644
36353--- a/block/blk-mq.c
36354+++ b/block/blk-mq.c
36355@@ -710,14 +710,9 @@ void blk_mq_insert_request(struct request *rq, bool at_head, bool run_queue,
36356
36357 hctx = q->mq_ops->map_queue(q, ctx->cpu);
36358
36359- if (rq->cmd_flags & (REQ_FLUSH | REQ_FUA) &&
36360- !(rq->cmd_flags & (REQ_FLUSH_SEQ))) {
36361- blk_insert_flush(rq);
36362- } else {
36363- spin_lock(&ctx->lock);
36364- __blk_mq_insert_request(hctx, rq, at_head);
36365- spin_unlock(&ctx->lock);
36366- }
36367+ spin_lock(&ctx->lock);
36368+ __blk_mq_insert_request(hctx, rq, at_head);
36369+ spin_unlock(&ctx->lock);
36370
36371 blk_mq_put_ctx(current_ctx);
36372
36149diff --git a/block/blk-softirq.c b/block/blk-softirq.c 36373diff --git a/block/blk-softirq.c b/block/blk-softirq.c
36150index 57790c1..5e988dd 100644 36374index 57790c1..5e988dd 100644
36151--- a/block/blk-softirq.c 36375--- a/block/blk-softirq.c
@@ -38097,8 +38321,21 @@ index be73e9d..7fbf140 100644
38097 38321
38098 cmdlist_t *reqQ; 38322 cmdlist_t *reqQ;
38099 cmdlist_t *cmpQ; 38323 cmdlist_t *cmpQ;
38324diff --git a/drivers/block/drbd/drbd_bitmap.c b/drivers/block/drbd/drbd_bitmap.c
38325index 597f111..c700970 100644
38326--- a/drivers/block/drbd/drbd_bitmap.c
38327+++ b/drivers/block/drbd/drbd_bitmap.c
38328@@ -1042,7 +1042,7 @@ static void bm_page_io_async(struct bm_aio_ctx *ctx, int page_nr, int rw) __must
38329 submit_bio(rw, bio);
38330 /* this should not count as user activity and cause the
38331 * resync to throttle -- see drbd_rs_should_slow_down(). */
38332- atomic_add(len >> 9, &mdev->rs_sect_ev);
38333+ atomic_add_unchecked(len >> 9, &mdev->rs_sect_ev);
38334 }
38335 }
38336
38100diff --git a/drivers/block/drbd/drbd_int.h b/drivers/block/drbd/drbd_int.h 38337diff --git a/drivers/block/drbd/drbd_int.h b/drivers/block/drbd/drbd_int.h
38101index 0e06f0c..c47b81d 100644 38338index 0e06f0c..d98cde3 100644
38102--- a/drivers/block/drbd/drbd_int.h 38339--- a/drivers/block/drbd/drbd_int.h
38103+++ b/drivers/block/drbd/drbd_int.h 38340+++ b/drivers/block/drbd/drbd_int.h
38104@@ -582,7 +582,7 @@ struct drbd_epoch { 38341@@ -582,7 +582,7 @@ struct drbd_epoch {
@@ -38119,6 +38356,17 @@ index 0e06f0c..c47b81d 100644
38119 unsigned int peer_seq; 38356 unsigned int peer_seq;
38120 spinlock_t peer_seq_lock; 38357 spinlock_t peer_seq_lock;
38121 unsigned int minor; 38358 unsigned int minor;
38359@@ -1032,8 +1032,8 @@ struct drbd_conf {
38360 struct mutex own_state_mutex;
38361 struct mutex *state_mutex; /* either own_state_mutex or mdev->tconn->cstate_mutex */
38362 char congestion_reason; /* Why we where congested... */
38363- atomic_t rs_sect_in; /* for incoming resync data rate, SyncTarget */
38364- atomic_t rs_sect_ev; /* for submitted resync data rate, both */
38365+ atomic_unchecked_t rs_sect_in; /* for incoming resync data rate, SyncTarget */
38366+ atomic_unchecked_t rs_sect_ev; /* for submitted resync data rate, both */
38367 int rs_last_sect_ev; /* counter to compare with */
38368 int rs_last_events; /* counter of read or write "events" (unit sectors)
38369 * on the lower level device when we last looked. */
38122@@ -1573,7 +1573,7 @@ static inline int drbd_setsockopt(struct socket *sock, int level, int optname, 38370@@ -1573,7 +1573,7 @@ static inline int drbd_setsockopt(struct socket *sock, int level, int optname,
38123 char __user *uoptval; 38371 char __user *uoptval;
38124 int err; 38372 int err;
@@ -38146,7 +38394,7 @@ index 89c497c..9c736ae 100644
38146 38394
38147 /** 38395 /**
38148diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c 38396diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c
38149index 929468e..7d934eb 100644 38397index 929468e..efb12f0 100644
38150--- a/drivers/block/drbd/drbd_main.c 38398--- a/drivers/block/drbd/drbd_main.c
38151+++ b/drivers/block/drbd/drbd_main.c 38399+++ b/drivers/block/drbd/drbd_main.c
38152@@ -1317,7 +1317,7 @@ static int _drbd_send_ack(struct drbd_conf *mdev, enum drbd_packet cmd, 38400@@ -1317,7 +1317,7 @@ static int _drbd_send_ack(struct drbd_conf *mdev, enum drbd_packet cmd,
@@ -38167,6 +38415,17 @@ index 929468e..7d934eb 100644
38167 dp_flags = bio_flags_to_wire(mdev, req->master_bio->bi_rw); 38415 dp_flags = bio_flags_to_wire(mdev, req->master_bio->bi_rw);
38168 if (mdev->state.conn >= C_SYNC_SOURCE && 38416 if (mdev->state.conn >= C_SYNC_SOURCE &&
38169 mdev->state.conn <= C_PAUSED_SYNC_T) 38417 mdev->state.conn <= C_PAUSED_SYNC_T)
38418@@ -1886,8 +1886,8 @@ void drbd_init_set_defaults(struct drbd_conf *mdev)
38419 atomic_set(&mdev->unacked_cnt, 0);
38420 atomic_set(&mdev->local_cnt, 0);
38421 atomic_set(&mdev->pp_in_use_by_net, 0);
38422- atomic_set(&mdev->rs_sect_in, 0);
38423- atomic_set(&mdev->rs_sect_ev, 0);
38424+ atomic_set_unchecked(&mdev->rs_sect_in, 0);
38425+ atomic_set_unchecked(&mdev->rs_sect_ev, 0);
38426 atomic_set(&mdev->ap_in_flight, 0);
38427 atomic_set(&mdev->md_io_in_use, 0);
38428
38170@@ -2577,8 +2577,8 @@ void conn_destroy(struct kref *kref) 38429@@ -2577,8 +2577,8 @@ void conn_destroy(struct kref *kref)
38171 { 38430 {
38172 struct drbd_tconn *tconn = container_of(kref, struct drbd_tconn, kref); 38431 struct drbd_tconn *tconn = container_of(kref, struct drbd_tconn, kref);
@@ -38201,7 +38460,7 @@ index c706d50..5e1b472 100644
38201 if (!msg) 38460 if (!msg)
38202 goto failed; 38461 goto failed;
38203diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c 38462diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c
38204index d073305..4998fea 100644 38463index d073305..958be8f 100644
38205--- a/drivers/block/drbd/drbd_receiver.c 38464--- a/drivers/block/drbd/drbd_receiver.c
38206+++ b/drivers/block/drbd/drbd_receiver.c 38465+++ b/drivers/block/drbd/drbd_receiver.c
38207@@ -834,7 +834,7 @@ int drbd_connected(struct drbd_conf *mdev) 38466@@ -834,7 +834,7 @@ int drbd_connected(struct drbd_conf *mdev)
@@ -38254,6 +38513,24 @@ index d073305..4998fea 100644
38254 list_add(&epoch->list, &tconn->current_epoch->list); 38513 list_add(&epoch->list, &tconn->current_epoch->list);
38255 tconn->current_epoch = epoch; 38514 tconn->current_epoch = epoch;
38256 tconn->epochs++; 38515 tconn->epochs++;
38516@@ -1688,7 +1688,7 @@ static int recv_resync_read(struct drbd_conf *mdev, sector_t sector, int data_si
38517 list_add(&peer_req->w.list, &mdev->sync_ee);
38518 spin_unlock_irq(&mdev->tconn->req_lock);
38519
38520- atomic_add(data_size >> 9, &mdev->rs_sect_ev);
38521+ atomic_add_unchecked(data_size >> 9, &mdev->rs_sect_ev);
38522 if (drbd_submit_peer_request(mdev, peer_req, WRITE, DRBD_FAULT_RS_WR) == 0)
38523 return 0;
38524
38525@@ -1782,7 +1782,7 @@ static int receive_RSDataReply(struct drbd_tconn *tconn, struct packet_info *pi)
38526 drbd_send_ack_dp(mdev, P_NEG_ACK, p, pi->size);
38527 }
38528
38529- atomic_add(pi->size >> 9, &mdev->rs_sect_in);
38530+ atomic_add_unchecked(pi->size >> 9, &mdev->rs_sect_in);
38531
38532 return err;
38533 }
38257@@ -2164,7 +2164,7 @@ static int receive_Data(struct drbd_tconn *tconn, struct packet_info *pi) 38534@@ -2164,7 +2164,7 @@ static int receive_Data(struct drbd_tconn *tconn, struct packet_info *pi)
38258 38535
38259 err = wait_for_and_update_peer_seq(mdev, peer_seq); 38536 err = wait_for_and_update_peer_seq(mdev, peer_seq);
@@ -38272,6 +38549,33 @@ index d073305..4998fea 100644
38272 atomic_inc(&peer_req->epoch->active); 38549 atomic_inc(&peer_req->epoch->active);
38273 spin_unlock(&tconn->epoch_lock); 38550 spin_unlock(&tconn->epoch_lock);
38274 38551
38552@@ -2326,7 +2326,7 @@ int drbd_rs_should_slow_down(struct drbd_conf *mdev, sector_t sector)
38553
38554 curr_events = (int)part_stat_read(&disk->part0, sectors[0]) +
38555 (int)part_stat_read(&disk->part0, sectors[1]) -
38556- atomic_read(&mdev->rs_sect_ev);
38557+ atomic_read_unchecked(&mdev->rs_sect_ev);
38558
38559 if (!mdev->rs_last_events || curr_events - mdev->rs_last_events > 64) {
38560 unsigned long rs_left;
38561@@ -2459,7 +2459,7 @@ static int receive_DataRequest(struct drbd_tconn *tconn, struct packet_info *pi)
38562 mdev->bm_resync_fo = BM_SECT_TO_BIT(sector);
38563 } else if (pi->cmd == P_OV_REPLY) {
38564 /* track progress, we may need to throttle */
38565- atomic_add(size >> 9, &mdev->rs_sect_in);
38566+ atomic_add_unchecked(size >> 9, &mdev->rs_sect_in);
38567 peer_req->w.cb = w_e_end_ov_reply;
38568 dec_rs_pending(mdev);
38569 /* drbd_rs_begin_io done when we sent this request,
38570@@ -2520,7 +2520,7 @@ static int receive_DataRequest(struct drbd_tconn *tconn, struct packet_info *pi)
38571 goto out_free_e;
38572
38573 submit_for_resync:
38574- atomic_add(size >> 9, &mdev->rs_sect_ev);
38575+ atomic_add_unchecked(size >> 9, &mdev->rs_sect_ev);
38576
38577 submit:
38578 inc_unacked(mdev);
38275@@ -4345,7 +4345,7 @@ struct data_cmd { 38579@@ -4345,7 +4345,7 @@ struct data_cmd {
38276 int expect_payload; 38580 int expect_payload;
38277 size_t pkt_size; 38581 size_t pkt_size;
@@ -38290,6 +38594,15 @@ index d073305..4998fea 100644
38290 tconn->send.seen_any_write_yet = false; 38594 tconn->send.seen_any_write_yet = false;
38291 38595
38292 conn_info(tconn, "Connection closed\n"); 38596 conn_info(tconn, "Connection closed\n");
38597@@ -4947,7 +4947,7 @@ static int got_IsInSync(struct drbd_tconn *tconn, struct packet_info *pi)
38598 put_ldev(mdev);
38599 }
38600 dec_rs_pending(mdev);
38601- atomic_add(blksize >> 9, &mdev->rs_sect_in);
38602+ atomic_add_unchecked(blksize >> 9, &mdev->rs_sect_in);
38603
38604 return 0;
38605 }
38293@@ -5221,7 +5221,7 @@ static int tconn_finish_peer_reqs(struct drbd_tconn *tconn) 38606@@ -5221,7 +5221,7 @@ static int tconn_finish_peer_reqs(struct drbd_tconn *tconn)
38294 struct asender_cmd { 38607 struct asender_cmd {
38295 size_t pkt_size; 38608 size_t pkt_size;
@@ -38299,6 +38612,39 @@ index d073305..4998fea 100644
38299 38612
38300 static struct asender_cmd asender_tbl[] = { 38613 static struct asender_cmd asender_tbl[] = {
38301 [P_PING] = { 0, got_Ping }, 38614 [P_PING] = { 0, got_Ping },
38615diff --git a/drivers/block/drbd/drbd_worker.c b/drivers/block/drbd/drbd_worker.c
38616index 84d3175..ccea188 100644
38617--- a/drivers/block/drbd/drbd_worker.c
38618+++ b/drivers/block/drbd/drbd_worker.c
38619@@ -400,7 +400,7 @@ static int read_for_csum(struct drbd_conf *mdev, sector_t sector, int size)
38620 list_add(&peer_req->w.list, &mdev->read_ee);
38621 spin_unlock_irq(&mdev->tconn->req_lock);
38622
38623- atomic_add(size >> 9, &mdev->rs_sect_ev);
38624+ atomic_add_unchecked(size >> 9, &mdev->rs_sect_ev);
38625 if (drbd_submit_peer_request(mdev, peer_req, READ, DRBD_FAULT_RS_RD) == 0)
38626 return 0;
38627
38628@@ -498,7 +498,7 @@ static int drbd_rs_controller(struct drbd_conf *mdev)
38629 int max_sect;
38630 struct fifo_buffer *plan;
38631
38632- sect_in = atomic_xchg(&mdev->rs_sect_in, 0); /* Number of sectors that came in */
38633+ sect_in = atomic_xchg_unchecked(&mdev->rs_sect_in, 0); /* Number of sectors that came in */
38634 mdev->rs_in_flight -= sect_in;
38635
38636 dc = rcu_dereference(mdev->ldev->disk_conf);
38637@@ -1561,8 +1561,8 @@ void drbd_rs_controller_reset(struct drbd_conf *mdev)
38638 {
38639 struct fifo_buffer *plan;
38640
38641- atomic_set(&mdev->rs_sect_in, 0);
38642- atomic_set(&mdev->rs_sect_ev, 0);
38643+ atomic_set_unchecked(&mdev->rs_sect_in, 0);
38644+ atomic_set_unchecked(&mdev->rs_sect_ev, 0);
38645 mdev->rs_in_flight = 0;
38646
38647 /* Updating the RCU protected object in place is necessary since
38302diff --git a/drivers/block/loop.c b/drivers/block/loop.c 38648diff --git a/drivers/block/loop.c b/drivers/block/loop.c
38303index 66e8c3b..9b68dd9 100644 38649index 66e8c3b..9b68dd9 100644
38304--- a/drivers/block/loop.c 38650--- a/drivers/block/loop.c
@@ -50165,6 +50511,32 @@ index 1b3a094..068e683 100644
50165 } 50511 }
50166 } 50512 }
50167 EXPORT_SYMBOL(fc_exch_update_stats); 50513 EXPORT_SYMBOL(fc_exch_update_stats);
50514diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
50515index 4046241..4549986 100644
50516--- a/drivers/scsi/libiscsi.c
50517+++ b/drivers/scsi/libiscsi.c
50518@@ -717,11 +717,21 @@ __iscsi_conn_send_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr,
50519 return NULL;
50520 }
50521
50522+ if (data_size > ISCSI_DEF_MAX_RECV_SEG_LEN) {
50523+ iscsi_conn_printk(KERN_ERR, conn, "Invalid buffer len of %u for login task. Max len is %u\n", data_size, ISCSI_DEF_MAX_RECV_SEG_LEN);
50524+ return NULL;
50525+ }
50526+
50527 task = conn->login_task;
50528 } else {
50529 if (session->state != ISCSI_STATE_LOGGED_IN)
50530 return NULL;
50531
50532+ if (data_size != 0) {
50533+ iscsi_conn_printk(KERN_ERR, conn, "Can not send data buffer of len %u for op 0x%x\n", data_size, opcode);
50534+ return NULL;
50535+ }
50536+
50537 BUG_ON(conn->c_stage == ISCSI_CONN_INITIAL_STAGE);
50538 BUG_ON(conn->c_stage == ISCSI_CONN_STOPPED);
50539
50168diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c 50540diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c
50169index d289583..b745eec 100644 50541index d289583..b745eec 100644
50170--- a/drivers/scsi/libsas/sas_ata.c 50542--- a/drivers/scsi/libsas/sas_ata.c
@@ -51070,6 +51442,19 @@ index 52b7731..d604da0 100644
51070 op_data = ll_prep_md_op_data(NULL, dir, NULL, filename, 51442 op_data = ll_prep_md_op_data(NULL, dir, NULL, filename,
51071 strlen(filename), mode, LUSTRE_OPC_MKDIR, 51443 strlen(filename), mode, LUSTRE_OPC_MKDIR,
51072 lump); 51444 lump);
51445diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c
51446index 6cfdb9e..1ddab59 100644
51447--- a/drivers/staging/lustre/lustre/llite/llite_lib.c
51448+++ b/drivers/staging/lustre/lustre/llite/llite_lib.c
51449@@ -576,7 +576,7 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt,
51450 if (sb->s_root == NULL) {
51451 CERROR("%s: can't make root dentry\n",
51452 ll_get_fsname(sb, NULL, 0));
51453- GOTO(out_root, err = -ENOMEM);
51454+ GOTO(out_lock_cn_cb, err = -ENOMEM);
51455 }
51456
51457 /* kernel >= 2.6.38 store dentry operations in sb->s_d_op. */
51073diff --git a/drivers/staging/media/solo6x10/solo6x10-core.c b/drivers/staging/media/solo6x10/solo6x10-core.c 51458diff --git a/drivers/staging/media/solo6x10/solo6x10-core.c b/drivers/staging/media/solo6x10/solo6x10-core.c
51074index 480b7c4..6846324 100644 51459index 480b7c4..6846324 100644
51075--- a/drivers/staging/media/solo6x10/solo6x10-core.c 51460--- a/drivers/staging/media/solo6x10/solo6x10-core.c
@@ -51284,7 +51669,7 @@ index d07fcb5..358e1e1 100644
51284 return; 51669 return;
51285 } 51670 }
51286diff --git a/drivers/staging/vt6655/hostap.c b/drivers/staging/vt6655/hostap.c 51671diff --git a/drivers/staging/vt6655/hostap.c b/drivers/staging/vt6655/hostap.c
51287index 6eecd53..29317c6 100644 51672index 6eecd53..1025c8b 100644
51288--- a/drivers/staging/vt6655/hostap.c 51673--- a/drivers/staging/vt6655/hostap.c
51289+++ b/drivers/staging/vt6655/hostap.c 51674+++ b/drivers/staging/vt6655/hostap.c
51290@@ -69,14 +69,13 @@ static int msglevel = MSG_LEVEL_INFO; 51675@@ -69,14 +69,13 @@ static int msglevel = MSG_LEVEL_INFO;
@@ -51313,6 +51698,16 @@ index 6eecd53..29317c6 100644
51313 pDevice->apdev->netdev_ops = &apdev_netdev_ops; 51698 pDevice->apdev->netdev_ops = &apdev_netdev_ops;
51314 51699
51315 pDevice->apdev->type = ARPHRD_IEEE80211; 51700 pDevice->apdev->type = ARPHRD_IEEE80211;
51701@@ -385,6 +386,9 @@ static int hostap_set_generic_element(PSDevice pDevice,
51702 {
51703 PSMgmtObject pMgmt = pDevice->pMgmt;
51704
51705+ if (param->u.generic_elem.len > sizeof(pMgmt->abyWPAIE))
51706+ return -EINVAL;
51707+
51708 memcpy(pMgmt->abyWPAIE,
51709 param->u.generic_elem.data,
51710 param->u.generic_elem.len
51316diff --git a/drivers/staging/vt6656/hostap.c b/drivers/staging/vt6656/hostap.c 51711diff --git a/drivers/staging/vt6656/hostap.c b/drivers/staging/vt6656/hostap.c
51317index 67ba48b..24e602f 100644 51712index 67ba48b..24e602f 100644
51318--- a/drivers/staging/vt6656/hostap.c 51713--- a/drivers/staging/vt6656/hostap.c
@@ -58387,10 +58782,30 @@ index ff286f3..8153a14 100644
58387 .attrs = attrs, 58782 .attrs = attrs,
58388 }; 58783 };
58389diff --git a/fs/buffer.c b/fs/buffer.c 58784diff --git a/fs/buffer.c b/fs/buffer.c
58390index 27265a8..289f488 100644 58785index 27265a8..8673b7b 100644
58391--- a/fs/buffer.c 58786--- a/fs/buffer.c
58392+++ b/fs/buffer.c 58787+++ b/fs/buffer.c
58393@@ -3428,7 +3428,7 @@ void __init buffer_init(void) 58788@@ -1029,7 +1029,8 @@ grow_dev_page(struct block_device *bdev, sector_t block,
58789 bh = page_buffers(page);
58790 if (bh->b_size == size) {
58791 end_block = init_page_buffers(page, bdev,
58792- index << sizebits, size);
58793+ (sector_t)index << sizebits,
58794+ size);
58795 goto done;
58796 }
58797 if (!try_to_free_buffers(page))
58798@@ -1050,7 +1051,8 @@ grow_dev_page(struct block_device *bdev, sector_t block,
58799 */
58800 spin_lock(&inode->i_mapping->private_lock);
58801 link_dev_buffers(page, bh);
58802- end_block = init_page_buffers(page, bdev, index << sizebits, size);
58803+ end_block = init_page_buffers(page, bdev, (sector_t)index << sizebits,
58804+ size);
58805 spin_unlock(&inode->i_mapping->private_lock);
58806 done:
58807 ret = (block < end_block) ? 1 : -ENXIO;
58808@@ -3428,7 +3430,7 @@ void __init buffer_init(void)
58394 bh_cachep = kmem_cache_create("buffer_head", 58809 bh_cachep = kmem_cache_create("buffer_head",
58395 sizeof(struct buffer_head), 0, 58810 sizeof(struct buffer_head), 0,
58396 (SLAB_RECLAIM_ACCOUNT|SLAB_PANIC| 58811 (SLAB_RECLAIM_ACCOUNT|SLAB_PANIC|
@@ -62726,7 +63141,7 @@ index b29e42f..5ea7fdf 100644
62726 #define MNT_NS_INTERNAL ERR_PTR(-EINVAL) /* distinct from any mnt_namespace */ 63141 #define MNT_NS_INTERNAL ERR_PTR(-EINVAL) /* distinct from any mnt_namespace */
62727 63142
62728diff --git a/fs/namei.c b/fs/namei.c 63143diff --git a/fs/namei.c b/fs/namei.c
62729index d5a4fae..d221b37 100644 63144index d5a4fae..27e6c48 100644
62730--- a/fs/namei.c 63145--- a/fs/namei.c
62731+++ b/fs/namei.c 63146+++ b/fs/namei.c
62732@@ -331,17 +331,34 @@ int generic_permission(struct inode *inode, int mask) 63147@@ -331,17 +331,34 @@ int generic_permission(struct inode *inode, int mask)
@@ -62782,7 +63197,42 @@ index d5a4fae..d221b37 100644
62782 return -EACCES; 63197 return -EACCES;
62783 } 63198 }
62784 63199
62785@@ -823,7 +832,7 @@ follow_link(struct path *link, struct nameidata *nd, void **p) 63200@@ -642,24 +651,22 @@ static int complete_walk(struct nameidata *nd)
63201
63202 static __always_inline void set_root(struct nameidata *nd)
63203 {
63204- if (!nd->root.mnt)
63205- get_fs_root(current->fs, &nd->root);
63206+ get_fs_root(current->fs, &nd->root);
63207 }
63208
63209 static int link_path_walk(const char *, struct nameidata *);
63210
63211-static __always_inline void set_root_rcu(struct nameidata *nd)
63212+static __always_inline unsigned set_root_rcu(struct nameidata *nd)
63213 {
63214- if (!nd->root.mnt) {
63215- struct fs_struct *fs = current->fs;
63216- unsigned seq;
63217+ struct fs_struct *fs = current->fs;
63218+ unsigned seq, res;
63219
63220- do {
63221- seq = read_seqcount_begin(&fs->seq);
63222- nd->root = fs->root;
63223- nd->seq = __read_seqcount_begin(&nd->root.dentry->d_seq);
63224- } while (read_seqcount_retry(&fs->seq, seq));
63225- }
63226+ do {
63227+ seq = read_seqcount_begin(&fs->seq);
63228+ nd->root = fs->root;
63229+ res = __read_seqcount_begin(&nd->root.dentry->d_seq);
63230+ } while (read_seqcount_retry(&fs->seq, seq));
63231+ return res;
63232 }
63233
63234 static void path_put_conditional(struct path *path, struct nameidata *nd)
63235@@ -823,7 +830,7 @@ follow_link(struct path *link, struct nameidata *nd, void **p)
62786 { 63236 {
62787 struct dentry *dentry = link->dentry; 63237 struct dentry *dentry = link->dentry;
62788 int error; 63238 int error;
@@ -62791,7 +63241,7 @@ index d5a4fae..d221b37 100644
62791 63241
62792 BUG_ON(nd->flags & LOOKUP_RCU); 63242 BUG_ON(nd->flags & LOOKUP_RCU);
62793 63243
62794@@ -844,6 +853,12 @@ follow_link(struct path *link, struct nameidata *nd, void **p) 63244@@ -844,6 +851,12 @@ follow_link(struct path *link, struct nameidata *nd, void **p)
62795 if (error) 63245 if (error)
62796 goto out_put_nd_path; 63246 goto out_put_nd_path;
62797 63247
@@ -62804,7 +63254,68 @@ index d5a4fae..d221b37 100644
62804 nd->last_type = LAST_BIND; 63254 nd->last_type = LAST_BIND;
62805 *p = dentry->d_inode->i_op->follow_link(dentry, nd); 63255 *p = dentry->d_inode->i_op->follow_link(dentry, nd);
62806 error = PTR_ERR(*p); 63256 error = PTR_ERR(*p);
62807@@ -1592,6 +1607,8 @@ static inline int nested_symlink(struct path *path, struct nameidata *nd) 63257@@ -859,7 +872,8 @@ follow_link(struct path *link, struct nameidata *nd, void **p)
63258 return PTR_ERR(s);
63259 }
63260 if (*s == '/') {
63261- set_root(nd);
63262+ if (!nd->root.mnt)
63263+ set_root(nd);
63264 path_put(&nd->path);
63265 nd->path = nd->root;
63266 path_get(&nd->root);
63267@@ -1132,7 +1146,9 @@ static bool __follow_mount_rcu(struct nameidata *nd, struct path *path,
63268
63269 static int follow_dotdot_rcu(struct nameidata *nd)
63270 {
63271- set_root_rcu(nd);
63272+ struct inode *inode = nd->inode;
63273+ if (!nd->root.mnt)
63274+ set_root_rcu(nd);
63275
63276 while (1) {
63277 if (nd->path.dentry == nd->root.dentry &&
63278@@ -1144,6 +1160,7 @@ static int follow_dotdot_rcu(struct nameidata *nd)
63279 struct dentry *parent = old->d_parent;
63280 unsigned seq;
63281
63282+ inode = parent->d_inode;
63283 seq = read_seqcount_begin(&parent->d_seq);
63284 if (read_seqcount_retry(&old->d_seq, nd->seq))
63285 goto failed;
63286@@ -1153,6 +1170,7 @@ static int follow_dotdot_rcu(struct nameidata *nd)
63287 }
63288 if (!follow_up_rcu(&nd->path))
63289 break;
63290+ inode = nd->path.dentry->d_inode;
63291 nd->seq = read_seqcount_begin(&nd->path.dentry->d_seq);
63292 }
63293 while (d_mountpoint(nd->path.dentry)) {
63294@@ -1162,11 +1180,12 @@ static int follow_dotdot_rcu(struct nameidata *nd)
63295 break;
63296 nd->path.mnt = &mounted->mnt;
63297 nd->path.dentry = mounted->mnt.mnt_root;
63298+ inode = nd->path.dentry->d_inode;
63299 nd->seq = read_seqcount_begin(&nd->path.dentry->d_seq);
63300 if (!read_seqretry(&mount_lock, nd->m_seq))
63301 goto failed;
63302 }
63303- nd->inode = nd->path.dentry->d_inode;
63304+ nd->inode = inode;
63305 return 0;
63306
63307 failed:
63308@@ -1244,7 +1263,8 @@ static void follow_mount(struct path *path)
63309
63310 static void follow_dotdot(struct nameidata *nd)
63311 {
63312- set_root(nd);
63313+ if (!nd->root.mnt)
63314+ set_root(nd);
63315
63316 while(1) {
63317 struct dentry *old = nd->path.dentry;
63318@@ -1592,6 +1612,8 @@ static inline int nested_symlink(struct path *path, struct nameidata *nd)
62808 if (res) 63319 if (res)
62809 break; 63320 break;
62810 res = walk_component(nd, path, LOOKUP_FOLLOW); 63321 res = walk_component(nd, path, LOOKUP_FOLLOW);
@@ -62813,7 +63324,7 @@ index d5a4fae..d221b37 100644
62813 put_link(nd, &link, cookie); 63324 put_link(nd, &link, cookie);
62814 } while (res > 0); 63325 } while (res > 0);
62815 63326
62816@@ -1664,7 +1681,7 @@ EXPORT_SYMBOL(full_name_hash); 63327@@ -1664,7 +1686,7 @@ EXPORT_SYMBOL(full_name_hash);
62817 static inline unsigned long hash_name(const char *name, unsigned int *hashp) 63328 static inline unsigned long hash_name(const char *name, unsigned int *hashp)
62818 { 63329 {
62819 unsigned long a, b, adata, bdata, mask, hash, len; 63330 unsigned long a, b, adata, bdata, mask, hash, len;
@@ -62822,7 +63333,32 @@ index d5a4fae..d221b37 100644
62822 63333
62823 hash = a = 0; 63334 hash = a = 0;
62824 len = -sizeof(unsigned long); 63335 len = -sizeof(unsigned long);
62825@@ -1948,6 +1965,8 @@ static int path_lookupat(int dfd, const char *name, 63336@@ -1842,7 +1864,7 @@ static int path_init(int dfd, const char *name, unsigned int flags,
63337 if (*name=='/') {
63338 if (flags & LOOKUP_RCU) {
63339 rcu_read_lock();
63340- set_root_rcu(nd);
63341+ nd->seq = set_root_rcu(nd);
63342 } else {
63343 set_root(nd);
63344 path_get(&nd->root);
63345@@ -1893,7 +1915,14 @@ static int path_init(int dfd, const char *name, unsigned int flags,
63346 }
63347
63348 nd->inode = nd->path.dentry->d_inode;
63349- return 0;
63350+ if (!(flags & LOOKUP_RCU))
63351+ return 0;
63352+ if (likely(!read_seqcount_retry(&nd->path.dentry->d_seq, nd->seq)))
63353+ return 0;
63354+ if (!(nd->flags & LOOKUP_ROOT))
63355+ nd->root.mnt = NULL;
63356+ rcu_read_unlock();
63357+ return -ECHILD;
63358 }
63359
63360 static inline int lookup_last(struct nameidata *nd, struct path *path)
63361@@ -1948,6 +1977,8 @@ static int path_lookupat(int dfd, const char *name,
62826 if (err) 63362 if (err)
62827 break; 63363 break;
62828 err = lookup_last(nd, &path); 63364 err = lookup_last(nd, &path);
@@ -62831,7 +63367,7 @@ index d5a4fae..d221b37 100644
62831 put_link(nd, &link, cookie); 63367 put_link(nd, &link, cookie);
62832 } 63368 }
62833 } 63369 }
62834@@ -1955,6 +1974,13 @@ static int path_lookupat(int dfd, const char *name, 63370@@ -1955,6 +1986,13 @@ static int path_lookupat(int dfd, const char *name,
62835 if (!err) 63371 if (!err)
62836 err = complete_walk(nd); 63372 err = complete_walk(nd);
62837 63373
@@ -62845,7 +63381,7 @@ index d5a4fae..d221b37 100644
62845 if (!err && nd->flags & LOOKUP_DIRECTORY) { 63381 if (!err && nd->flags & LOOKUP_DIRECTORY) {
62846 if (!d_can_lookup(nd->path.dentry)) { 63382 if (!d_can_lookup(nd->path.dentry)) {
62847 path_put(&nd->path); 63383 path_put(&nd->path);
62848@@ -1982,8 +2008,15 @@ static int filename_lookup(int dfd, struct filename *name, 63384@@ -1982,8 +2020,15 @@ static int filename_lookup(int dfd, struct filename *name,
62849 retval = path_lookupat(dfd, name->name, 63385 retval = path_lookupat(dfd, name->name,
62850 flags | LOOKUP_REVAL, nd); 63386 flags | LOOKUP_REVAL, nd);
62851 63387
@@ -62862,7 +63398,7 @@ index d5a4fae..d221b37 100644
62862 return retval; 63398 return retval;
62863 } 63399 }
62864 63400
62865@@ -2558,6 +2591,13 @@ static int may_open(struct path *path, int acc_mode, int flag) 63401@@ -2558,6 +2603,13 @@ static int may_open(struct path *path, int acc_mode, int flag)
62866 if (flag & O_NOATIME && !inode_owner_or_capable(inode)) 63402 if (flag & O_NOATIME && !inode_owner_or_capable(inode))
62867 return -EPERM; 63403 return -EPERM;
62868 63404
@@ -62876,7 +63412,7 @@ index d5a4fae..d221b37 100644
62876 return 0; 63412 return 0;
62877 } 63413 }
62878 63414
62879@@ -2789,7 +2829,7 @@ looked_up: 63415@@ -2789,7 +2841,7 @@ looked_up:
62880 * cleared otherwise prior to returning. 63416 * cleared otherwise prior to returning.
62881 */ 63417 */
62882 static int lookup_open(struct nameidata *nd, struct path *path, 63418 static int lookup_open(struct nameidata *nd, struct path *path,
@@ -62885,7 +63421,7 @@ index d5a4fae..d221b37 100644
62885 const struct open_flags *op, 63421 const struct open_flags *op,
62886 bool got_write, int *opened) 63422 bool got_write, int *opened)
62887 { 63423 {
62888@@ -2824,6 +2864,17 @@ static int lookup_open(struct nameidata *nd, struct path *path, 63424@@ -2824,6 +2876,17 @@ static int lookup_open(struct nameidata *nd, struct path *path,
62889 /* Negative dentry, just create the file */ 63425 /* Negative dentry, just create the file */
62890 if (!dentry->d_inode && (op->open_flag & O_CREAT)) { 63426 if (!dentry->d_inode && (op->open_flag & O_CREAT)) {
62891 umode_t mode = op->mode; 63427 umode_t mode = op->mode;
@@ -62903,7 +63439,7 @@ index d5a4fae..d221b37 100644
62903 if (!IS_POSIXACL(dir->d_inode)) 63439 if (!IS_POSIXACL(dir->d_inode))
62904 mode &= ~current_umask(); 63440 mode &= ~current_umask();
62905 /* 63441 /*
62906@@ -2845,6 +2896,8 @@ static int lookup_open(struct nameidata *nd, struct path *path, 63442@@ -2845,6 +2908,8 @@ static int lookup_open(struct nameidata *nd, struct path *path,
62907 nd->flags & LOOKUP_EXCL); 63443 nd->flags & LOOKUP_EXCL);
62908 if (error) 63444 if (error)
62909 goto out_dput; 63445 goto out_dput;
@@ -62912,7 +63448,7 @@ index d5a4fae..d221b37 100644
62912 } 63448 }
62913 out_no_open: 63449 out_no_open:
62914 path->dentry = dentry; 63450 path->dentry = dentry;
62915@@ -2859,7 +2912,7 @@ out_dput: 63451@@ -2859,7 +2924,7 @@ out_dput:
62916 /* 63452 /*
62917 * Handle the last step of open() 63453 * Handle the last step of open()
62918 */ 63454 */
@@ -62921,7 +63457,7 @@ index d5a4fae..d221b37 100644
62921 struct file *file, const struct open_flags *op, 63457 struct file *file, const struct open_flags *op,
62922 int *opened, struct filename *name) 63458 int *opened, struct filename *name)
62923 { 63459 {
62924@@ -2909,6 +2962,15 @@ static int do_last(struct nameidata *nd, struct path *path, 63460@@ -2909,6 +2974,15 @@ static int do_last(struct nameidata *nd, struct path *path,
62925 if (error) 63461 if (error)
62926 return error; 63462 return error;
62927 63463
@@ -62937,7 +63473,7 @@ index d5a4fae..d221b37 100644
62937 audit_inode(name, dir, LOOKUP_PARENT); 63473 audit_inode(name, dir, LOOKUP_PARENT);
62938 error = -EISDIR; 63474 error = -EISDIR;
62939 /* trailing slashes? */ 63475 /* trailing slashes? */
62940@@ -2928,7 +2990,7 @@ retry_lookup: 63476@@ -2928,7 +3002,7 @@ retry_lookup:
62941 */ 63477 */
62942 } 63478 }
62943 mutex_lock(&dir->d_inode->i_mutex); 63479 mutex_lock(&dir->d_inode->i_mutex);
@@ -62946,7 +63482,7 @@ index d5a4fae..d221b37 100644
62946 mutex_unlock(&dir->d_inode->i_mutex); 63482 mutex_unlock(&dir->d_inode->i_mutex);
62947 63483
62948 if (error <= 0) { 63484 if (error <= 0) {
62949@@ -2952,11 +3014,28 @@ retry_lookup: 63485@@ -2952,11 +3026,28 @@ retry_lookup:
62950 goto finish_open_created; 63486 goto finish_open_created;
62951 } 63487 }
62952 63488
@@ -62976,7 +63512,7 @@ index d5a4fae..d221b37 100644
62976 63512
62977 /* 63513 /*
62978 * If atomic_open() acquired write access it is dropped now due to 63514 * If atomic_open() acquired write access it is dropped now due to
62979@@ -2997,6 +3076,11 @@ finish_lookup: 63515@@ -2997,6 +3088,11 @@ finish_lookup:
62980 } 63516 }
62981 } 63517 }
62982 BUG_ON(inode != path->dentry->d_inode); 63518 BUG_ON(inode != path->dentry->d_inode);
@@ -62988,7 +63524,7 @@ index d5a4fae..d221b37 100644
62988 return 1; 63524 return 1;
62989 } 63525 }
62990 63526
62991@@ -3006,7 +3090,6 @@ finish_lookup: 63527@@ -3006,7 +3102,6 @@ finish_lookup:
62992 save_parent.dentry = nd->path.dentry; 63528 save_parent.dentry = nd->path.dentry;
62993 save_parent.mnt = mntget(path->mnt); 63529 save_parent.mnt = mntget(path->mnt);
62994 nd->path.dentry = path->dentry; 63530 nd->path.dentry = path->dentry;
@@ -62996,7 +63532,7 @@ index d5a4fae..d221b37 100644
62996 } 63532 }
62997 nd->inode = inode; 63533 nd->inode = inode;
62998 /* Why this, you ask? _Now_ we might have grown LOOKUP_JUMPED... */ 63534 /* Why this, you ask? _Now_ we might have grown LOOKUP_JUMPED... */
62999@@ -3016,7 +3099,18 @@ finish_open: 63535@@ -3016,7 +3111,18 @@ finish_open:
63000 path_put(&save_parent); 63536 path_put(&save_parent);
63001 return error; 63537 return error;
63002 } 63538 }
@@ -63015,7 +63551,7 @@ index d5a4fae..d221b37 100644
63015 error = -EISDIR; 63551 error = -EISDIR;
63016 if ((open_flag & O_CREAT) && d_is_dir(nd->path.dentry)) 63552 if ((open_flag & O_CREAT) && d_is_dir(nd->path.dentry))
63017 goto out; 63553 goto out;
63018@@ -3179,7 +3273,7 @@ static struct file *path_openat(int dfd, struct filename *pathname, 63554@@ -3179,7 +3285,7 @@ static struct file *path_openat(int dfd, struct filename *pathname,
63019 if (unlikely(error)) 63555 if (unlikely(error))
63020 goto out; 63556 goto out;
63021 63557
@@ -63024,7 +63560,7 @@ index d5a4fae..d221b37 100644
63024 while (unlikely(error > 0)) { /* trailing symlink */ 63560 while (unlikely(error > 0)) { /* trailing symlink */
63025 struct path link = path; 63561 struct path link = path;
63026 void *cookie; 63562 void *cookie;
63027@@ -3197,7 +3291,7 @@ static struct file *path_openat(int dfd, struct filename *pathname, 63563@@ -3197,7 +3303,7 @@ static struct file *path_openat(int dfd, struct filename *pathname,
63028 error = follow_link(&link, nd, &cookie); 63564 error = follow_link(&link, nd, &cookie);
63029 if (unlikely(error)) 63565 if (unlikely(error))
63030 break; 63566 break;
@@ -63033,7 +63569,7 @@ index d5a4fae..d221b37 100644
63033 put_link(nd, &link, cookie); 63569 put_link(nd, &link, cookie);
63034 } 63570 }
63035 out: 63571 out:
63036@@ -3297,9 +3391,11 @@ struct dentry *kern_path_create(int dfd, const char *pathname, 63572@@ -3297,9 +3403,11 @@ struct dentry *kern_path_create(int dfd, const char *pathname,
63037 goto unlock; 63573 goto unlock;
63038 63574
63039 error = -EEXIST; 63575 error = -EEXIST;
@@ -63047,7 +63583,7 @@ index d5a4fae..d221b37 100644
63047 /* 63583 /*
63048 * Special case - lookup gave negative, but... we had foo/bar/ 63584 * Special case - lookup gave negative, but... we had foo/bar/
63049 * From the vfs_mknod() POV we just have a negative dentry - 63585 * From the vfs_mknod() POV we just have a negative dentry -
63050@@ -3351,6 +3447,20 @@ struct dentry *user_path_create(int dfd, const char __user *pathname, 63586@@ -3351,6 +3459,20 @@ struct dentry *user_path_create(int dfd, const char __user *pathname,
63051 } 63587 }
63052 EXPORT_SYMBOL(user_path_create); 63588 EXPORT_SYMBOL(user_path_create);
63053 63589
@@ -63068,7 +63604,7 @@ index d5a4fae..d221b37 100644
63068 int vfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t dev) 63604 int vfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t dev)
63069 { 63605 {
63070 int error = may_create(dir, dentry); 63606 int error = may_create(dir, dentry);
63071@@ -3413,6 +3523,17 @@ retry: 63607@@ -3413,6 +3535,17 @@ retry:
63072 63608
63073 if (!IS_POSIXACL(path.dentry->d_inode)) 63609 if (!IS_POSIXACL(path.dentry->d_inode))
63074 mode &= ~current_umask(); 63610 mode &= ~current_umask();
@@ -63086,7 +63622,7 @@ index d5a4fae..d221b37 100644
63086 error = security_path_mknod(&path, dentry, mode, dev); 63622 error = security_path_mknod(&path, dentry, mode, dev);
63087 if (error) 63623 if (error)
63088 goto out; 63624 goto out;
63089@@ -3429,6 +3550,8 @@ retry: 63625@@ -3429,6 +3562,8 @@ retry:
63090 break; 63626 break;
63091 } 63627 }
63092 out: 63628 out:
@@ -63095,7 +63631,7 @@ index d5a4fae..d221b37 100644
63095 done_path_create(&path, dentry); 63631 done_path_create(&path, dentry);
63096 if (retry_estale(error, lookup_flags)) { 63632 if (retry_estale(error, lookup_flags)) {
63097 lookup_flags |= LOOKUP_REVAL; 63633 lookup_flags |= LOOKUP_REVAL;
63098@@ -3481,9 +3604,16 @@ retry: 63634@@ -3481,9 +3616,16 @@ retry:
63099 63635
63100 if (!IS_POSIXACL(path.dentry->d_inode)) 63636 if (!IS_POSIXACL(path.dentry->d_inode))
63101 mode &= ~current_umask(); 63637 mode &= ~current_umask();
@@ -63112,7 +63648,7 @@ index d5a4fae..d221b37 100644
63112 done_path_create(&path, dentry); 63648 done_path_create(&path, dentry);
63113 if (retry_estale(error, lookup_flags)) { 63649 if (retry_estale(error, lookup_flags)) {
63114 lookup_flags |= LOOKUP_REVAL; 63650 lookup_flags |= LOOKUP_REVAL;
63115@@ -3564,6 +3694,8 @@ static long do_rmdir(int dfd, const char __user *pathname) 63651@@ -3564,6 +3706,8 @@ static long do_rmdir(int dfd, const char __user *pathname)
63116 struct filename *name; 63652 struct filename *name;
63117 struct dentry *dentry; 63653 struct dentry *dentry;
63118 struct nameidata nd; 63654 struct nameidata nd;
@@ -63121,7 +63657,7 @@ index d5a4fae..d221b37 100644
63121 unsigned int lookup_flags = 0; 63657 unsigned int lookup_flags = 0;
63122 retry: 63658 retry:
63123 name = user_path_parent(dfd, pathname, &nd, lookup_flags); 63659 name = user_path_parent(dfd, pathname, &nd, lookup_flags);
63124@@ -3596,10 +3728,21 @@ retry: 63660@@ -3596,10 +3740,21 @@ retry:
63125 error = -ENOENT; 63661 error = -ENOENT;
63126 goto exit3; 63662 goto exit3;
63127 } 63663 }
@@ -63143,7 +63679,7 @@ index d5a4fae..d221b37 100644
63143 exit3: 63679 exit3:
63144 dput(dentry); 63680 dput(dentry);
63145 exit2: 63681 exit2:
63146@@ -3689,6 +3832,8 @@ static long do_unlinkat(int dfd, const char __user *pathname) 63682@@ -3689,6 +3844,8 @@ static long do_unlinkat(int dfd, const char __user *pathname)
63147 struct nameidata nd; 63683 struct nameidata nd;
63148 struct inode *inode = NULL; 63684 struct inode *inode = NULL;
63149 struct inode *delegated_inode = NULL; 63685 struct inode *delegated_inode = NULL;
@@ -63152,7 +63688,7 @@ index d5a4fae..d221b37 100644
63152 unsigned int lookup_flags = 0; 63688 unsigned int lookup_flags = 0;
63153 retry: 63689 retry:
63154 name = user_path_parent(dfd, pathname, &nd, lookup_flags); 63690 name = user_path_parent(dfd, pathname, &nd, lookup_flags);
63155@@ -3715,10 +3860,22 @@ retry_deleg: 63691@@ -3715,10 +3872,22 @@ retry_deleg:
63156 if (d_is_negative(dentry)) 63692 if (d_is_negative(dentry))
63157 goto slashes; 63693 goto slashes;
63158 ihold(inode); 63694 ihold(inode);
@@ -63175,7 +63711,7 @@ index d5a4fae..d221b37 100644
63175 exit2: 63711 exit2:
63176 dput(dentry); 63712 dput(dentry);
63177 } 63713 }
63178@@ -3806,9 +3963,17 @@ retry: 63714@@ -3806,9 +3975,17 @@ retry:
63179 if (IS_ERR(dentry)) 63715 if (IS_ERR(dentry))
63180 goto out_putname; 63716 goto out_putname;
63181 63717
@@ -63193,7 +63729,7 @@ index d5a4fae..d221b37 100644
63193 done_path_create(&path, dentry); 63729 done_path_create(&path, dentry);
63194 if (retry_estale(error, lookup_flags)) { 63730 if (retry_estale(error, lookup_flags)) {
63195 lookup_flags |= LOOKUP_REVAL; 63731 lookup_flags |= LOOKUP_REVAL;
63196@@ -3911,6 +4076,7 @@ SYSCALL_DEFINE5(linkat, int, olddfd, const char __user *, oldname, 63732@@ -3911,6 +4088,7 @@ SYSCALL_DEFINE5(linkat, int, olddfd, const char __user *, oldname,
63197 struct dentry *new_dentry; 63733 struct dentry *new_dentry;
63198 struct path old_path, new_path; 63734 struct path old_path, new_path;
63199 struct inode *delegated_inode = NULL; 63735 struct inode *delegated_inode = NULL;
@@ -63201,7 +63737,7 @@ index d5a4fae..d221b37 100644
63201 int how = 0; 63737 int how = 0;
63202 int error; 63738 int error;
63203 63739
63204@@ -3934,7 +4100,7 @@ retry: 63740@@ -3934,7 +4112,7 @@ retry:
63205 if (error) 63741 if (error)
63206 return error; 63742 return error;
63207 63743
@@ -63210,7 +63746,7 @@ index d5a4fae..d221b37 100644
63210 (how & LOOKUP_REVAL)); 63746 (how & LOOKUP_REVAL));
63211 error = PTR_ERR(new_dentry); 63747 error = PTR_ERR(new_dentry);
63212 if (IS_ERR(new_dentry)) 63748 if (IS_ERR(new_dentry))
63213@@ -3946,11 +4112,28 @@ retry: 63749@@ -3946,11 +4124,28 @@ retry:
63214 error = may_linkat(&old_path); 63750 error = may_linkat(&old_path);
63215 if (unlikely(error)) 63751 if (unlikely(error))
63216 goto out_dput; 63752 goto out_dput;
@@ -63239,7 +63775,7 @@ index d5a4fae..d221b37 100644
63239 done_path_create(&new_path, new_dentry); 63775 done_path_create(&new_path, new_dentry);
63240 if (delegated_inode) { 63776 if (delegated_inode) {
63241 error = break_deleg_wait(&delegated_inode); 63777 error = break_deleg_wait(&delegated_inode);
63242@@ -4237,6 +4420,12 @@ retry_deleg: 63778@@ -4237,6 +4432,12 @@ retry_deleg:
63243 if (new_dentry == trap) 63779 if (new_dentry == trap)
63244 goto exit5; 63780 goto exit5;
63245 63781
@@ -63252,7 +63788,7 @@ index d5a4fae..d221b37 100644
63252 error = security_path_rename(&oldnd.path, old_dentry, 63788 error = security_path_rename(&oldnd.path, old_dentry,
63253 &newnd.path, new_dentry); 63789 &newnd.path, new_dentry);
63254 if (error) 63790 if (error)
63255@@ -4244,6 +4433,9 @@ retry_deleg: 63791@@ -4244,6 +4445,9 @@ retry_deleg:
63256 error = vfs_rename(old_dir->d_inode, old_dentry, 63792 error = vfs_rename(old_dir->d_inode, old_dentry,
63257 new_dir->d_inode, new_dentry, 63793 new_dir->d_inode, new_dentry,
63258 &delegated_inode); 63794 &delegated_inode);
@@ -63262,7 +63798,7 @@ index d5a4fae..d221b37 100644
63262 exit5: 63798 exit5:
63263 dput(new_dentry); 63799 dput(new_dentry);
63264 exit4: 63800 exit4:
63265@@ -4280,6 +4472,8 @@ SYSCALL_DEFINE2(rename, const char __user *, oldname, const char __user *, newna 63801@@ -4280,6 +4484,8 @@ SYSCALL_DEFINE2(rename, const char __user *, oldname, const char __user *, newna
63266 63802
63267 int vfs_readlink(struct dentry *dentry, char __user *buffer, int buflen, const char *link) 63803 int vfs_readlink(struct dentry *dentry, char __user *buffer, int buflen, const char *link)
63268 { 63804 {
@@ -63271,7 +63807,7 @@ index d5a4fae..d221b37 100644
63271 int len; 63807 int len;
63272 63808
63273 len = PTR_ERR(link); 63809 len = PTR_ERR(link);
63274@@ -4289,7 +4483,14 @@ int vfs_readlink(struct dentry *dentry, char __user *buffer, int buflen, const c 63810@@ -4289,7 +4495,14 @@ int vfs_readlink(struct dentry *dentry, char __user *buffer, int buflen, const c
63275 len = strlen(link); 63811 len = strlen(link);
63276 if (len > (unsigned) buflen) 63812 if (len > (unsigned) buflen)
63277 len = buflen; 63813 len = buflen;
@@ -97308,7 +97844,7 @@ index cdbd312..2e1e0b9 100644
97308 97844
97309 /* 97845 /*
97310diff --git a/mm/shmem.c b/mm/shmem.c 97846diff --git a/mm/shmem.c b/mm/shmem.c
97311index ff85863..6aa94ab 100644 97847index ff85863..7037c25 100644
97312--- a/mm/shmem.c 97848--- a/mm/shmem.c
97313+++ b/mm/shmem.c 97849+++ b/mm/shmem.c
97314@@ -33,7 +33,7 @@ 97850@@ -33,7 +33,7 @@
@@ -97329,7 +97865,19 @@ index ff85863..6aa94ab 100644
97329 97865
97330 /* 97866 /*
97331 * shmem_fallocate communicates with shmem_fault or shmem_writepage via 97867 * shmem_fallocate communicates with shmem_fault or shmem_writepage via
97332@@ -2298,6 +2298,11 @@ static const struct xattr_handler *shmem_xattr_handlers[] = { 97868@@ -2143,8 +2143,10 @@ static int shmem_rename(struct inode *old_dir, struct dentry *old_dentry, struct
97869
97870 if (new_dentry->d_inode) {
97871 (void) shmem_unlink(new_dir, new_dentry);
97872- if (they_are_dirs)
97873+ if (they_are_dirs) {
97874+ drop_nlink(new_dentry->d_inode);
97875 drop_nlink(old_dir);
97876+ }
97877 } else if (they_are_dirs) {
97878 drop_nlink(old_dir);
97879 inc_nlink(new_dir);
97880@@ -2298,6 +2300,11 @@ static const struct xattr_handler *shmem_xattr_handlers[] = {
97333 static int shmem_xattr_validate(const char *name) 97881 static int shmem_xattr_validate(const char *name)
97334 { 97882 {
97335 struct { const char *prefix; size_t len; } arr[] = { 97883 struct { const char *prefix; size_t len; } arr[] = {
@@ -97341,7 +97889,7 @@ index ff85863..6aa94ab 100644
97341 { XATTR_SECURITY_PREFIX, XATTR_SECURITY_PREFIX_LEN }, 97889 { XATTR_SECURITY_PREFIX, XATTR_SECURITY_PREFIX_LEN },
97342 { XATTR_TRUSTED_PREFIX, XATTR_TRUSTED_PREFIX_LEN } 97890 { XATTR_TRUSTED_PREFIX, XATTR_TRUSTED_PREFIX_LEN }
97343 }; 97891 };
97344@@ -2353,6 +2358,15 @@ static int shmem_setxattr(struct dentry *dentry, const char *name, 97892@@ -2353,6 +2360,15 @@ static int shmem_setxattr(struct dentry *dentry, const char *name,
97345 if (err) 97893 if (err)
97346 return err; 97894 return err;
97347 97895
@@ -97357,7 +97905,7 @@ index ff85863..6aa94ab 100644
97357 return simple_xattr_set(&info->xattrs, name, value, size, flags); 97905 return simple_xattr_set(&info->xattrs, name, value, size, flags);
97358 } 97906 }
97359 97907
97360@@ -2665,8 +2679,7 @@ int shmem_fill_super(struct super_block *sb, void *data, int silent) 97908@@ -2665,8 +2681,7 @@ int shmem_fill_super(struct super_block *sb, void *data, int silent)
97361 int err = -ENOMEM; 97909 int err = -ENOMEM;
97362 97910
97363 /* Round up to L1_CACHE_BYTES to resist false sharing */ 97911 /* Round up to L1_CACHE_BYTES to resist false sharing */
@@ -97368,7 +97916,7 @@ index ff85863..6aa94ab 100644
97368 return -ENOMEM; 97916 return -ENOMEM;
97369 97917
97370diff --git a/mm/slab.c b/mm/slab.c 97918diff --git a/mm/slab.c b/mm/slab.c
97371index 6dd8d5f..2482a6d 100644 97919index 6dd8d5f..673c763 100644
97372--- a/mm/slab.c 97920--- a/mm/slab.c
97373+++ b/mm/slab.c 97921+++ b/mm/slab.c
97374@@ -300,10 +300,12 @@ static void kmem_cache_node_init(struct kmem_cache_node *parent) 97922@@ -300,10 +300,12 @@ static void kmem_cache_node_init(struct kmem_cache_node *parent)
@@ -97421,7 +97969,32 @@ index 6dd8d5f..2482a6d 100644
97421 97969
97422 slab_early_init = 0; 97970 slab_early_init = 0;
97423 97971
97424@@ -3484,6 +3488,21 @@ static inline void __cache_free(struct kmem_cache *cachep, void *objp, 97972@@ -2189,7 +2193,8 @@ static int __init_refok setup_cpu_cache(struct kmem_cache *cachep, gfp_t gfp)
97973 int
97974 __kmem_cache_create (struct kmem_cache *cachep, unsigned long flags)
97975 {
97976- size_t left_over, freelist_size, ralign;
97977+ size_t left_over, freelist_size;
97978+ size_t ralign = BYTES_PER_WORD;
97979 gfp_t gfp;
97980 int err;
97981 size_t size = cachep->size;
97982@@ -2222,14 +2227,6 @@ __kmem_cache_create (struct kmem_cache *cachep, unsigned long flags)
97983 size &= ~(BYTES_PER_WORD - 1);
97984 }
97985
97986- /*
97987- * Redzoning and user store require word alignment or possibly larger.
97988- * Note this will be overridden by architecture or caller mandated
97989- * alignment if either is greater than BYTES_PER_WORD.
97990- */
97991- if (flags & SLAB_STORE_USER)
97992- ralign = BYTES_PER_WORD;
97993-
97994 if (flags & SLAB_RED_ZONE) {
97995 ralign = REDZONE_ALIGN;
97996 /* If redzoning, ensure that the second redzone is suitably
97997@@ -3484,6 +3481,21 @@ static inline void __cache_free(struct kmem_cache *cachep, void *objp,
97425 struct array_cache *ac = cpu_cache_get(cachep); 97998 struct array_cache *ac = cpu_cache_get(cachep);
97426 97999
97427 check_irq_off(); 98000 check_irq_off();
@@ -97443,7 +98016,7 @@ index 6dd8d5f..2482a6d 100644
97443 kmemleak_free_recursive(objp, cachep->flags); 98016 kmemleak_free_recursive(objp, cachep->flags);
97444 objp = cache_free_debugcheck(cachep, objp, caller); 98017 objp = cache_free_debugcheck(cachep, objp, caller);
97445 98018
97446@@ -3712,6 +3731,7 @@ void kfree(const void *objp) 98019@@ -3712,6 +3724,7 @@ void kfree(const void *objp)
97447 98020
97448 if (unlikely(ZERO_OR_NULL_PTR(objp))) 98021 if (unlikely(ZERO_OR_NULL_PTR(objp)))
97449 return; 98022 return;
@@ -97451,7 +98024,7 @@ index 6dd8d5f..2482a6d 100644
97451 local_irq_save(flags); 98024 local_irq_save(flags);
97452 kfree_debugcheck(objp); 98025 kfree_debugcheck(objp);
97453 c = virt_to_cache(objp); 98026 c = virt_to_cache(objp);
97454@@ -4153,14 +4173,22 @@ void slabinfo_show_stats(struct seq_file *m, struct kmem_cache *cachep) 98027@@ -4153,14 +4166,22 @@ void slabinfo_show_stats(struct seq_file *m, struct kmem_cache *cachep)
97455 } 98028 }
97456 /* cpu stats */ 98029 /* cpu stats */
97457 { 98030 {
@@ -97478,7 +98051,7 @@ index 6dd8d5f..2482a6d 100644
97478 #endif 98051 #endif
97479 } 98052 }
97480 98053
97481@@ -4381,13 +4409,69 @@ static const struct file_operations proc_slabstats_operations = { 98054@@ -4381,13 +4402,69 @@ static const struct file_operations proc_slabstats_operations = {
97482 static int __init slab_proc_init(void) 98055 static int __init slab_proc_init(void)
97483 { 98056 {
97484 #ifdef CONFIG_DEBUG_SLAB_LEAK 98057 #ifdef CONFIG_DEBUG_SLAB_LEAK
@@ -105460,11 +106033,11 @@ index 078fe1d..fbdb363 100644
105460 fprintf(stderr, "fixdep: sizeof(int) != 4 or wrong endianness? %#x\n", 106033 fprintf(stderr, "fixdep: sizeof(int) != 4 or wrong endianness? %#x\n",
105461diff --git a/scripts/gcc-plugin.sh b/scripts/gcc-plugin.sh 106034diff --git a/scripts/gcc-plugin.sh b/scripts/gcc-plugin.sh
105462new file mode 100644 106035new file mode 100644
105463index 0000000..3fd3699 106036index 0000000..42018ed
105464--- /dev/null 106037--- /dev/null
105465+++ b/scripts/gcc-plugin.sh 106038+++ b/scripts/gcc-plugin.sh
105466@@ -0,0 +1,43 @@ 106039@@ -0,0 +1,51 @@
105467+#!/bin/bash 106040+#!/bin/sh
105468+srctree=$(dirname "$0") 106041+srctree=$(dirname "$0")
105469+gccplugins_dir=$($3 -print-file-name=plugin) 106042+gccplugins_dir=$($3 -print-file-name=plugin)
105470+plugincc=$($1 -E - -o /dev/null -I${srctree}/../tools/gcc -I${gccplugins_dir}/include 2>&1 <<EOF 106043+plugincc=$($1 -E - -o /dev/null -I${srctree}/../tools/gcc -I${gccplugins_dir}/include 2>&1 <<EOF
@@ -105482,15 +106055,23 @@ index 0000000..3fd3699
105482+ exit 1 106055+ exit 1
105483+fi 106056+fi
105484+ 106057+
105485+if [[ "$plugincc" =~ "$1 CC" ]] 106058+case "$plugincc" in
105486+then 106059+ *"$1 CC"*)
105487+ echo "$1" 106060+ echo "$1"
105488+ exit 0 106061+ exit 0
105489+fi 106062+ ;;
105490+ 106063+
105491+if [[ "$plugincc" =~ "$2 CXX" ]] 106064+ *"$2 CXX"*)
105492+then 106065+ # the c++ compiler needs another test, see below
105493+plugincc=$($1 -c -x c++ -std=gnu++98 - -o /dev/null -I${srctree}/../tools/gcc -I${gccplugins_dir}/include 2>&1 <<EOF 106066+ ;;
106067+
106068+ *)
106069+ exit 1
106070+ ;;
106071+esac
106072+
106073+# we need a c++ compiler that supports the designated initializer GNU extension
106074+plugincc=$($2 -c -x c++ -std=gnu++98 - -fsyntax-only -I${srctree}/../tools/gcc -I${gccplugins_dir}/include 2>&1 <<EOF
105494+#include "gcc-common.h" 106075+#include "gcc-common.h"
105495+class test { 106076+class test {
105496+public: 106077+public:
@@ -105500,12 +106081,12 @@ index 0000000..3fd3699
105500+}; 106081+};
105501+EOF 106082+EOF
105502+) 106083+)
106084+
105503+if [ $? -eq 0 ] 106085+if [ $? -eq 0 ]
105504+then 106086+then
105505+ echo "$2" 106087+ echo "$2"
105506+ exit 0 106088+ exit 0
105507+fi 106089+fi
105508+fi
105509+exit 1 106090+exit 1
105510diff --git a/scripts/headers_install.sh b/scripts/headers_install.sh 106091diff --git a/scripts/headers_install.sh b/scripts/headers_install.sh
105511index 5de5660..d3deb89 100644 106092index 5de5660..d3deb89 100644