1 |
commit: 7c507ca307d96e6f5579fed163cef71daf619ee6 |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Jan 10 11:48:24 2018 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Jan 10 11:48:24 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=7c507ca3 |
7 |
|
8 |
Linux patch 4.4.111 |
9 |
|
10 |
0000_README | 4 + |
11 |
1110_linux-4.4.111.patch | 772 +++++++++++++++++++++++++++++++++++++++++++++++ |
12 |
2 files changed, 776 insertions(+) |
13 |
|
14 |
diff --git a/0000_README b/0000_README |
15 |
index 6cc6c43..4dafbf3 100644 |
16 |
--- a/0000_README |
17 |
+++ b/0000_README |
18 |
@@ -483,6 +483,10 @@ Patch: 1109_linux-4.4.110.patch |
19 |
From: http://www.kernel.org |
20 |
Desc: Linux 4.4.110 |
21 |
|
22 |
+Patch: 1110_linux-4.4.111.patch |
23 |
+From: http://www.kernel.org |
24 |
+Desc: Linux 4.4.111 |
25 |
+ |
26 |
Patch: 1500_XATTR_USER_PREFIX.patch |
27 |
From: https://bugs.gentoo.org/show_bug.cgi?id=470644 |
28 |
Desc: Support for namespace user.pax.* on tmpfs. |
29 |
|
30 |
diff --git a/1110_linux-4.4.111.patch b/1110_linux-4.4.111.patch |
31 |
new file mode 100644 |
32 |
index 0000000..66b7f8e |
33 |
--- /dev/null |
34 |
+++ b/1110_linux-4.4.111.patch |
35 |
@@ -0,0 +1,772 @@ |
36 |
+diff --git a/Makefile b/Makefile |
37 |
+index b028c106535b..4779517d9bf0 100644 |
38 |
+--- a/Makefile |
39 |
++++ b/Makefile |
40 |
+@@ -1,6 +1,6 @@ |
41 |
+ VERSION = 4 |
42 |
+ PATCHLEVEL = 4 |
43 |
+-SUBLEVEL = 110 |
44 |
++SUBLEVEL = 111 |
45 |
+ EXTRAVERSION = |
46 |
+ NAME = Blurry Fish Butt |
47 |
+ |
48 |
+diff --git a/arch/arc/include/asm/uaccess.h b/arch/arc/include/asm/uaccess.h |
49 |
+index d4d8df706efa..57387b567f34 100644 |
50 |
+--- a/arch/arc/include/asm/uaccess.h |
51 |
++++ b/arch/arc/include/asm/uaccess.h |
52 |
+@@ -673,6 +673,7 @@ __arc_strncpy_from_user(char *dst, const char __user *src, long count) |
53 |
+ return 0; |
54 |
+ |
55 |
+ __asm__ __volatile__( |
56 |
++ " mov lp_count, %5 \n" |
57 |
+ " lp 3f \n" |
58 |
+ "1: ldb.ab %3, [%2, 1] \n" |
59 |
+ " breq.d %3, 0, 3f \n" |
60 |
+@@ -689,8 +690,8 @@ __arc_strncpy_from_user(char *dst, const char __user *src, long count) |
61 |
+ " .word 1b, 4b \n" |
62 |
+ " .previous \n" |
63 |
+ : "+r"(res), "+r"(dst), "+r"(src), "=r"(val) |
64 |
+- : "g"(-EFAULT), "l"(count) |
65 |
+- : "memory"); |
66 |
++ : "g"(-EFAULT), "r"(count) |
67 |
++ : "lp_count", "lp_start", "lp_end", "memory"); |
68 |
+ |
69 |
+ return res; |
70 |
+ } |
71 |
+diff --git a/arch/parisc/include/asm/ldcw.h b/arch/parisc/include/asm/ldcw.h |
72 |
+index 8121aa6db2ff..51bb6b8eade6 100644 |
73 |
+--- a/arch/parisc/include/asm/ldcw.h |
74 |
++++ b/arch/parisc/include/asm/ldcw.h |
75 |
+@@ -11,6 +11,7 @@ |
76 |
+ for the semaphore. */ |
77 |
+ |
78 |
+ #define __PA_LDCW_ALIGNMENT 16 |
79 |
++#define __PA_LDCW_ALIGN_ORDER 4 |
80 |
+ #define __ldcw_align(a) ({ \ |
81 |
+ unsigned long __ret = (unsigned long) &(a)->lock[0]; \ |
82 |
+ __ret = (__ret + __PA_LDCW_ALIGNMENT - 1) \ |
83 |
+@@ -28,6 +29,7 @@ |
84 |
+ ldcd). */ |
85 |
+ |
86 |
+ #define __PA_LDCW_ALIGNMENT 4 |
87 |
++#define __PA_LDCW_ALIGN_ORDER 2 |
88 |
+ #define __ldcw_align(a) (&(a)->slock) |
89 |
+ #define __LDCW "ldcw,co" |
90 |
+ |
91 |
+diff --git a/arch/parisc/kernel/entry.S b/arch/parisc/kernel/entry.S |
92 |
+index 623496c11756..5dc831955de5 100644 |
93 |
+--- a/arch/parisc/kernel/entry.S |
94 |
++++ b/arch/parisc/kernel/entry.S |
95 |
+@@ -35,6 +35,7 @@ |
96 |
+ #include <asm/pgtable.h> |
97 |
+ #include <asm/signal.h> |
98 |
+ #include <asm/unistd.h> |
99 |
++#include <asm/ldcw.h> |
100 |
+ #include <asm/thread_info.h> |
101 |
+ |
102 |
+ #include <linux/linkage.h> |
103 |
+@@ -46,6 +47,14 @@ |
104 |
+ #endif |
105 |
+ |
106 |
+ .import pa_tlb_lock,data |
107 |
++ .macro load_pa_tlb_lock reg |
108 |
++#if __PA_LDCW_ALIGNMENT > 4 |
109 |
++ load32 PA(pa_tlb_lock) + __PA_LDCW_ALIGNMENT-1, \reg |
110 |
++ depi 0,31,__PA_LDCW_ALIGN_ORDER, \reg |
111 |
++#else |
112 |
++ load32 PA(pa_tlb_lock), \reg |
113 |
++#endif |
114 |
++ .endm |
115 |
+ |
116 |
+ /* space_to_prot macro creates a prot id from a space id */ |
117 |
+ |
118 |
+@@ -457,7 +466,7 @@ |
119 |
+ .macro tlb_lock spc,ptp,pte,tmp,tmp1,fault |
120 |
+ #ifdef CONFIG_SMP |
121 |
+ cmpib,COND(=),n 0,\spc,2f |
122 |
+- load32 PA(pa_tlb_lock),\tmp |
123 |
++ load_pa_tlb_lock \tmp |
124 |
+ 1: LDCW 0(\tmp),\tmp1 |
125 |
+ cmpib,COND(=) 0,\tmp1,1b |
126 |
+ nop |
127 |
+@@ -480,7 +489,7 @@ |
128 |
+ /* Release pa_tlb_lock lock. */ |
129 |
+ .macro tlb_unlock1 spc,tmp |
130 |
+ #ifdef CONFIG_SMP |
131 |
+- load32 PA(pa_tlb_lock),\tmp |
132 |
++ load_pa_tlb_lock \tmp |
133 |
+ tlb_unlock0 \spc,\tmp |
134 |
+ #endif |
135 |
+ .endm |
136 |
+diff --git a/arch/parisc/kernel/pacache.S b/arch/parisc/kernel/pacache.S |
137 |
+index a4761b772406..16073f472118 100644 |
138 |
+--- a/arch/parisc/kernel/pacache.S |
139 |
++++ b/arch/parisc/kernel/pacache.S |
140 |
+@@ -36,6 +36,7 @@ |
141 |
+ #include <asm/assembly.h> |
142 |
+ #include <asm/pgtable.h> |
143 |
+ #include <asm/cache.h> |
144 |
++#include <asm/ldcw.h> |
145 |
+ #include <linux/linkage.h> |
146 |
+ |
147 |
+ .text |
148 |
+@@ -333,8 +334,12 @@ ENDPROC(flush_data_cache_local) |
149 |
+ |
150 |
+ .macro tlb_lock la,flags,tmp |
151 |
+ #ifdef CONFIG_SMP |
152 |
+- ldil L%pa_tlb_lock,%r1 |
153 |
+- ldo R%pa_tlb_lock(%r1),\la |
154 |
++#if __PA_LDCW_ALIGNMENT > 4 |
155 |
++ load32 pa_tlb_lock + __PA_LDCW_ALIGNMENT-1, \la |
156 |
++ depi 0,31,__PA_LDCW_ALIGN_ORDER, \la |
157 |
++#else |
158 |
++ load32 pa_tlb_lock, \la |
159 |
++#endif |
160 |
+ rsm PSW_SM_I,\flags |
161 |
+ 1: LDCW 0(\la),\tmp |
162 |
+ cmpib,<>,n 0,\tmp,3f |
163 |
+diff --git a/arch/s390/kernel/compat_linux.c b/arch/s390/kernel/compat_linux.c |
164 |
+index 437e61159279..0176ebc97bfd 100644 |
165 |
+--- a/arch/s390/kernel/compat_linux.c |
166 |
++++ b/arch/s390/kernel/compat_linux.c |
167 |
+@@ -263,6 +263,7 @@ COMPAT_SYSCALL_DEFINE2(s390_setgroups16, int, gidsetsize, u16 __user *, grouplis |
168 |
+ return retval; |
169 |
+ } |
170 |
+ |
171 |
++ groups_sort(group_info); |
172 |
+ retval = set_current_groups(group_info); |
173 |
+ put_group_info(group_info); |
174 |
+ |
175 |
+diff --git a/arch/x86/entry/vdso/vma.c b/arch/x86/entry/vdso/vma.c |
176 |
+index aa828191c654..b8f69e264ac4 100644 |
177 |
+--- a/arch/x86/entry/vdso/vma.c |
178 |
++++ b/arch/x86/entry/vdso/vma.c |
179 |
+@@ -12,6 +12,7 @@ |
180 |
+ #include <linux/random.h> |
181 |
+ #include <linux/elf.h> |
182 |
+ #include <linux/cpu.h> |
183 |
++#include <asm/pvclock.h> |
184 |
+ #include <asm/vgtod.h> |
185 |
+ #include <asm/proto.h> |
186 |
+ #include <asm/vdso.h> |
187 |
+diff --git a/arch/x86/entry/vsyscall/vsyscall_64.c b/arch/x86/entry/vsyscall/vsyscall_64.c |
188 |
+index 174c2549939d..112178b401a1 100644 |
189 |
+--- a/arch/x86/entry/vsyscall/vsyscall_64.c |
190 |
++++ b/arch/x86/entry/vsyscall/vsyscall_64.c |
191 |
+@@ -66,6 +66,11 @@ static int __init vsyscall_setup(char *str) |
192 |
+ } |
193 |
+ early_param("vsyscall", vsyscall_setup); |
194 |
+ |
195 |
++bool vsyscall_enabled(void) |
196 |
++{ |
197 |
++ return vsyscall_mode != NONE; |
198 |
++} |
199 |
++ |
200 |
+ static void warn_bad_vsyscall(const char *level, struct pt_regs *regs, |
201 |
+ const char *message) |
202 |
+ { |
203 |
+diff --git a/arch/x86/include/asm/vsyscall.h b/arch/x86/include/asm/vsyscall.h |
204 |
+index 6ba66ee79710..4865e10dbb55 100644 |
205 |
+--- a/arch/x86/include/asm/vsyscall.h |
206 |
++++ b/arch/x86/include/asm/vsyscall.h |
207 |
+@@ -12,12 +12,14 @@ extern void map_vsyscall(void); |
208 |
+ * Returns true if handled. |
209 |
+ */ |
210 |
+ extern bool emulate_vsyscall(struct pt_regs *regs, unsigned long address); |
211 |
++extern bool vsyscall_enabled(void); |
212 |
+ #else |
213 |
+ static inline void map_vsyscall(void) {} |
214 |
+ static inline bool emulate_vsyscall(struct pt_regs *regs, unsigned long address) |
215 |
+ { |
216 |
+ return false; |
217 |
+ } |
218 |
++static inline bool vsyscall_enabled(void) { return false; } |
219 |
+ #endif |
220 |
+ |
221 |
+ #endif /* _ASM_X86_VSYSCALL_H */ |
222 |
+diff --git a/arch/x86/kernel/cpu/microcode/amd.c b/arch/x86/kernel/cpu/microcode/amd.c |
223 |
+index 2233f8a76615..2a0f44d225fe 100644 |
224 |
+--- a/arch/x86/kernel/cpu/microcode/amd.c |
225 |
++++ b/arch/x86/kernel/cpu/microcode/amd.c |
226 |
+@@ -580,6 +580,7 @@ static unsigned int verify_patch_size(u8 family, u32 patch_size, |
227 |
+ #define F14H_MPB_MAX_SIZE 1824 |
228 |
+ #define F15H_MPB_MAX_SIZE 4096 |
229 |
+ #define F16H_MPB_MAX_SIZE 3458 |
230 |
++#define F17H_MPB_MAX_SIZE 3200 |
231 |
+ |
232 |
+ switch (family) { |
233 |
+ case 0x14: |
234 |
+@@ -591,6 +592,9 @@ static unsigned int verify_patch_size(u8 family, u32 patch_size, |
235 |
+ case 0x16: |
236 |
+ max_size = F16H_MPB_MAX_SIZE; |
237 |
+ break; |
238 |
++ case 0x17: |
239 |
++ max_size = F17H_MPB_MAX_SIZE; |
240 |
++ break; |
241 |
+ default: |
242 |
+ max_size = F1XH_MPB_MAX_SIZE; |
243 |
+ break; |
244 |
+diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c |
245 |
+index 2bd45ae91eb3..151fd33e9043 100644 |
246 |
+--- a/arch/x86/mm/init.c |
247 |
++++ b/arch/x86/mm/init.c |
248 |
+@@ -757,7 +757,7 @@ DEFINE_PER_CPU_SHARED_ALIGNED(struct tlb_state, cpu_tlbstate) = { |
249 |
+ .state = 0, |
250 |
+ .cr4 = ~0UL, /* fail hard if we screw up cr4 shadow initialization */ |
251 |
+ }; |
252 |
+-EXPORT_SYMBOL_GPL(cpu_tlbstate); |
253 |
++EXPORT_PER_CPU_SYMBOL(cpu_tlbstate); |
254 |
+ |
255 |
+ void update_cache_mode_entry(unsigned entry, enum page_cache_mode cache) |
256 |
+ { |
257 |
+diff --git a/arch/x86/mm/kaiser.c b/arch/x86/mm/kaiser.c |
258 |
+index b0b3a69f1c7f..6a7a77929a8c 100644 |
259 |
+--- a/arch/x86/mm/kaiser.c |
260 |
++++ b/arch/x86/mm/kaiser.c |
261 |
+@@ -20,6 +20,7 @@ |
262 |
+ #include <asm/pgalloc.h> |
263 |
+ #include <asm/desc.h> |
264 |
+ #include <asm/cmdline.h> |
265 |
++#include <asm/vsyscall.h> |
266 |
+ |
267 |
+ int kaiser_enabled __read_mostly = 1; |
268 |
+ EXPORT_SYMBOL(kaiser_enabled); /* for inlined TLB flush functions */ |
269 |
+@@ -111,12 +112,13 @@ static inline unsigned long get_pa_from_mapping(unsigned long vaddr) |
270 |
+ * |
271 |
+ * Returns a pointer to a PTE on success, or NULL on failure. |
272 |
+ */ |
273 |
+-static pte_t *kaiser_pagetable_walk(unsigned long address) |
274 |
++static pte_t *kaiser_pagetable_walk(unsigned long address, bool user) |
275 |
+ { |
276 |
+ pmd_t *pmd; |
277 |
+ pud_t *pud; |
278 |
+ pgd_t *pgd = native_get_shadow_pgd(pgd_offset_k(address)); |
279 |
+ gfp_t gfp = (GFP_KERNEL | __GFP_NOTRACK | __GFP_ZERO); |
280 |
++ unsigned long prot = _KERNPG_TABLE; |
281 |
+ |
282 |
+ if (pgd_none(*pgd)) { |
283 |
+ WARN_ONCE(1, "All shadow pgds should have been populated"); |
284 |
+@@ -124,6 +126,17 @@ static pte_t *kaiser_pagetable_walk(unsigned long address) |
285 |
+ } |
286 |
+ BUILD_BUG_ON(pgd_large(*pgd) != 0); |
287 |
+ |
288 |
++ if (user) { |
289 |
++ /* |
290 |
++ * The vsyscall page is the only page that will have |
291 |
++ * _PAGE_USER set. Catch everything else. |
292 |
++ */ |
293 |
++ BUG_ON(address != VSYSCALL_ADDR); |
294 |
++ |
295 |
++ set_pgd(pgd, __pgd(pgd_val(*pgd) | _PAGE_USER)); |
296 |
++ prot = _PAGE_TABLE; |
297 |
++ } |
298 |
++ |
299 |
+ pud = pud_offset(pgd, address); |
300 |
+ /* The shadow page tables do not use large mappings: */ |
301 |
+ if (pud_large(*pud)) { |
302 |
+@@ -136,7 +149,7 @@ static pte_t *kaiser_pagetable_walk(unsigned long address) |
303 |
+ return NULL; |
304 |
+ spin_lock(&shadow_table_allocation_lock); |
305 |
+ if (pud_none(*pud)) { |
306 |
+- set_pud(pud, __pud(_KERNPG_TABLE | __pa(new_pmd_page))); |
307 |
++ set_pud(pud, __pud(prot | __pa(new_pmd_page))); |
308 |
+ __inc_zone_page_state(virt_to_page((void *) |
309 |
+ new_pmd_page), NR_KAISERTABLE); |
310 |
+ } else |
311 |
+@@ -156,7 +169,7 @@ static pte_t *kaiser_pagetable_walk(unsigned long address) |
312 |
+ return NULL; |
313 |
+ spin_lock(&shadow_table_allocation_lock); |
314 |
+ if (pmd_none(*pmd)) { |
315 |
+- set_pmd(pmd, __pmd(_KERNPG_TABLE | __pa(new_pte_page))); |
316 |
++ set_pmd(pmd, __pmd(prot | __pa(new_pte_page))); |
317 |
+ __inc_zone_page_state(virt_to_page((void *) |
318 |
+ new_pte_page), NR_KAISERTABLE); |
319 |
+ } else |
320 |
+@@ -192,7 +205,7 @@ static int kaiser_add_user_map(const void *__start_addr, unsigned long size, |
321 |
+ ret = -EIO; |
322 |
+ break; |
323 |
+ } |
324 |
+- pte = kaiser_pagetable_walk(address); |
325 |
++ pte = kaiser_pagetable_walk(address, flags & _PAGE_USER); |
326 |
+ if (!pte) { |
327 |
+ ret = -ENOMEM; |
328 |
+ break; |
329 |
+@@ -319,6 +332,19 @@ void __init kaiser_init(void) |
330 |
+ |
331 |
+ kaiser_init_all_pgds(); |
332 |
+ |
333 |
++ /* |
334 |
++ * Note that this sets _PAGE_USER and it needs to happen when the |
335 |
++ * pagetable hierarchy gets created, i.e., early. Otherwise |
336 |
++ * kaiser_pagetable_walk() will encounter initialized PTEs in the |
337 |
++ * hierarchy and not set the proper permissions, leading to the |
338 |
++ * pagefaults with page-protection violations when trying to read the |
339 |
++ * vsyscall page. For example. |
340 |
++ */ |
341 |
++ if (vsyscall_enabled()) |
342 |
++ kaiser_add_user_map_early((void *)VSYSCALL_ADDR, |
343 |
++ PAGE_SIZE, |
344 |
++ __PAGE_KERNEL_VSYSCALL); |
345 |
++ |
346 |
+ for_each_possible_cpu(cpu) { |
347 |
+ void *percpu_vaddr = __per_cpu_user_mapped_start + |
348 |
+ per_cpu_offset(cpu); |
349 |
+diff --git a/arch/x86/mm/kasan_init_64.c b/arch/x86/mm/kasan_init_64.c |
350 |
+index 81ec7c02f968..fdfa25c83119 100644 |
351 |
+--- a/arch/x86/mm/kasan_init_64.c |
352 |
++++ b/arch/x86/mm/kasan_init_64.c |
353 |
+@@ -126,10 +126,16 @@ void __init kasan_init(void) |
354 |
+ |
355 |
+ /* |
356 |
+ * kasan_zero_page has been used as early shadow memory, thus it may |
357 |
+- * contain some garbage. Now we can clear it, since after the TLB flush |
358 |
+- * no one should write to it. |
359 |
++ * contain some garbage. Now we can clear and write protect it, since |
360 |
++ * after the TLB flush no one should write to it. |
361 |
+ */ |
362 |
+ memset(kasan_zero_page, 0, PAGE_SIZE); |
363 |
++ for (i = 0; i < PTRS_PER_PTE; i++) { |
364 |
++ pte_t pte = __pte(__pa(kasan_zero_page) | __PAGE_KERNEL_RO); |
365 |
++ set_pte(&kasan_zero_pte[i], pte); |
366 |
++ } |
367 |
++ /* Flush TLBs again to be sure that write protection applied. */ |
368 |
++ __flush_tlb_all(); |
369 |
+ |
370 |
+ init_task.kasan_depth = 0; |
371 |
+ pr_info("KernelAddressSanitizer initialized\n"); |
372 |
+diff --git a/crypto/chacha20poly1305.c b/crypto/chacha20poly1305.c |
373 |
+index 99c3cce01290..0214600ba071 100644 |
374 |
+--- a/crypto/chacha20poly1305.c |
375 |
++++ b/crypto/chacha20poly1305.c |
376 |
+@@ -600,6 +600,11 @@ static int chachapoly_create(struct crypto_template *tmpl, struct rtattr **tb, |
377 |
+ CRYPTO_ALG_TYPE_AHASH_MASK); |
378 |
+ if (IS_ERR(poly)) |
379 |
+ return PTR_ERR(poly); |
380 |
++ poly_hash = __crypto_hash_alg_common(poly); |
381 |
++ |
382 |
++ err = -EINVAL; |
383 |
++ if (poly_hash->digestsize != POLY1305_DIGEST_SIZE) |
384 |
++ goto out_put_poly; |
385 |
+ |
386 |
+ err = -ENOMEM; |
387 |
+ inst = kzalloc(sizeof(*inst) + sizeof(*ctx), GFP_KERNEL); |
388 |
+@@ -608,7 +613,6 @@ static int chachapoly_create(struct crypto_template *tmpl, struct rtattr **tb, |
389 |
+ |
390 |
+ ctx = aead_instance_ctx(inst); |
391 |
+ ctx->saltlen = CHACHAPOLY_IV_SIZE - ivsize; |
392 |
+- poly_hash = __crypto_hash_alg_common(poly); |
393 |
+ err = crypto_init_ahash_spawn(&ctx->poly, poly_hash, |
394 |
+ aead_crypto_instance(inst)); |
395 |
+ if (err) |
396 |
+diff --git a/crypto/pcrypt.c b/crypto/pcrypt.c |
397 |
+index ee9cfb99fe25..f8ec3d4ba4a8 100644 |
398 |
+--- a/crypto/pcrypt.c |
399 |
++++ b/crypto/pcrypt.c |
400 |
+@@ -254,6 +254,14 @@ static void pcrypt_aead_exit_tfm(struct crypto_aead *tfm) |
401 |
+ crypto_free_aead(ctx->child); |
402 |
+ } |
403 |
+ |
404 |
++static void pcrypt_free(struct aead_instance *inst) |
405 |
++{ |
406 |
++ struct pcrypt_instance_ctx *ctx = aead_instance_ctx(inst); |
407 |
++ |
408 |
++ crypto_drop_aead(&ctx->spawn); |
409 |
++ kfree(inst); |
410 |
++} |
411 |
++ |
412 |
+ static int pcrypt_init_instance(struct crypto_instance *inst, |
413 |
+ struct crypto_alg *alg) |
414 |
+ { |
415 |
+@@ -319,6 +327,8 @@ static int pcrypt_create_aead(struct crypto_template *tmpl, struct rtattr **tb, |
416 |
+ inst->alg.encrypt = pcrypt_aead_encrypt; |
417 |
+ inst->alg.decrypt = pcrypt_aead_decrypt; |
418 |
+ |
419 |
++ inst->free = pcrypt_free; |
420 |
++ |
421 |
+ err = aead_register_instance(tmpl, inst); |
422 |
+ if (err) |
423 |
+ goto out_drop_aead; |
424 |
+@@ -349,14 +359,6 @@ static int pcrypt_create(struct crypto_template *tmpl, struct rtattr **tb) |
425 |
+ return -EINVAL; |
426 |
+ } |
427 |
+ |
428 |
+-static void pcrypt_free(struct crypto_instance *inst) |
429 |
+-{ |
430 |
+- struct pcrypt_instance_ctx *ctx = crypto_instance_ctx(inst); |
431 |
+- |
432 |
+- crypto_drop_aead(&ctx->spawn); |
433 |
+- kfree(inst); |
434 |
+-} |
435 |
+- |
436 |
+ static int pcrypt_cpumask_change_notify(struct notifier_block *self, |
437 |
+ unsigned long val, void *data) |
438 |
+ { |
439 |
+@@ -469,7 +471,6 @@ static void pcrypt_fini_padata(struct padata_pcrypt *pcrypt) |
440 |
+ static struct crypto_template pcrypt_tmpl = { |
441 |
+ .name = "pcrypt", |
442 |
+ .create = pcrypt_create, |
443 |
+- .free = pcrypt_free, |
444 |
+ .module = THIS_MODULE, |
445 |
+ }; |
446 |
+ |
447 |
+diff --git a/drivers/bus/sunxi-rsb.c b/drivers/bus/sunxi-rsb.c |
448 |
+index 25996e256110..0ffb247b42d6 100644 |
449 |
+--- a/drivers/bus/sunxi-rsb.c |
450 |
++++ b/drivers/bus/sunxi-rsb.c |
451 |
+@@ -178,6 +178,7 @@ static struct bus_type sunxi_rsb_bus = { |
452 |
+ .match = sunxi_rsb_device_match, |
453 |
+ .probe = sunxi_rsb_device_probe, |
454 |
+ .remove = sunxi_rsb_device_remove, |
455 |
++ .uevent = of_device_uevent_modalias, |
456 |
+ }; |
457 |
+ |
458 |
+ static void sunxi_rsb_dev_release(struct device *dev) |
459 |
+diff --git a/drivers/crypto/n2_core.c b/drivers/crypto/n2_core.c |
460 |
+index 5450880abb7b..5a9083021fa0 100644 |
461 |
+--- a/drivers/crypto/n2_core.c |
462 |
++++ b/drivers/crypto/n2_core.c |
463 |
+@@ -1641,6 +1641,7 @@ static int queue_cache_init(void) |
464 |
+ CWQ_ENTRY_SIZE, 0, NULL); |
465 |
+ if (!queue_cache[HV_NCS_QTYPE_CWQ - 1]) { |
466 |
+ kmem_cache_destroy(queue_cache[HV_NCS_QTYPE_MAU - 1]); |
467 |
++ queue_cache[HV_NCS_QTYPE_MAU - 1] = NULL; |
468 |
+ return -ENOMEM; |
469 |
+ } |
470 |
+ return 0; |
471 |
+@@ -1650,6 +1651,8 @@ static void queue_cache_destroy(void) |
472 |
+ { |
473 |
+ kmem_cache_destroy(queue_cache[HV_NCS_QTYPE_MAU - 1]); |
474 |
+ kmem_cache_destroy(queue_cache[HV_NCS_QTYPE_CWQ - 1]); |
475 |
++ queue_cache[HV_NCS_QTYPE_MAU - 1] = NULL; |
476 |
++ queue_cache[HV_NCS_QTYPE_CWQ - 1] = NULL; |
477 |
+ } |
478 |
+ |
479 |
+ static int spu_queue_register(struct spu_queue *p, unsigned long q_type) |
480 |
+diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c |
481 |
+index 6f4dc0fd2ca3..51b96e9bf793 100644 |
482 |
+--- a/drivers/input/mouse/elantech.c |
483 |
++++ b/drivers/input/mouse/elantech.c |
484 |
+@@ -1613,7 +1613,7 @@ static int elantech_set_properties(struct elantech_data *etd) |
485 |
+ case 5: |
486 |
+ etd->hw_version = 3; |
487 |
+ break; |
488 |
+- case 6 ... 14: |
489 |
++ case 6 ... 15: |
490 |
+ etd->hw_version = 4; |
491 |
+ break; |
492 |
+ default: |
493 |
+diff --git a/fs/nfsd/auth.c b/fs/nfsd/auth.c |
494 |
+index 9d46a0bdd9f9..a260060042ad 100644 |
495 |
+--- a/fs/nfsd/auth.c |
496 |
++++ b/fs/nfsd/auth.c |
497 |
+@@ -59,6 +59,9 @@ int nfsd_setuser(struct svc_rqst *rqstp, struct svc_export *exp) |
498 |
+ GROUP_AT(gi, i) = exp->ex_anon_gid; |
499 |
+ else |
500 |
+ GROUP_AT(gi, i) = GROUP_AT(rqgi, i); |
501 |
++ |
502 |
++ /* Each thread allocates its own gi, no race */ |
503 |
++ groups_sort(gi); |
504 |
+ } |
505 |
+ } else { |
506 |
+ gi = get_group_info(rqgi); |
507 |
+diff --git a/include/linux/cred.h b/include/linux/cred.h |
508 |
+index 257db64562e5..9e120c92551b 100644 |
509 |
+--- a/include/linux/cred.h |
510 |
++++ b/include/linux/cred.h |
511 |
+@@ -87,6 +87,7 @@ extern int set_current_groups(struct group_info *); |
512 |
+ extern void set_groups(struct cred *, struct group_info *); |
513 |
+ extern int groups_search(const struct group_info *, kgid_t); |
514 |
+ extern bool may_setgroups(void); |
515 |
++extern void groups_sort(struct group_info *); |
516 |
+ |
517 |
+ /* access the groups "array" with this macro */ |
518 |
+ #define GROUP_AT(gi, i) \ |
519 |
+diff --git a/include/linux/fscache.h b/include/linux/fscache.h |
520 |
+index 115bb81912cc..94a8aae8f9e2 100644 |
521 |
+--- a/include/linux/fscache.h |
522 |
++++ b/include/linux/fscache.h |
523 |
+@@ -764,7 +764,7 @@ bool fscache_maybe_release_page(struct fscache_cookie *cookie, |
524 |
+ { |
525 |
+ if (fscache_cookie_valid(cookie) && PageFsCache(page)) |
526 |
+ return __fscache_maybe_release_page(cookie, page, gfp); |
527 |
+- return false; |
528 |
++ return true; |
529 |
+ } |
530 |
+ |
531 |
+ /** |
532 |
+diff --git a/kernel/acct.c b/kernel/acct.c |
533 |
+index 74963d192c5d..37f1dc696fbd 100644 |
534 |
+--- a/kernel/acct.c |
535 |
++++ b/kernel/acct.c |
536 |
+@@ -99,7 +99,7 @@ static int check_free_space(struct bsd_acct_struct *acct) |
537 |
+ { |
538 |
+ struct kstatfs sbuf; |
539 |
+ |
540 |
+- if (time_is_before_jiffies(acct->needcheck)) |
541 |
++ if (time_is_after_jiffies(acct->needcheck)) |
542 |
+ goto out; |
543 |
+ |
544 |
+ /* May block */ |
545 |
+diff --git a/kernel/groups.c b/kernel/groups.c |
546 |
+index 74d431d25251..5ea9847f172f 100644 |
547 |
+--- a/kernel/groups.c |
548 |
++++ b/kernel/groups.c |
549 |
+@@ -101,7 +101,7 @@ static int groups_from_user(struct group_info *group_info, |
550 |
+ } |
551 |
+ |
552 |
+ /* a simple Shell sort */ |
553 |
+-static void groups_sort(struct group_info *group_info) |
554 |
++void groups_sort(struct group_info *group_info) |
555 |
+ { |
556 |
+ int base, max, stride; |
557 |
+ int gidsetsize = group_info->ngroups; |
558 |
+@@ -128,6 +128,7 @@ static void groups_sort(struct group_info *group_info) |
559 |
+ stride /= 3; |
560 |
+ } |
561 |
+ } |
562 |
++EXPORT_SYMBOL(groups_sort); |
563 |
+ |
564 |
+ /* a simple bsearch */ |
565 |
+ int groups_search(const struct group_info *group_info, kgid_t grp) |
566 |
+@@ -159,7 +160,6 @@ int groups_search(const struct group_info *group_info, kgid_t grp) |
567 |
+ void set_groups(struct cred *new, struct group_info *group_info) |
568 |
+ { |
569 |
+ put_group_info(new->group_info); |
570 |
+- groups_sort(group_info); |
571 |
+ get_group_info(group_info); |
572 |
+ new->group_info = group_info; |
573 |
+ } |
574 |
+@@ -243,6 +243,7 @@ SYSCALL_DEFINE2(setgroups, int, gidsetsize, gid_t __user *, grouplist) |
575 |
+ return retval; |
576 |
+ } |
577 |
+ |
578 |
++ groups_sort(group_info); |
579 |
+ retval = set_current_groups(group_info); |
580 |
+ put_group_info(group_info); |
581 |
+ |
582 |
+diff --git a/kernel/module.c b/kernel/module.c |
583 |
+index b14a4f31221f..0a56098d3738 100644 |
584 |
+--- a/kernel/module.c |
585 |
++++ b/kernel/module.c |
586 |
+@@ -2404,7 +2404,7 @@ static char elf_type(const Elf_Sym *sym, const struct load_info *info) |
587 |
+ } |
588 |
+ if (sym->st_shndx == SHN_UNDEF) |
589 |
+ return 'U'; |
590 |
+- if (sym->st_shndx == SHN_ABS) |
591 |
++ if (sym->st_shndx == SHN_ABS || sym->st_shndx == info->index.pcpu) |
592 |
+ return 'a'; |
593 |
+ if (sym->st_shndx >= SHN_LORESERVE) |
594 |
+ return '?'; |
595 |
+@@ -2433,7 +2433,7 @@ static char elf_type(const Elf_Sym *sym, const struct load_info *info) |
596 |
+ } |
597 |
+ |
598 |
+ static bool is_core_symbol(const Elf_Sym *src, const Elf_Shdr *sechdrs, |
599 |
+- unsigned int shnum) |
600 |
++ unsigned int shnum, unsigned int pcpundx) |
601 |
+ { |
602 |
+ const Elf_Shdr *sec; |
603 |
+ |
604 |
+@@ -2442,6 +2442,11 @@ static bool is_core_symbol(const Elf_Sym *src, const Elf_Shdr *sechdrs, |
605 |
+ || !src->st_name) |
606 |
+ return false; |
607 |
+ |
608 |
++#ifdef CONFIG_KALLSYMS_ALL |
609 |
++ if (src->st_shndx == pcpundx) |
610 |
++ return true; |
611 |
++#endif |
612 |
++ |
613 |
+ sec = sechdrs + src->st_shndx; |
614 |
+ if (!(sec->sh_flags & SHF_ALLOC) |
615 |
+ #ifndef CONFIG_KALLSYMS_ALL |
616 |
+@@ -2479,7 +2484,8 @@ static void layout_symtab(struct module *mod, struct load_info *info) |
617 |
+ /* Compute total space required for the core symbols' strtab. */ |
618 |
+ for (ndst = i = 0; i < nsrc; i++) { |
619 |
+ if (i == 0 || |
620 |
+- is_core_symbol(src+i, info->sechdrs, info->hdr->e_shnum)) { |
621 |
++ is_core_symbol(src+i, info->sechdrs, info->hdr->e_shnum, |
622 |
++ info->index.pcpu)) { |
623 |
+ strtab_size += strlen(&info->strtab[src[i].st_name])+1; |
624 |
+ ndst++; |
625 |
+ } |
626 |
+@@ -2537,7 +2543,8 @@ static void add_kallsyms(struct module *mod, const struct load_info *info) |
627 |
+ src = mod->kallsyms->symtab; |
628 |
+ for (ndst = i = 0; i < mod->kallsyms->num_symtab; i++) { |
629 |
+ if (i == 0 || |
630 |
+- is_core_symbol(src+i, info->sechdrs, info->hdr->e_shnum)) { |
631 |
++ is_core_symbol(src+i, info->sechdrs, info->hdr->e_shnum, |
632 |
++ info->index.pcpu)) { |
633 |
+ dst[ndst] = src[i]; |
634 |
+ dst[ndst++].st_name = s - mod->core_kallsyms.strtab; |
635 |
+ s += strlcpy(s, &mod->kallsyms->strtab[src[i].st_name], |
636 |
+@@ -2881,8 +2888,12 @@ static int check_modinfo(struct module *mod, struct load_info *info, int flags) |
637 |
+ return -ENOEXEC; |
638 |
+ } |
639 |
+ |
640 |
+- if (!get_modinfo(info, "intree")) |
641 |
++ if (!get_modinfo(info, "intree")) { |
642 |
++ if (!test_taint(TAINT_OOT_MODULE)) |
643 |
++ pr_warn("%s: loading out-of-tree module taints kernel.\n", |
644 |
++ mod->name); |
645 |
+ add_taint_module(mod, TAINT_OOT_MODULE, LOCKDEP_STILL_OK); |
646 |
++ } |
647 |
+ |
648 |
+ if (get_modinfo(info, "staging")) { |
649 |
+ add_taint_module(mod, TAINT_CRAP, LOCKDEP_STILL_OK); |
650 |
+@@ -3047,6 +3058,8 @@ static int move_module(struct module *mod, struct load_info *info) |
651 |
+ |
652 |
+ static int check_module_license_and_versions(struct module *mod) |
653 |
+ { |
654 |
++ int prev_taint = test_taint(TAINT_PROPRIETARY_MODULE); |
655 |
++ |
656 |
+ /* |
657 |
+ * ndiswrapper is under GPL by itself, but loads proprietary modules. |
658 |
+ * Don't use add_taint_module(), as it would prevent ndiswrapper from |
659 |
+@@ -3065,6 +3078,9 @@ static int check_module_license_and_versions(struct module *mod) |
660 |
+ add_taint_module(mod, TAINT_PROPRIETARY_MODULE, |
661 |
+ LOCKDEP_NOW_UNRELIABLE); |
662 |
+ |
663 |
++ if (!prev_taint && test_taint(TAINT_PROPRIETARY_MODULE)) |
664 |
++ pr_warn("%s: module license taints kernel.\n", mod->name); |
665 |
++ |
666 |
+ #ifdef CONFIG_MODVERSIONS |
667 |
+ if ((mod->num_syms && !mod->crcs) |
668 |
+ || (mod->num_gpl_syms && !mod->gpl_crcs) |
669 |
+diff --git a/kernel/signal.c b/kernel/signal.c |
670 |
+index 5d50ea899b6d..4a548c6a4118 100644 |
671 |
+--- a/kernel/signal.c |
672 |
++++ b/kernel/signal.c |
673 |
+@@ -72,7 +72,7 @@ static int sig_task_ignored(struct task_struct *t, int sig, bool force) |
674 |
+ handler = sig_handler(t, sig); |
675 |
+ |
676 |
+ if (unlikely(t->signal->flags & SIGNAL_UNKILLABLE) && |
677 |
+- handler == SIG_DFL && !force) |
678 |
++ handler == SIG_DFL && !(force && sig_kernel_only(sig))) |
679 |
+ return 1; |
680 |
+ |
681 |
+ return sig_handler_ignored(handler, sig); |
682 |
+@@ -88,13 +88,15 @@ static int sig_ignored(struct task_struct *t, int sig, bool force) |
683 |
+ if (sigismember(&t->blocked, sig) || sigismember(&t->real_blocked, sig)) |
684 |
+ return 0; |
685 |
+ |
686 |
+- if (!sig_task_ignored(t, sig, force)) |
687 |
+- return 0; |
688 |
+- |
689 |
+ /* |
690 |
+- * Tracers may want to know about even ignored signals. |
691 |
++ * Tracers may want to know about even ignored signal unless it |
692 |
++ * is SIGKILL which can't be reported anyway but can be ignored |
693 |
++ * by SIGNAL_UNKILLABLE task. |
694 |
+ */ |
695 |
+- return !t->ptrace; |
696 |
++ if (t->ptrace && sig != SIGKILL) |
697 |
++ return 0; |
698 |
++ |
699 |
++ return sig_task_ignored(t, sig, force); |
700 |
+ } |
701 |
+ |
702 |
+ /* |
703 |
+@@ -917,9 +919,9 @@ static void complete_signal(int sig, struct task_struct *p, int group) |
704 |
+ * then start taking the whole group down immediately. |
705 |
+ */ |
706 |
+ if (sig_fatal(p, sig) && |
707 |
+- !(signal->flags & (SIGNAL_UNKILLABLE | SIGNAL_GROUP_EXIT)) && |
708 |
++ !(signal->flags & SIGNAL_GROUP_EXIT) && |
709 |
+ !sigismember(&t->real_blocked, sig) && |
710 |
+- (sig == SIGKILL || !t->ptrace)) { |
711 |
++ (sig == SIGKILL || !p->ptrace)) { |
712 |
+ /* |
713 |
+ * This signal will be fatal to the whole group. |
714 |
+ */ |
715 |
+diff --git a/kernel/uid16.c b/kernel/uid16.c |
716 |
+index d58cc4d8f0d1..651aaa5221ec 100644 |
717 |
+--- a/kernel/uid16.c |
718 |
++++ b/kernel/uid16.c |
719 |
+@@ -190,6 +190,7 @@ SYSCALL_DEFINE2(setgroups16, int, gidsetsize, old_gid_t __user *, grouplist) |
720 |
+ return retval; |
721 |
+ } |
722 |
+ |
723 |
++ groups_sort(group_info); |
724 |
+ retval = set_current_groups(group_info); |
725 |
+ put_group_info(group_info); |
726 |
+ |
727 |
+diff --git a/mm/vmstat.c b/mm/vmstat.c |
728 |
+index 324b7e90b4c5..5712cdaae964 100644 |
729 |
+--- a/mm/vmstat.c |
730 |
++++ b/mm/vmstat.c |
731 |
+@@ -1351,7 +1351,9 @@ static int vmstat_show(struct seq_file *m, void *arg) |
732 |
+ unsigned long *l = arg; |
733 |
+ unsigned long off = l - (unsigned long *)m->private; |
734 |
+ |
735 |
+- seq_printf(m, "%s %lu\n", vmstat_text[off], *l); |
736 |
++ seq_puts(m, vmstat_text[off]); |
737 |
++ seq_put_decimal_ull(m, ' ', *l); |
738 |
++ seq_putc(m, '\n'); |
739 |
+ return 0; |
740 |
+ } |
741 |
+ |
742 |
+diff --git a/net/sunrpc/auth_gss/gss_rpc_xdr.c b/net/sunrpc/auth_gss/gss_rpc_xdr.c |
743 |
+index 2410d557ae39..89731c9023f0 100644 |
744 |
+--- a/net/sunrpc/auth_gss/gss_rpc_xdr.c |
745 |
++++ b/net/sunrpc/auth_gss/gss_rpc_xdr.c |
746 |
+@@ -231,6 +231,7 @@ static int gssx_dec_linux_creds(struct xdr_stream *xdr, |
747 |
+ goto out_free_groups; |
748 |
+ GROUP_AT(creds->cr_group_info, i) = kgid; |
749 |
+ } |
750 |
++ groups_sort(creds->cr_group_info); |
751 |
+ |
752 |
+ return 0; |
753 |
+ out_free_groups: |
754 |
+diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c |
755 |
+index 033fec307528..036bbf2b44c1 100644 |
756 |
+--- a/net/sunrpc/auth_gss/svcauth_gss.c |
757 |
++++ b/net/sunrpc/auth_gss/svcauth_gss.c |
758 |
+@@ -481,6 +481,7 @@ static int rsc_parse(struct cache_detail *cd, |
759 |
+ goto out; |
760 |
+ GROUP_AT(rsci.cred.cr_group_info, i) = kgid; |
761 |
+ } |
762 |
++ groups_sort(rsci.cred.cr_group_info); |
763 |
+ |
764 |
+ /* mech name */ |
765 |
+ len = qword_get(&mesg, buf, mlen); |
766 |
+diff --git a/net/sunrpc/svcauth_unix.c b/net/sunrpc/svcauth_unix.c |
767 |
+index 621ca7b4a155..98db1715cb17 100644 |
768 |
+--- a/net/sunrpc/svcauth_unix.c |
769 |
++++ b/net/sunrpc/svcauth_unix.c |
770 |
+@@ -520,6 +520,7 @@ static int unix_gid_parse(struct cache_detail *cd, |
771 |
+ GROUP_AT(ug.gi, i) = kgid; |
772 |
+ } |
773 |
+ |
774 |
++ groups_sort(ug.gi); |
775 |
+ ugp = unix_gid_lookup(cd, uid); |
776 |
+ if (ugp) { |
777 |
+ struct cache_head *ch; |
778 |
+@@ -827,6 +828,7 @@ svcauth_unix_accept(struct svc_rqst *rqstp, __be32 *authp) |
779 |
+ kgid_t kgid = make_kgid(&init_user_ns, svc_getnl(argv)); |
780 |
+ GROUP_AT(cred->cr_group_info, i) = kgid; |
781 |
+ } |
782 |
++ groups_sort(cred->cr_group_info); |
783 |
+ if (svc_getu32(argv) != htonl(RPC_AUTH_NULL) || svc_getu32(argv) != 0) { |
784 |
+ *authp = rpc_autherr_badverf; |
785 |
+ return SVC_DENIED; |
786 |
+diff --git a/scripts/genksyms/genksyms.c b/scripts/genksyms/genksyms.c |
787 |
+index 88632df4381b..dafaf96e0a34 100644 |
788 |
+--- a/scripts/genksyms/genksyms.c |
789 |
++++ b/scripts/genksyms/genksyms.c |
790 |
+@@ -423,13 +423,15 @@ static struct string_list *read_node(FILE *f) |
791 |
+ struct string_list node = { |
792 |
+ .string = buffer, |
793 |
+ .tag = SYM_NORMAL }; |
794 |
+- int c; |
795 |
++ int c, in_string = 0; |
796 |
+ |
797 |
+ while ((c = fgetc(f)) != EOF) { |
798 |
+- if (c == ' ') { |
799 |
++ if (!in_string && c == ' ') { |
800 |
+ if (node.string == buffer) |
801 |
+ continue; |
802 |
+ break; |
803 |
++ } else if (c == '"') { |
804 |
++ in_string = !in_string; |
805 |
+ } else if (c == '\n') { |
806 |
+ if (node.string == buffer) |
807 |
+ return NULL; |