Magellan Linux

Annotation of /trunk/kernel-magellan/patches-4.17/0106-4.17.7-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3157 - (hide annotations) (download)
Tue Jul 31 06:31:39 2018 UTC (5 years, 10 months ago) by niro
File size: 122134 byte(s)
-linux-4.16.7
1 niro 3157 diff --git a/Documentation/kbuild/kbuild.txt b/Documentation/kbuild/kbuild.txt
2     index 6c9c69ec3986..0fa16b461256 100644
3     --- a/Documentation/kbuild/kbuild.txt
4     +++ b/Documentation/kbuild/kbuild.txt
5     @@ -148,15 +148,6 @@ stripped after they are installed. If INSTALL_MOD_STRIP is '1', then
6     the default option --strip-debug will be used. Otherwise,
7     INSTALL_MOD_STRIP value will be used as the options to the strip command.
8    
9     -INSTALL_FW_PATH
10     ---------------------------------------------------
11     -INSTALL_FW_PATH specifies where to install the firmware blobs.
12     -The default value is:
13     -
14     - $(INSTALL_MOD_PATH)/lib/firmware
15     -
16     -The value can be overridden in which case the default value is ignored.
17     -
18     INSTALL_HDR_PATH
19     --------------------------------------------------
20     INSTALL_HDR_PATH specifies where to install user space headers when
21     diff --git a/Makefile b/Makefile
22     index 1a885c8f82ef..5c9f331f29c0 100644
23     --- a/Makefile
24     +++ b/Makefile
25     @@ -1,7 +1,7 @@
26     # SPDX-License-Identifier: GPL-2.0
27     VERSION = 4
28     PATCHLEVEL = 17
29     -SUBLEVEL = 6
30     +SUBLEVEL = 7
31     EXTRAVERSION =
32     NAME = Merciless Moray
33    
34     diff --git a/arch/arm/boot/dts/armada-38x.dtsi b/arch/arm/boot/dts/armada-38x.dtsi
35     index 4cc09e43eea2..e8309ecc32b9 100644
36     --- a/arch/arm/boot/dts/armada-38x.dtsi
37     +++ b/arch/arm/boot/dts/armada-38x.dtsi
38     @@ -547,7 +547,7 @@
39    
40     thermal: thermal@e8078 {
41     compatible = "marvell,armada380-thermal";
42     - reg = <0xe4078 0x4>, <0xe4074 0x4>;
43     + reg = <0xe4078 0x4>, <0xe4070 0x8>;
44     status = "okay";
45     };
46    
47     diff --git a/arch/arm64/include/asm/simd.h b/arch/arm64/include/asm/simd.h
48     index fa8b3fe932e6..6495cc51246f 100644
49     --- a/arch/arm64/include/asm/simd.h
50     +++ b/arch/arm64/include/asm/simd.h
51     @@ -29,20 +29,15 @@ DECLARE_PER_CPU(bool, kernel_neon_busy);
52     static __must_check inline bool may_use_simd(void)
53     {
54     /*
55     - * The raw_cpu_read() is racy if called with preemption enabled.
56     - * This is not a bug: kernel_neon_busy is only set when
57     - * preemption is disabled, so we cannot migrate to another CPU
58     - * while it is set, nor can we migrate to a CPU where it is set.
59     - * So, if we find it clear on some CPU then we're guaranteed to
60     - * find it clear on any CPU we could migrate to.
61     - *
62     - * If we are in between kernel_neon_begin()...kernel_neon_end(),
63     - * the flag will be set, but preemption is also disabled, so we
64     - * can't migrate to another CPU and spuriously see it become
65     - * false.
66     + * kernel_neon_busy is only set while preemption is disabled,
67     + * and is clear whenever preemption is enabled. Since
68     + * this_cpu_read() is atomic w.r.t. preemption, kernel_neon_busy
69     + * cannot change under our feet -- if it's set we cannot be
70     + * migrated, and if it's clear we cannot be migrated to a CPU
71     + * where it is set.
72     */
73     return !in_irq() && !irqs_disabled() && !in_nmi() &&
74     - !raw_cpu_read(kernel_neon_busy);
75     + !this_cpu_read(kernel_neon_busy);
76     }
77    
78     #else /* ! CONFIG_KERNEL_MODE_NEON */
79     diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c
80     index 3775a8d694fb..d4c59d9dca5b 100644
81     --- a/arch/mips/kernel/process.c
82     +++ b/arch/mips/kernel/process.c
83     @@ -29,6 +29,7 @@
84     #include <linux/kallsyms.h>
85     #include <linux/random.h>
86     #include <linux/prctl.h>
87     +#include <linux/nmi.h>
88    
89     #include <asm/asm.h>
90     #include <asm/bootinfo.h>
91     @@ -655,28 +656,42 @@ unsigned long arch_align_stack(unsigned long sp)
92     return sp & ALMASK;
93     }
94    
95     -static void arch_dump_stack(void *info)
96     +static DEFINE_PER_CPU(call_single_data_t, backtrace_csd);
97     +static struct cpumask backtrace_csd_busy;
98     +
99     +static void handle_backtrace(void *info)
100     {
101     - struct pt_regs *regs;
102     + nmi_cpu_backtrace(get_irq_regs());
103     + cpumask_clear_cpu(smp_processor_id(), &backtrace_csd_busy);
104     +}
105    
106     - regs = get_irq_regs();
107     +static void raise_backtrace(cpumask_t *mask)
108     +{
109     + call_single_data_t *csd;
110     + int cpu;
111    
112     - if (regs)
113     - show_regs(regs);
114     + for_each_cpu(cpu, mask) {
115     + /*
116     + * If we previously sent an IPI to the target CPU & it hasn't
117     + * cleared its bit in the busy cpumask then it didn't handle
118     + * our previous IPI & it's not safe for us to reuse the
119     + * call_single_data_t.
120     + */
121     + if (cpumask_test_and_set_cpu(cpu, &backtrace_csd_busy)) {
122     + pr_warn("Unable to send backtrace IPI to CPU%u - perhaps it hung?\n",
123     + cpu);
124     + continue;
125     + }
126    
127     - dump_stack();
128     + csd = &per_cpu(backtrace_csd, cpu);
129     + csd->func = handle_backtrace;
130     + smp_call_function_single_async(cpu, csd);
131     + }
132     }
133    
134     void arch_trigger_cpumask_backtrace(const cpumask_t *mask, bool exclude_self)
135     {
136     - long this_cpu = get_cpu();
137     -
138     - if (cpumask_test_cpu(this_cpu, mask) && !exclude_self)
139     - dump_stack();
140     -
141     - smp_call_function_many(mask, arch_dump_stack, NULL, 1);
142     -
143     - put_cpu();
144     + nmi_trigger_cpumask_backtrace(mask, exclude_self, raise_backtrace);
145     }
146    
147     int mips_get_process_fp_mode(struct task_struct *task)
148     diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
149     index 967e9e4e795e..a91777630045 100644
150     --- a/arch/mips/kernel/traps.c
151     +++ b/arch/mips/kernel/traps.c
152     @@ -351,6 +351,7 @@ static void __show_regs(const struct pt_regs *regs)
153     void show_regs(struct pt_regs *regs)
154     {
155     __show_regs((struct pt_regs *)regs);
156     + dump_stack();
157     }
158    
159     void show_registers(struct pt_regs *regs)
160     diff --git a/arch/mips/mm/ioremap.c b/arch/mips/mm/ioremap.c
161     index 1986e09fb457..1601d90b087b 100644
162     --- a/arch/mips/mm/ioremap.c
163     +++ b/arch/mips/mm/ioremap.c
164     @@ -9,6 +9,7 @@
165     #include <linux/export.h>
166     #include <asm/addrspace.h>
167     #include <asm/byteorder.h>
168     +#include <linux/ioport.h>
169     #include <linux/sched.h>
170     #include <linux/slab.h>
171     #include <linux/vmalloc.h>
172     @@ -98,6 +99,20 @@ static int remap_area_pages(unsigned long address, phys_addr_t phys_addr,
173     return error;
174     }
175    
176     +static int __ioremap_check_ram(unsigned long start_pfn, unsigned long nr_pages,
177     + void *arg)
178     +{
179     + unsigned long i;
180     +
181     + for (i = 0; i < nr_pages; i++) {
182     + if (pfn_valid(start_pfn + i) &&
183     + !PageReserved(pfn_to_page(start_pfn + i)))
184     + return 1;
185     + }
186     +
187     + return 0;
188     +}
189     +
190     /*
191     * Generic mapping function (not visible outside):
192     */
193     @@ -116,8 +131,8 @@ static int remap_area_pages(unsigned long address, phys_addr_t phys_addr,
194    
195     void __iomem * __ioremap(phys_addr_t phys_addr, phys_addr_t size, unsigned long flags)
196     {
197     + unsigned long offset, pfn, last_pfn;
198     struct vm_struct * area;
199     - unsigned long offset;
200     phys_addr_t last_addr;
201     void * addr;
202    
203     @@ -137,18 +152,16 @@ void __iomem * __ioremap(phys_addr_t phys_addr, phys_addr_t size, unsigned long
204     return (void __iomem *) CKSEG1ADDR(phys_addr);
205    
206     /*
207     - * Don't allow anybody to remap normal RAM that we're using..
208     + * Don't allow anybody to remap RAM that may be allocated by the page
209     + * allocator, since that could lead to races & data clobbering.
210     */
211     - if (phys_addr < virt_to_phys(high_memory)) {
212     - char *t_addr, *t_end;
213     - struct page *page;
214     -
215     - t_addr = __va(phys_addr);
216     - t_end = t_addr + (size - 1);
217     -
218     - for(page = virt_to_page(t_addr); page <= virt_to_page(t_end); page++)
219     - if(!PageReserved(page))
220     - return NULL;
221     + pfn = PFN_DOWN(phys_addr);
222     + last_pfn = PFN_DOWN(last_addr);
223     + if (walk_system_ram_range(pfn, last_pfn - pfn + 1, NULL,
224     + __ioremap_check_ram) == 1) {
225     + WARN_ONCE(1, "ioremap on RAM at %pa - %pa\n",
226     + &phys_addr, &last_addr);
227     + return NULL;
228     }
229    
230     /*
231     diff --git a/arch/x86/crypto/Makefile b/arch/x86/crypto/Makefile
232     index 5f07333bb224..9c903a420cda 100644
233     --- a/arch/x86/crypto/Makefile
234     +++ b/arch/x86/crypto/Makefile
235     @@ -15,7 +15,6 @@ obj-$(CONFIG_CRYPTO_GLUE_HELPER_X86) += glue_helper.o
236    
237     obj-$(CONFIG_CRYPTO_AES_586) += aes-i586.o
238     obj-$(CONFIG_CRYPTO_TWOFISH_586) += twofish-i586.o
239     -obj-$(CONFIG_CRYPTO_SALSA20_586) += salsa20-i586.o
240     obj-$(CONFIG_CRYPTO_SERPENT_SSE2_586) += serpent-sse2-i586.o
241    
242     obj-$(CONFIG_CRYPTO_AES_X86_64) += aes-x86_64.o
243     @@ -24,7 +23,6 @@ obj-$(CONFIG_CRYPTO_CAMELLIA_X86_64) += camellia-x86_64.o
244     obj-$(CONFIG_CRYPTO_BLOWFISH_X86_64) += blowfish-x86_64.o
245     obj-$(CONFIG_CRYPTO_TWOFISH_X86_64) += twofish-x86_64.o
246     obj-$(CONFIG_CRYPTO_TWOFISH_X86_64_3WAY) += twofish-x86_64-3way.o
247     -obj-$(CONFIG_CRYPTO_SALSA20_X86_64) += salsa20-x86_64.o
248     obj-$(CONFIG_CRYPTO_CHACHA20_X86_64) += chacha20-x86_64.o
249     obj-$(CONFIG_CRYPTO_SERPENT_SSE2_X86_64) += serpent-sse2-x86_64.o
250     obj-$(CONFIG_CRYPTO_AES_NI_INTEL) += aesni-intel.o
251     @@ -59,7 +57,6 @@ endif
252    
253     aes-i586-y := aes-i586-asm_32.o aes_glue.o
254     twofish-i586-y := twofish-i586-asm_32.o twofish_glue.o
255     -salsa20-i586-y := salsa20-i586-asm_32.o salsa20_glue.o
256     serpent-sse2-i586-y := serpent-sse2-i586-asm_32.o serpent_sse2_glue.o
257    
258     aes-x86_64-y := aes-x86_64-asm_64.o aes_glue.o
259     @@ -68,7 +65,6 @@ camellia-x86_64-y := camellia-x86_64-asm_64.o camellia_glue.o
260     blowfish-x86_64-y := blowfish-x86_64-asm_64.o blowfish_glue.o
261     twofish-x86_64-y := twofish-x86_64-asm_64.o twofish_glue.o
262     twofish-x86_64-3way-y := twofish-x86_64-asm_64-3way.o twofish_glue_3way.o
263     -salsa20-x86_64-y := salsa20-x86_64-asm_64.o salsa20_glue.o
264     chacha20-x86_64-y := chacha20-ssse3-x86_64.o chacha20_glue.o
265     serpent-sse2-x86_64-y := serpent-sse2-x86_64-asm_64.o serpent_sse2_glue.o
266    
267     diff --git a/arch/x86/crypto/salsa20-i586-asm_32.S b/arch/x86/crypto/salsa20-i586-asm_32.S
268     deleted file mode 100644
269     index 6014b7b9e52a..000000000000
270     --- a/arch/x86/crypto/salsa20-i586-asm_32.S
271     +++ /dev/null
272     @@ -1,938 +0,0 @@
273     -# Derived from:
274     -# salsa20_pm.s version 20051229
275     -# D. J. Bernstein
276     -# Public domain.
277     -
278     -#include <linux/linkage.h>
279     -
280     -.text
281     -
282     -# enter salsa20_encrypt_bytes
283     -ENTRY(salsa20_encrypt_bytes)
284     - mov %esp,%eax
285     - and $31,%eax
286     - add $256,%eax
287     - sub %eax,%esp
288     - # eax_stack = eax
289     - movl %eax,80(%esp)
290     - # ebx_stack = ebx
291     - movl %ebx,84(%esp)
292     - # esi_stack = esi
293     - movl %esi,88(%esp)
294     - # edi_stack = edi
295     - movl %edi,92(%esp)
296     - # ebp_stack = ebp
297     - movl %ebp,96(%esp)
298     - # x = arg1
299     - movl 4(%esp,%eax),%edx
300     - # m = arg2
301     - movl 8(%esp,%eax),%esi
302     - # out = arg3
303     - movl 12(%esp,%eax),%edi
304     - # bytes = arg4
305     - movl 16(%esp,%eax),%ebx
306     - # bytes -= 0
307     - sub $0,%ebx
308     - # goto done if unsigned<=
309     - jbe ._done
310     -._start:
311     - # in0 = *(uint32 *) (x + 0)
312     - movl 0(%edx),%eax
313     - # in1 = *(uint32 *) (x + 4)
314     - movl 4(%edx),%ecx
315     - # in2 = *(uint32 *) (x + 8)
316     - movl 8(%edx),%ebp
317     - # j0 = in0
318     - movl %eax,164(%esp)
319     - # in3 = *(uint32 *) (x + 12)
320     - movl 12(%edx),%eax
321     - # j1 = in1
322     - movl %ecx,168(%esp)
323     - # in4 = *(uint32 *) (x + 16)
324     - movl 16(%edx),%ecx
325     - # j2 = in2
326     - movl %ebp,172(%esp)
327     - # in5 = *(uint32 *) (x + 20)
328     - movl 20(%edx),%ebp
329     - # j3 = in3
330     - movl %eax,176(%esp)
331     - # in6 = *(uint32 *) (x + 24)
332     - movl 24(%edx),%eax
333     - # j4 = in4
334     - movl %ecx,180(%esp)
335     - # in7 = *(uint32 *) (x + 28)
336     - movl 28(%edx),%ecx
337     - # j5 = in5
338     - movl %ebp,184(%esp)
339     - # in8 = *(uint32 *) (x + 32)
340     - movl 32(%edx),%ebp
341     - # j6 = in6
342     - movl %eax,188(%esp)
343     - # in9 = *(uint32 *) (x + 36)
344     - movl 36(%edx),%eax
345     - # j7 = in7
346     - movl %ecx,192(%esp)
347     - # in10 = *(uint32 *) (x + 40)
348     - movl 40(%edx),%ecx
349     - # j8 = in8
350     - movl %ebp,196(%esp)
351     - # in11 = *(uint32 *) (x + 44)
352     - movl 44(%edx),%ebp
353     - # j9 = in9
354     - movl %eax,200(%esp)
355     - # in12 = *(uint32 *) (x + 48)
356     - movl 48(%edx),%eax
357     - # j10 = in10
358     - movl %ecx,204(%esp)
359     - # in13 = *(uint32 *) (x + 52)
360     - movl 52(%edx),%ecx
361     - # j11 = in11
362     - movl %ebp,208(%esp)
363     - # in14 = *(uint32 *) (x + 56)
364     - movl 56(%edx),%ebp
365     - # j12 = in12
366     - movl %eax,212(%esp)
367     - # in15 = *(uint32 *) (x + 60)
368     - movl 60(%edx),%eax
369     - # j13 = in13
370     - movl %ecx,216(%esp)
371     - # j14 = in14
372     - movl %ebp,220(%esp)
373     - # j15 = in15
374     - movl %eax,224(%esp)
375     - # x_backup = x
376     - movl %edx,64(%esp)
377     -._bytesatleast1:
378     - # bytes - 64
379     - cmp $64,%ebx
380     - # goto nocopy if unsigned>=
381     - jae ._nocopy
382     - # ctarget = out
383     - movl %edi,228(%esp)
384     - # out = &tmp
385     - leal 0(%esp),%edi
386     - # i = bytes
387     - mov %ebx,%ecx
388     - # while (i) { *out++ = *m++; --i }
389     - rep movsb
390     - # out = &tmp
391     - leal 0(%esp),%edi
392     - # m = &tmp
393     - leal 0(%esp),%esi
394     -._nocopy:
395     - # out_backup = out
396     - movl %edi,72(%esp)
397     - # m_backup = m
398     - movl %esi,68(%esp)
399     - # bytes_backup = bytes
400     - movl %ebx,76(%esp)
401     - # in0 = j0
402     - movl 164(%esp),%eax
403     - # in1 = j1
404     - movl 168(%esp),%ecx
405     - # in2 = j2
406     - movl 172(%esp),%edx
407     - # in3 = j3
408     - movl 176(%esp),%ebx
409     - # x0 = in0
410     - movl %eax,100(%esp)
411     - # x1 = in1
412     - movl %ecx,104(%esp)
413     - # x2 = in2
414     - movl %edx,108(%esp)
415     - # x3 = in3
416     - movl %ebx,112(%esp)
417     - # in4 = j4
418     - movl 180(%esp),%eax
419     - # in5 = j5
420     - movl 184(%esp),%ecx
421     - # in6 = j6
422     - movl 188(%esp),%edx
423     - # in7 = j7
424     - movl 192(%esp),%ebx
425     - # x4 = in4
426     - movl %eax,116(%esp)
427     - # x5 = in5
428     - movl %ecx,120(%esp)
429     - # x6 = in6
430     - movl %edx,124(%esp)
431     - # x7 = in7
432     - movl %ebx,128(%esp)
433     - # in8 = j8
434     - movl 196(%esp),%eax
435     - # in9 = j9
436     - movl 200(%esp),%ecx
437     - # in10 = j10
438     - movl 204(%esp),%edx
439     - # in11 = j11
440     - movl 208(%esp),%ebx
441     - # x8 = in8
442     - movl %eax,132(%esp)
443     - # x9 = in9
444     - movl %ecx,136(%esp)
445     - # x10 = in10
446     - movl %edx,140(%esp)
447     - # x11 = in11
448     - movl %ebx,144(%esp)
449     - # in12 = j12
450     - movl 212(%esp),%eax
451     - # in13 = j13
452     - movl 216(%esp),%ecx
453     - # in14 = j14
454     - movl 220(%esp),%edx
455     - # in15 = j15
456     - movl 224(%esp),%ebx
457     - # x12 = in12
458     - movl %eax,148(%esp)
459     - # x13 = in13
460     - movl %ecx,152(%esp)
461     - # x14 = in14
462     - movl %edx,156(%esp)
463     - # x15 = in15
464     - movl %ebx,160(%esp)
465     - # i = 20
466     - mov $20,%ebp
467     - # p = x0
468     - movl 100(%esp),%eax
469     - # s = x5
470     - movl 120(%esp),%ecx
471     - # t = x10
472     - movl 140(%esp),%edx
473     - # w = x15
474     - movl 160(%esp),%ebx
475     -._mainloop:
476     - # x0 = p
477     - movl %eax,100(%esp)
478     - # x10 = t
479     - movl %edx,140(%esp)
480     - # p += x12
481     - addl 148(%esp),%eax
482     - # x5 = s
483     - movl %ecx,120(%esp)
484     - # t += x6
485     - addl 124(%esp),%edx
486     - # x15 = w
487     - movl %ebx,160(%esp)
488     - # r = x1
489     - movl 104(%esp),%esi
490     - # r += s
491     - add %ecx,%esi
492     - # v = x11
493     - movl 144(%esp),%edi
494     - # v += w
495     - add %ebx,%edi
496     - # p <<<= 7
497     - rol $7,%eax
498     - # p ^= x4
499     - xorl 116(%esp),%eax
500     - # t <<<= 7
501     - rol $7,%edx
502     - # t ^= x14
503     - xorl 156(%esp),%edx
504     - # r <<<= 7
505     - rol $7,%esi
506     - # r ^= x9
507     - xorl 136(%esp),%esi
508     - # v <<<= 7
509     - rol $7,%edi
510     - # v ^= x3
511     - xorl 112(%esp),%edi
512     - # x4 = p
513     - movl %eax,116(%esp)
514     - # x14 = t
515     - movl %edx,156(%esp)
516     - # p += x0
517     - addl 100(%esp),%eax
518     - # x9 = r
519     - movl %esi,136(%esp)
520     - # t += x10
521     - addl 140(%esp),%edx
522     - # x3 = v
523     - movl %edi,112(%esp)
524     - # p <<<= 9
525     - rol $9,%eax
526     - # p ^= x8
527     - xorl 132(%esp),%eax
528     - # t <<<= 9
529     - rol $9,%edx
530     - # t ^= x2
531     - xorl 108(%esp),%edx
532     - # s += r
533     - add %esi,%ecx
534     - # s <<<= 9
535     - rol $9,%ecx
536     - # s ^= x13
537     - xorl 152(%esp),%ecx
538     - # w += v
539     - add %edi,%ebx
540     - # w <<<= 9
541     - rol $9,%ebx
542     - # w ^= x7
543     - xorl 128(%esp),%ebx
544     - # x8 = p
545     - movl %eax,132(%esp)
546     - # x2 = t
547     - movl %edx,108(%esp)
548     - # p += x4
549     - addl 116(%esp),%eax
550     - # x13 = s
551     - movl %ecx,152(%esp)
552     - # t += x14
553     - addl 156(%esp),%edx
554     - # x7 = w
555     - movl %ebx,128(%esp)
556     - # p <<<= 13
557     - rol $13,%eax
558     - # p ^= x12
559     - xorl 148(%esp),%eax
560     - # t <<<= 13
561     - rol $13,%edx
562     - # t ^= x6
563     - xorl 124(%esp),%edx
564     - # r += s
565     - add %ecx,%esi
566     - # r <<<= 13
567     - rol $13,%esi
568     - # r ^= x1
569     - xorl 104(%esp),%esi
570     - # v += w
571     - add %ebx,%edi
572     - # v <<<= 13
573     - rol $13,%edi
574     - # v ^= x11
575     - xorl 144(%esp),%edi
576     - # x12 = p
577     - movl %eax,148(%esp)
578     - # x6 = t
579     - movl %edx,124(%esp)
580     - # p += x8
581     - addl 132(%esp),%eax
582     - # x1 = r
583     - movl %esi,104(%esp)
584     - # t += x2
585     - addl 108(%esp),%edx
586     - # x11 = v
587     - movl %edi,144(%esp)
588     - # p <<<= 18
589     - rol $18,%eax
590     - # p ^= x0
591     - xorl 100(%esp),%eax
592     - # t <<<= 18
593     - rol $18,%edx
594     - # t ^= x10
595     - xorl 140(%esp),%edx
596     - # s += r
597     - add %esi,%ecx
598     - # s <<<= 18
599     - rol $18,%ecx
600     - # s ^= x5
601     - xorl 120(%esp),%ecx
602     - # w += v
603     - add %edi,%ebx
604     - # w <<<= 18
605     - rol $18,%ebx
606     - # w ^= x15
607     - xorl 160(%esp),%ebx
608     - # x0 = p
609     - movl %eax,100(%esp)
610     - # x10 = t
611     - movl %edx,140(%esp)
612     - # p += x3
613     - addl 112(%esp),%eax
614     - # p <<<= 7
615     - rol $7,%eax
616     - # x5 = s
617     - movl %ecx,120(%esp)
618     - # t += x9
619     - addl 136(%esp),%edx
620     - # x15 = w
621     - movl %ebx,160(%esp)
622     - # r = x4
623     - movl 116(%esp),%esi
624     - # r += s
625     - add %ecx,%esi
626     - # v = x14
627     - movl 156(%esp),%edi
628     - # v += w
629     - add %ebx,%edi
630     - # p ^= x1
631     - xorl 104(%esp),%eax
632     - # t <<<= 7
633     - rol $7,%edx
634     - # t ^= x11
635     - xorl 144(%esp),%edx
636     - # r <<<= 7
637     - rol $7,%esi
638     - # r ^= x6
639     - xorl 124(%esp),%esi
640     - # v <<<= 7
641     - rol $7,%edi
642     - # v ^= x12
643     - xorl 148(%esp),%edi
644     - # x1 = p
645     - movl %eax,104(%esp)
646     - # x11 = t
647     - movl %edx,144(%esp)
648     - # p += x0
649     - addl 100(%esp),%eax
650     - # x6 = r
651     - movl %esi,124(%esp)
652     - # t += x10
653     - addl 140(%esp),%edx
654     - # x12 = v
655     - movl %edi,148(%esp)
656     - # p <<<= 9
657     - rol $9,%eax
658     - # p ^= x2
659     - xorl 108(%esp),%eax
660     - # t <<<= 9
661     - rol $9,%edx
662     - # t ^= x8
663     - xorl 132(%esp),%edx
664     - # s += r
665     - add %esi,%ecx
666     - # s <<<= 9
667     - rol $9,%ecx
668     - # s ^= x7
669     - xorl 128(%esp),%ecx
670     - # w += v
671     - add %edi,%ebx
672     - # w <<<= 9
673     - rol $9,%ebx
674     - # w ^= x13
675     - xorl 152(%esp),%ebx
676     - # x2 = p
677     - movl %eax,108(%esp)
678     - # x8 = t
679     - movl %edx,132(%esp)
680     - # p += x1
681     - addl 104(%esp),%eax
682     - # x7 = s
683     - movl %ecx,128(%esp)
684     - # t += x11
685     - addl 144(%esp),%edx
686     - # x13 = w
687     - movl %ebx,152(%esp)
688     - # p <<<= 13
689     - rol $13,%eax
690     - # p ^= x3
691     - xorl 112(%esp),%eax
692     - # t <<<= 13
693     - rol $13,%edx
694     - # t ^= x9
695     - xorl 136(%esp),%edx
696     - # r += s
697     - add %ecx,%esi
698     - # r <<<= 13
699     - rol $13,%esi
700     - # r ^= x4
701     - xorl 116(%esp),%esi
702     - # v += w
703     - add %ebx,%edi
704     - # v <<<= 13
705     - rol $13,%edi
706     - # v ^= x14
707     - xorl 156(%esp),%edi
708     - # x3 = p
709     - movl %eax,112(%esp)
710     - # x9 = t
711     - movl %edx,136(%esp)
712     - # p += x2
713     - addl 108(%esp),%eax
714     - # x4 = r
715     - movl %esi,116(%esp)
716     - # t += x8
717     - addl 132(%esp),%edx
718     - # x14 = v
719     - movl %edi,156(%esp)
720     - # p <<<= 18
721     - rol $18,%eax
722     - # p ^= x0
723     - xorl 100(%esp),%eax
724     - # t <<<= 18
725     - rol $18,%edx
726     - # t ^= x10
727     - xorl 140(%esp),%edx
728     - # s += r
729     - add %esi,%ecx
730     - # s <<<= 18
731     - rol $18,%ecx
732     - # s ^= x5
733     - xorl 120(%esp),%ecx
734     - # w += v
735     - add %edi,%ebx
736     - # w <<<= 18
737     - rol $18,%ebx
738     - # w ^= x15
739     - xorl 160(%esp),%ebx
740     - # x0 = p
741     - movl %eax,100(%esp)
742     - # x10 = t
743     - movl %edx,140(%esp)
744     - # p += x12
745     - addl 148(%esp),%eax
746     - # x5 = s
747     - movl %ecx,120(%esp)
748     - # t += x6
749     - addl 124(%esp),%edx
750     - # x15 = w
751     - movl %ebx,160(%esp)
752     - # r = x1
753     - movl 104(%esp),%esi
754     - # r += s
755     - add %ecx,%esi
756     - # v = x11
757     - movl 144(%esp),%edi
758     - # v += w
759     - add %ebx,%edi
760     - # p <<<= 7
761     - rol $7,%eax
762     - # p ^= x4
763     - xorl 116(%esp),%eax
764     - # t <<<= 7
765     - rol $7,%edx
766     - # t ^= x14
767     - xorl 156(%esp),%edx
768     - # r <<<= 7
769     - rol $7,%esi
770     - # r ^= x9
771     - xorl 136(%esp),%esi
772     - # v <<<= 7
773     - rol $7,%edi
774     - # v ^= x3
775     - xorl 112(%esp),%edi
776     - # x4 = p
777     - movl %eax,116(%esp)
778     - # x14 = t
779     - movl %edx,156(%esp)
780     - # p += x0
781     - addl 100(%esp),%eax
782     - # x9 = r
783     - movl %esi,136(%esp)
784     - # t += x10
785     - addl 140(%esp),%edx
786     - # x3 = v
787     - movl %edi,112(%esp)
788     - # p <<<= 9
789     - rol $9,%eax
790     - # p ^= x8
791     - xorl 132(%esp),%eax
792     - # t <<<= 9
793     - rol $9,%edx
794     - # t ^= x2
795     - xorl 108(%esp),%edx
796     - # s += r
797     - add %esi,%ecx
798     - # s <<<= 9
799     - rol $9,%ecx
800     - # s ^= x13
801     - xorl 152(%esp),%ecx
802     - # w += v
803     - add %edi,%ebx
804     - # w <<<= 9
805     - rol $9,%ebx
806     - # w ^= x7
807     - xorl 128(%esp),%ebx
808     - # x8 = p
809     - movl %eax,132(%esp)
810     - # x2 = t
811     - movl %edx,108(%esp)
812     - # p += x4
813     - addl 116(%esp),%eax
814     - # x13 = s
815     - movl %ecx,152(%esp)
816     - # t += x14
817     - addl 156(%esp),%edx
818     - # x7 = w
819     - movl %ebx,128(%esp)
820     - # p <<<= 13
821     - rol $13,%eax
822     - # p ^= x12
823     - xorl 148(%esp),%eax
824     - # t <<<= 13
825     - rol $13,%edx
826     - # t ^= x6
827     - xorl 124(%esp),%edx
828     - # r += s
829     - add %ecx,%esi
830     - # r <<<= 13
831     - rol $13,%esi
832     - # r ^= x1
833     - xorl 104(%esp),%esi
834     - # v += w
835     - add %ebx,%edi
836     - # v <<<= 13
837     - rol $13,%edi
838     - # v ^= x11
839     - xorl 144(%esp),%edi
840     - # x12 = p
841     - movl %eax,148(%esp)
842     - # x6 = t
843     - movl %edx,124(%esp)
844     - # p += x8
845     - addl 132(%esp),%eax
846     - # x1 = r
847     - movl %esi,104(%esp)
848     - # t += x2
849     - addl 108(%esp),%edx
850     - # x11 = v
851     - movl %edi,144(%esp)
852     - # p <<<= 18
853     - rol $18,%eax
854     - # p ^= x0
855     - xorl 100(%esp),%eax
856     - # t <<<= 18
857     - rol $18,%edx
858     - # t ^= x10
859     - xorl 140(%esp),%edx
860     - # s += r
861     - add %esi,%ecx
862     - # s <<<= 18
863     - rol $18,%ecx
864     - # s ^= x5
865     - xorl 120(%esp),%ecx
866     - # w += v
867     - add %edi,%ebx
868     - # w <<<= 18
869     - rol $18,%ebx
870     - # w ^= x15
871     - xorl 160(%esp),%ebx
872     - # x0 = p
873     - movl %eax,100(%esp)
874     - # x10 = t
875     - movl %edx,140(%esp)
876     - # p += x3
877     - addl 112(%esp),%eax
878     - # p <<<= 7
879     - rol $7,%eax
880     - # x5 = s
881     - movl %ecx,120(%esp)
882     - # t += x9
883     - addl 136(%esp),%edx
884     - # x15 = w
885     - movl %ebx,160(%esp)
886     - # r = x4
887     - movl 116(%esp),%esi
888     - # r += s
889     - add %ecx,%esi
890     - # v = x14
891     - movl 156(%esp),%edi
892     - # v += w
893     - add %ebx,%edi
894     - # p ^= x1
895     - xorl 104(%esp),%eax
896     - # t <<<= 7
897     - rol $7,%edx
898     - # t ^= x11
899     - xorl 144(%esp),%edx
900     - # r <<<= 7
901     - rol $7,%esi
902     - # r ^= x6
903     - xorl 124(%esp),%esi
904     - # v <<<= 7
905     - rol $7,%edi
906     - # v ^= x12
907     - xorl 148(%esp),%edi
908     - # x1 = p
909     - movl %eax,104(%esp)
910     - # x11 = t
911     - movl %edx,144(%esp)
912     - # p += x0
913     - addl 100(%esp),%eax
914     - # x6 = r
915     - movl %esi,124(%esp)
916     - # t += x10
917     - addl 140(%esp),%edx
918     - # x12 = v
919     - movl %edi,148(%esp)
920     - # p <<<= 9
921     - rol $9,%eax
922     - # p ^= x2
923     - xorl 108(%esp),%eax
924     - # t <<<= 9
925     - rol $9,%edx
926     - # t ^= x8
927     - xorl 132(%esp),%edx
928     - # s += r
929     - add %esi,%ecx
930     - # s <<<= 9
931     - rol $9,%ecx
932     - # s ^= x7
933     - xorl 128(%esp),%ecx
934     - # w += v
935     - add %edi,%ebx
936     - # w <<<= 9
937     - rol $9,%ebx
938     - # w ^= x13
939     - xorl 152(%esp),%ebx
940     - # x2 = p
941     - movl %eax,108(%esp)
942     - # x8 = t
943     - movl %edx,132(%esp)
944     - # p += x1
945     - addl 104(%esp),%eax
946     - # x7 = s
947     - movl %ecx,128(%esp)
948     - # t += x11
949     - addl 144(%esp),%edx
950     - # x13 = w
951     - movl %ebx,152(%esp)
952     - # p <<<= 13
953     - rol $13,%eax
954     - # p ^= x3
955     - xorl 112(%esp),%eax
956     - # t <<<= 13
957     - rol $13,%edx
958     - # t ^= x9
959     - xorl 136(%esp),%edx
960     - # r += s
961     - add %ecx,%esi
962     - # r <<<= 13
963     - rol $13,%esi
964     - # r ^= x4
965     - xorl 116(%esp),%esi
966     - # v += w
967     - add %ebx,%edi
968     - # v <<<= 13
969     - rol $13,%edi
970     - # v ^= x14
971     - xorl 156(%esp),%edi
972     - # x3 = p
973     - movl %eax,112(%esp)
974     - # x9 = t
975     - movl %edx,136(%esp)
976     - # p += x2
977     - addl 108(%esp),%eax
978     - # x4 = r
979     - movl %esi,116(%esp)
980     - # t += x8
981     - addl 132(%esp),%edx
982     - # x14 = v
983     - movl %edi,156(%esp)
984     - # p <<<= 18
985     - rol $18,%eax
986     - # p ^= x0
987     - xorl 100(%esp),%eax
988     - # t <<<= 18
989     - rol $18,%edx
990     - # t ^= x10
991     - xorl 140(%esp),%edx
992     - # s += r
993     - add %esi,%ecx
994     - # s <<<= 18
995     - rol $18,%ecx
996     - # s ^= x5
997     - xorl 120(%esp),%ecx
998     - # w += v
999     - add %edi,%ebx
1000     - # w <<<= 18
1001     - rol $18,%ebx
1002     - # w ^= x15
1003     - xorl 160(%esp),%ebx
1004     - # i -= 4
1005     - sub $4,%ebp
1006     - # goto mainloop if unsigned >
1007     - ja ._mainloop
1008     - # x0 = p
1009     - movl %eax,100(%esp)
1010     - # x5 = s
1011     - movl %ecx,120(%esp)
1012     - # x10 = t
1013     - movl %edx,140(%esp)
1014     - # x15 = w
1015     - movl %ebx,160(%esp)
1016     - # out = out_backup
1017     - movl 72(%esp),%edi
1018     - # m = m_backup
1019     - movl 68(%esp),%esi
1020     - # in0 = x0
1021     - movl 100(%esp),%eax
1022     - # in1 = x1
1023     - movl 104(%esp),%ecx
1024     - # in0 += j0
1025     - addl 164(%esp),%eax
1026     - # in1 += j1
1027     - addl 168(%esp),%ecx
1028     - # in0 ^= *(uint32 *) (m + 0)
1029     - xorl 0(%esi),%eax
1030     - # in1 ^= *(uint32 *) (m + 4)
1031     - xorl 4(%esi),%ecx
1032     - # *(uint32 *) (out + 0) = in0
1033     - movl %eax,0(%edi)
1034     - # *(uint32 *) (out + 4) = in1
1035     - movl %ecx,4(%edi)
1036     - # in2 = x2
1037     - movl 108(%esp),%eax
1038     - # in3 = x3
1039     - movl 112(%esp),%ecx
1040     - # in2 += j2
1041     - addl 172(%esp),%eax
1042     - # in3 += j3
1043     - addl 176(%esp),%ecx
1044     - # in2 ^= *(uint32 *) (m + 8)
1045     - xorl 8(%esi),%eax
1046     - # in3 ^= *(uint32 *) (m + 12)
1047     - xorl 12(%esi),%ecx
1048     - # *(uint32 *) (out + 8) = in2
1049     - movl %eax,8(%edi)
1050     - # *(uint32 *) (out + 12) = in3
1051     - movl %ecx,12(%edi)
1052     - # in4 = x4
1053     - movl 116(%esp),%eax
1054     - # in5 = x5
1055     - movl 120(%esp),%ecx
1056     - # in4 += j4
1057     - addl 180(%esp),%eax
1058     - # in5 += j5
1059     - addl 184(%esp),%ecx
1060     - # in4 ^= *(uint32 *) (m + 16)
1061     - xorl 16(%esi),%eax
1062     - # in5 ^= *(uint32 *) (m + 20)
1063     - xorl 20(%esi),%ecx
1064     - # *(uint32 *) (out + 16) = in4
1065     - movl %eax,16(%edi)
1066     - # *(uint32 *) (out + 20) = in5
1067     - movl %ecx,20(%edi)
1068     - # in6 = x6
1069     - movl 124(%esp),%eax
1070     - # in7 = x7
1071     - movl 128(%esp),%ecx
1072     - # in6 += j6
1073     - addl 188(%esp),%eax
1074     - # in7 += j7
1075     - addl 192(%esp),%ecx
1076     - # in6 ^= *(uint32 *) (m + 24)
1077     - xorl 24(%esi),%eax
1078     - # in7 ^= *(uint32 *) (m + 28)
1079     - xorl 28(%esi),%ecx
1080     - # *(uint32 *) (out + 24) = in6
1081     - movl %eax,24(%edi)
1082     - # *(uint32 *) (out + 28) = in7
1083     - movl %ecx,28(%edi)
1084     - # in8 = x8
1085     - movl 132(%esp),%eax
1086     - # in9 = x9
1087     - movl 136(%esp),%ecx
1088     - # in8 += j8
1089     - addl 196(%esp),%eax
1090     - # in9 += j9
1091     - addl 200(%esp),%ecx
1092     - # in8 ^= *(uint32 *) (m + 32)
1093     - xorl 32(%esi),%eax
1094     - # in9 ^= *(uint32 *) (m + 36)
1095     - xorl 36(%esi),%ecx
1096     - # *(uint32 *) (out + 32) = in8
1097     - movl %eax,32(%edi)
1098     - # *(uint32 *) (out + 36) = in9
1099     - movl %ecx,36(%edi)
1100     - # in10 = x10
1101     - movl 140(%esp),%eax
1102     - # in11 = x11
1103     - movl 144(%esp),%ecx
1104     - # in10 += j10
1105     - addl 204(%esp),%eax
1106     - # in11 += j11
1107     - addl 208(%esp),%ecx
1108     - # in10 ^= *(uint32 *) (m + 40)
1109     - xorl 40(%esi),%eax
1110     - # in11 ^= *(uint32 *) (m + 44)
1111     - xorl 44(%esi),%ecx
1112     - # *(uint32 *) (out + 40) = in10
1113     - movl %eax,40(%edi)
1114     - # *(uint32 *) (out + 44) = in11
1115     - movl %ecx,44(%edi)
1116     - # in12 = x12
1117     - movl 148(%esp),%eax
1118     - # in13 = x13
1119     - movl 152(%esp),%ecx
1120     - # in12 += j12
1121     - addl 212(%esp),%eax
1122     - # in13 += j13
1123     - addl 216(%esp),%ecx
1124     - # in12 ^= *(uint32 *) (m + 48)
1125     - xorl 48(%esi),%eax
1126     - # in13 ^= *(uint32 *) (m + 52)
1127     - xorl 52(%esi),%ecx
1128     - # *(uint32 *) (out + 48) = in12
1129     - movl %eax,48(%edi)
1130     - # *(uint32 *) (out + 52) = in13
1131     - movl %ecx,52(%edi)
1132     - # in14 = x14
1133     - movl 156(%esp),%eax
1134     - # in15 = x15
1135     - movl 160(%esp),%ecx
1136     - # in14 += j14
1137     - addl 220(%esp),%eax
1138     - # in15 += j15
1139     - addl 224(%esp),%ecx
1140     - # in14 ^= *(uint32 *) (m + 56)
1141     - xorl 56(%esi),%eax
1142     - # in15 ^= *(uint32 *) (m + 60)
1143     - xorl 60(%esi),%ecx
1144     - # *(uint32 *) (out + 56) = in14
1145     - movl %eax,56(%edi)
1146     - # *(uint32 *) (out + 60) = in15
1147     - movl %ecx,60(%edi)
1148     - # bytes = bytes_backup
1149     - movl 76(%esp),%ebx
1150     - # in8 = j8
1151     - movl 196(%esp),%eax
1152     - # in9 = j9
1153     - movl 200(%esp),%ecx
1154     - # in8 += 1
1155     - add $1,%eax
1156     - # in9 += 0 + carry
1157     - adc $0,%ecx
1158     - # j8 = in8
1159     - movl %eax,196(%esp)
1160     - # j9 = in9
1161     - movl %ecx,200(%esp)
1162     - # bytes - 64
1163     - cmp $64,%ebx
1164     - # goto bytesatleast65 if unsigned>
1165     - ja ._bytesatleast65
1166     - # goto bytesatleast64 if unsigned>=
1167     - jae ._bytesatleast64
1168     - # m = out
1169     - mov %edi,%esi
1170     - # out = ctarget
1171     - movl 228(%esp),%edi
1172     - # i = bytes
1173     - mov %ebx,%ecx
1174     - # while (i) { *out++ = *m++; --i }
1175     - rep movsb
1176     -._bytesatleast64:
1177     - # x = x_backup
1178     - movl 64(%esp),%eax
1179     - # in8 = j8
1180     - movl 196(%esp),%ecx
1181     - # in9 = j9
1182     - movl 200(%esp),%edx
1183     - # *(uint32 *) (x + 32) = in8
1184     - movl %ecx,32(%eax)
1185     - # *(uint32 *) (x + 36) = in9
1186     - movl %edx,36(%eax)
1187     -._done:
1188     - # eax = eax_stack
1189     - movl 80(%esp),%eax
1190     - # ebx = ebx_stack
1191     - movl 84(%esp),%ebx
1192     - # esi = esi_stack
1193     - movl 88(%esp),%esi
1194     - # edi = edi_stack
1195     - movl 92(%esp),%edi
1196     - # ebp = ebp_stack
1197     - movl 96(%esp),%ebp
1198     - # leave
1199     - add %eax,%esp
1200     - ret
1201     -._bytesatleast65:
1202     - # bytes -= 64
1203     - sub $64,%ebx
1204     - # out += 64
1205     - add $64,%edi
1206     - # m += 64
1207     - add $64,%esi
1208     - # goto bytesatleast1
1209     - jmp ._bytesatleast1
1210     -ENDPROC(salsa20_encrypt_bytes)
1211     diff --git a/arch/x86/crypto/salsa20-x86_64-asm_64.S b/arch/x86/crypto/salsa20-x86_64-asm_64.S
1212     deleted file mode 100644
1213     index 03a4918f41ee..000000000000
1214     --- a/arch/x86/crypto/salsa20-x86_64-asm_64.S
1215     +++ /dev/null
1216     @@ -1,805 +0,0 @@
1217     -/* SPDX-License-Identifier: GPL-2.0 */
1218     -#include <linux/linkage.h>
1219     -
1220     -# enter salsa20_encrypt_bytes
1221     -ENTRY(salsa20_encrypt_bytes)
1222     - mov %rsp,%r11
1223     - and $31,%r11
1224     - add $256,%r11
1225     - sub %r11,%rsp
1226     - # x = arg1
1227     - mov %rdi,%r8
1228     - # m = arg2
1229     - mov %rsi,%rsi
1230     - # out = arg3
1231     - mov %rdx,%rdi
1232     - # bytes = arg4
1233     - mov %rcx,%rdx
1234     - # unsigned>? bytes - 0
1235     - cmp $0,%rdx
1236     - # comment:fp stack unchanged by jump
1237     - # goto done if !unsigned>
1238     - jbe ._done
1239     - # comment:fp stack unchanged by fallthrough
1240     -# start:
1241     -._start:
1242     - # r11_stack = r11
1243     - movq %r11,0(%rsp)
1244     - # r12_stack = r12
1245     - movq %r12,8(%rsp)
1246     - # r13_stack = r13
1247     - movq %r13,16(%rsp)
1248     - # r14_stack = r14
1249     - movq %r14,24(%rsp)
1250     - # r15_stack = r15
1251     - movq %r15,32(%rsp)
1252     - # rbx_stack = rbx
1253     - movq %rbx,40(%rsp)
1254     - # rbp_stack = rbp
1255     - movq %rbp,48(%rsp)
1256     - # in0 = *(uint64 *) (x + 0)
1257     - movq 0(%r8),%rcx
1258     - # in2 = *(uint64 *) (x + 8)
1259     - movq 8(%r8),%r9
1260     - # in4 = *(uint64 *) (x + 16)
1261     - movq 16(%r8),%rax
1262     - # in6 = *(uint64 *) (x + 24)
1263     - movq 24(%r8),%r10
1264     - # in8 = *(uint64 *) (x + 32)
1265     - movq 32(%r8),%r11
1266     - # in10 = *(uint64 *) (x + 40)
1267     - movq 40(%r8),%r12
1268     - # in12 = *(uint64 *) (x + 48)
1269     - movq 48(%r8),%r13
1270     - # in14 = *(uint64 *) (x + 56)
1271     - movq 56(%r8),%r14
1272     - # j0 = in0
1273     - movq %rcx,56(%rsp)
1274     - # j2 = in2
1275     - movq %r9,64(%rsp)
1276     - # j4 = in4
1277     - movq %rax,72(%rsp)
1278     - # j6 = in6
1279     - movq %r10,80(%rsp)
1280     - # j8 = in8
1281     - movq %r11,88(%rsp)
1282     - # j10 = in10
1283     - movq %r12,96(%rsp)
1284     - # j12 = in12
1285     - movq %r13,104(%rsp)
1286     - # j14 = in14
1287     - movq %r14,112(%rsp)
1288     - # x_backup = x
1289     - movq %r8,120(%rsp)
1290     -# bytesatleast1:
1291     -._bytesatleast1:
1292     - # unsigned<? bytes - 64
1293     - cmp $64,%rdx
1294     - # comment:fp stack unchanged by jump
1295     - # goto nocopy if !unsigned<
1296     - jae ._nocopy
1297     - # ctarget = out
1298     - movq %rdi,128(%rsp)
1299     - # out = &tmp
1300     - leaq 192(%rsp),%rdi
1301     - # i = bytes
1302     - mov %rdx,%rcx
1303     - # while (i) { *out++ = *m++; --i }
1304     - rep movsb
1305     - # out = &tmp
1306     - leaq 192(%rsp),%rdi
1307     - # m = &tmp
1308     - leaq 192(%rsp),%rsi
1309     - # comment:fp stack unchanged by fallthrough
1310     -# nocopy:
1311     -._nocopy:
1312     - # out_backup = out
1313     - movq %rdi,136(%rsp)
1314     - # m_backup = m
1315     - movq %rsi,144(%rsp)
1316     - # bytes_backup = bytes
1317     - movq %rdx,152(%rsp)
1318     - # x1 = j0
1319     - movq 56(%rsp),%rdi
1320     - # x0 = x1
1321     - mov %rdi,%rdx
1322     - # (uint64) x1 >>= 32
1323     - shr $32,%rdi
1324     - # x3 = j2
1325     - movq 64(%rsp),%rsi
1326     - # x2 = x3
1327     - mov %rsi,%rcx
1328     - # (uint64) x3 >>= 32
1329     - shr $32,%rsi
1330     - # x5 = j4
1331     - movq 72(%rsp),%r8
1332     - # x4 = x5
1333     - mov %r8,%r9
1334     - # (uint64) x5 >>= 32
1335     - shr $32,%r8
1336     - # x5_stack = x5
1337     - movq %r8,160(%rsp)
1338     - # x7 = j6
1339     - movq 80(%rsp),%r8
1340     - # x6 = x7
1341     - mov %r8,%rax
1342     - # (uint64) x7 >>= 32
1343     - shr $32,%r8
1344     - # x9 = j8
1345     - movq 88(%rsp),%r10
1346     - # x8 = x9
1347     - mov %r10,%r11
1348     - # (uint64) x9 >>= 32
1349     - shr $32,%r10
1350     - # x11 = j10
1351     - movq 96(%rsp),%r12
1352     - # x10 = x11
1353     - mov %r12,%r13
1354     - # x10_stack = x10
1355     - movq %r13,168(%rsp)
1356     - # (uint64) x11 >>= 32
1357     - shr $32,%r12
1358     - # x13 = j12
1359     - movq 104(%rsp),%r13
1360     - # x12 = x13
1361     - mov %r13,%r14
1362     - # (uint64) x13 >>= 32
1363     - shr $32,%r13
1364     - # x15 = j14
1365     - movq 112(%rsp),%r15
1366     - # x14 = x15
1367     - mov %r15,%rbx
1368     - # (uint64) x15 >>= 32
1369     - shr $32,%r15
1370     - # x15_stack = x15
1371     - movq %r15,176(%rsp)
1372     - # i = 20
1373     - mov $20,%r15
1374     -# mainloop:
1375     -._mainloop:
1376     - # i_backup = i
1377     - movq %r15,184(%rsp)
1378     - # x5 = x5_stack
1379     - movq 160(%rsp),%r15
1380     - # a = x12 + x0
1381     - lea (%r14,%rdx),%rbp
1382     - # (uint32) a <<<= 7
1383     - rol $7,%ebp
1384     - # x4 ^= a
1385     - xor %rbp,%r9
1386     - # b = x1 + x5
1387     - lea (%rdi,%r15),%rbp
1388     - # (uint32) b <<<= 7
1389     - rol $7,%ebp
1390     - # x9 ^= b
1391     - xor %rbp,%r10
1392     - # a = x0 + x4
1393     - lea (%rdx,%r9),%rbp
1394     - # (uint32) a <<<= 9
1395     - rol $9,%ebp
1396     - # x8 ^= a
1397     - xor %rbp,%r11
1398     - # b = x5 + x9
1399     - lea (%r15,%r10),%rbp
1400     - # (uint32) b <<<= 9
1401     - rol $9,%ebp
1402     - # x13 ^= b
1403     - xor %rbp,%r13
1404     - # a = x4 + x8
1405     - lea (%r9,%r11),%rbp
1406     - # (uint32) a <<<= 13
1407     - rol $13,%ebp
1408     - # x12 ^= a
1409     - xor %rbp,%r14
1410     - # b = x9 + x13
1411     - lea (%r10,%r13),%rbp
1412     - # (uint32) b <<<= 13
1413     - rol $13,%ebp
1414     - # x1 ^= b
1415     - xor %rbp,%rdi
1416     - # a = x8 + x12
1417     - lea (%r11,%r14),%rbp
1418     - # (uint32) a <<<= 18
1419     - rol $18,%ebp
1420     - # x0 ^= a
1421     - xor %rbp,%rdx
1422     - # b = x13 + x1
1423     - lea (%r13,%rdi),%rbp
1424     - # (uint32) b <<<= 18
1425     - rol $18,%ebp
1426     - # x5 ^= b
1427     - xor %rbp,%r15
1428     - # x10 = x10_stack
1429     - movq 168(%rsp),%rbp
1430     - # x5_stack = x5
1431     - movq %r15,160(%rsp)
1432     - # c = x6 + x10
1433     - lea (%rax,%rbp),%r15
1434     - # (uint32) c <<<= 7
1435     - rol $7,%r15d
1436     - # x14 ^= c
1437     - xor %r15,%rbx
1438     - # c = x10 + x14
1439     - lea (%rbp,%rbx),%r15
1440     - # (uint32) c <<<= 9
1441     - rol $9,%r15d
1442     - # x2 ^= c
1443     - xor %r15,%rcx
1444     - # c = x14 + x2
1445     - lea (%rbx,%rcx),%r15
1446     - # (uint32) c <<<= 13
1447     - rol $13,%r15d
1448     - # x6 ^= c
1449     - xor %r15,%rax
1450     - # c = x2 + x6
1451     - lea (%rcx,%rax),%r15
1452     - # (uint32) c <<<= 18
1453     - rol $18,%r15d
1454     - # x10 ^= c
1455     - xor %r15,%rbp
1456     - # x15 = x15_stack
1457     - movq 176(%rsp),%r15
1458     - # x10_stack = x10
1459     - movq %rbp,168(%rsp)
1460     - # d = x11 + x15
1461     - lea (%r12,%r15),%rbp
1462     - # (uint32) d <<<= 7
1463     - rol $7,%ebp
1464     - # x3 ^= d
1465     - xor %rbp,%rsi
1466     - # d = x15 + x3
1467     - lea (%r15,%rsi),%rbp
1468     - # (uint32) d <<<= 9
1469     - rol $9,%ebp
1470     - # x7 ^= d
1471     - xor %rbp,%r8
1472     - # d = x3 + x7
1473     - lea (%rsi,%r8),%rbp
1474     - # (uint32) d <<<= 13
1475     - rol $13,%ebp
1476     - # x11 ^= d
1477     - xor %rbp,%r12
1478     - # d = x7 + x11
1479     - lea (%r8,%r12),%rbp
1480     - # (uint32) d <<<= 18
1481     - rol $18,%ebp
1482     - # x15 ^= d
1483     - xor %rbp,%r15
1484     - # x15_stack = x15
1485     - movq %r15,176(%rsp)
1486     - # x5 = x5_stack
1487     - movq 160(%rsp),%r15
1488     - # a = x3 + x0
1489     - lea (%rsi,%rdx),%rbp
1490     - # (uint32) a <<<= 7
1491     - rol $7,%ebp
1492     - # x1 ^= a
1493     - xor %rbp,%rdi
1494     - # b = x4 + x5
1495     - lea (%r9,%r15),%rbp
1496     - # (uint32) b <<<= 7
1497     - rol $7,%ebp
1498     - # x6 ^= b
1499     - xor %rbp,%rax
1500     - # a = x0 + x1
1501     - lea (%rdx,%rdi),%rbp
1502     - # (uint32) a <<<= 9
1503     - rol $9,%ebp
1504     - # x2 ^= a
1505     - xor %rbp,%rcx
1506     - # b = x5 + x6
1507     - lea (%r15,%rax),%rbp
1508     - # (uint32) b <<<= 9
1509     - rol $9,%ebp
1510     - # x7 ^= b
1511     - xor %rbp,%r8
1512     - # a = x1 + x2
1513     - lea (%rdi,%rcx),%rbp
1514     - # (uint32) a <<<= 13
1515     - rol $13,%ebp
1516     - # x3 ^= a
1517     - xor %rbp,%rsi
1518     - # b = x6 + x7
1519     - lea (%rax,%r8),%rbp
1520     - # (uint32) b <<<= 13
1521     - rol $13,%ebp
1522     - # x4 ^= b
1523     - xor %rbp,%r9
1524     - # a = x2 + x3
1525     - lea (%rcx,%rsi),%rbp
1526     - # (uint32) a <<<= 18
1527     - rol $18,%ebp
1528     - # x0 ^= a
1529     - xor %rbp,%rdx
1530     - # b = x7 + x4
1531     - lea (%r8,%r9),%rbp
1532     - # (uint32) b <<<= 18
1533     - rol $18,%ebp
1534     - # x5 ^= b
1535     - xor %rbp,%r15
1536     - # x10 = x10_stack
1537     - movq 168(%rsp),%rbp
1538     - # x5_stack = x5
1539     - movq %r15,160(%rsp)
1540     - # c = x9 + x10
1541     - lea (%r10,%rbp),%r15
1542     - # (uint32) c <<<= 7
1543     - rol $7,%r15d
1544     - # x11 ^= c
1545     - xor %r15,%r12
1546     - # c = x10 + x11
1547     - lea (%rbp,%r12),%r15
1548     - # (uint32) c <<<= 9
1549     - rol $9,%r15d
1550     - # x8 ^= c
1551     - xor %r15,%r11
1552     - # c = x11 + x8
1553     - lea (%r12,%r11),%r15
1554     - # (uint32) c <<<= 13
1555     - rol $13,%r15d
1556     - # x9 ^= c
1557     - xor %r15,%r10
1558     - # c = x8 + x9
1559     - lea (%r11,%r10),%r15
1560     - # (uint32) c <<<= 18
1561     - rol $18,%r15d
1562     - # x10 ^= c
1563     - xor %r15,%rbp
1564     - # x15 = x15_stack
1565     - movq 176(%rsp),%r15
1566     - # x10_stack = x10
1567     - movq %rbp,168(%rsp)
1568     - # d = x14 + x15
1569     - lea (%rbx,%r15),%rbp
1570     - # (uint32) d <<<= 7
1571     - rol $7,%ebp
1572     - # x12 ^= d
1573     - xor %rbp,%r14
1574     - # d = x15 + x12
1575     - lea (%r15,%r14),%rbp
1576     - # (uint32) d <<<= 9
1577     - rol $9,%ebp
1578     - # x13 ^= d
1579     - xor %rbp,%r13
1580     - # d = x12 + x13
1581     - lea (%r14,%r13),%rbp
1582     - # (uint32) d <<<= 13
1583     - rol $13,%ebp
1584     - # x14 ^= d
1585     - xor %rbp,%rbx
1586     - # d = x13 + x14
1587     - lea (%r13,%rbx),%rbp
1588     - # (uint32) d <<<= 18
1589     - rol $18,%ebp
1590     - # x15 ^= d
1591     - xor %rbp,%r15
1592     - # x15_stack = x15
1593     - movq %r15,176(%rsp)
1594     - # x5 = x5_stack
1595     - movq 160(%rsp),%r15
1596     - # a = x12 + x0
1597     - lea (%r14,%rdx),%rbp
1598     - # (uint32) a <<<= 7
1599     - rol $7,%ebp
1600     - # x4 ^= a
1601     - xor %rbp,%r9
1602     - # b = x1 + x5
1603     - lea (%rdi,%r15),%rbp
1604     - # (uint32) b <<<= 7
1605     - rol $7,%ebp
1606     - # x9 ^= b
1607     - xor %rbp,%r10
1608     - # a = x0 + x4
1609     - lea (%rdx,%r9),%rbp
1610     - # (uint32) a <<<= 9
1611     - rol $9,%ebp
1612     - # x8 ^= a
1613     - xor %rbp,%r11
1614     - # b = x5 + x9
1615     - lea (%r15,%r10),%rbp
1616     - # (uint32) b <<<= 9
1617     - rol $9,%ebp
1618     - # x13 ^= b
1619     - xor %rbp,%r13
1620     - # a = x4 + x8
1621     - lea (%r9,%r11),%rbp
1622     - # (uint32) a <<<= 13
1623     - rol $13,%ebp
1624     - # x12 ^= a
1625     - xor %rbp,%r14
1626     - # b = x9 + x13
1627     - lea (%r10,%r13),%rbp
1628     - # (uint32) b <<<= 13
1629     - rol $13,%ebp
1630     - # x1 ^= b
1631     - xor %rbp,%rdi
1632     - # a = x8 + x12
1633     - lea (%r11,%r14),%rbp
1634     - # (uint32) a <<<= 18
1635     - rol $18,%ebp
1636     - # x0 ^= a
1637     - xor %rbp,%rdx
1638     - # b = x13 + x1
1639     - lea (%r13,%rdi),%rbp
1640     - # (uint32) b <<<= 18
1641     - rol $18,%ebp
1642     - # x5 ^= b
1643     - xor %rbp,%r15
1644     - # x10 = x10_stack
1645     - movq 168(%rsp),%rbp
1646     - # x5_stack = x5
1647     - movq %r15,160(%rsp)
1648     - # c = x6 + x10
1649     - lea (%rax,%rbp),%r15
1650     - # (uint32) c <<<= 7
1651     - rol $7,%r15d
1652     - # x14 ^= c
1653     - xor %r15,%rbx
1654     - # c = x10 + x14
1655     - lea (%rbp,%rbx),%r15
1656     - # (uint32) c <<<= 9
1657     - rol $9,%r15d
1658     - # x2 ^= c
1659     - xor %r15,%rcx
1660     - # c = x14 + x2
1661     - lea (%rbx,%rcx),%r15
1662     - # (uint32) c <<<= 13
1663     - rol $13,%r15d
1664     - # x6 ^= c
1665     - xor %r15,%rax
1666     - # c = x2 + x6
1667     - lea (%rcx,%rax),%r15
1668     - # (uint32) c <<<= 18
1669     - rol $18,%r15d
1670     - # x10 ^= c
1671     - xor %r15,%rbp
1672     - # x15 = x15_stack
1673     - movq 176(%rsp),%r15
1674     - # x10_stack = x10
1675     - movq %rbp,168(%rsp)
1676     - # d = x11 + x15
1677     - lea (%r12,%r15),%rbp
1678     - # (uint32) d <<<= 7
1679     - rol $7,%ebp
1680     - # x3 ^= d
1681     - xor %rbp,%rsi
1682     - # d = x15 + x3
1683     - lea (%r15,%rsi),%rbp
1684     - # (uint32) d <<<= 9
1685     - rol $9,%ebp
1686     - # x7 ^= d
1687     - xor %rbp,%r8
1688     - # d = x3 + x7
1689     - lea (%rsi,%r8),%rbp
1690     - # (uint32) d <<<= 13
1691     - rol $13,%ebp
1692     - # x11 ^= d
1693     - xor %rbp,%r12
1694     - # d = x7 + x11
1695     - lea (%r8,%r12),%rbp
1696     - # (uint32) d <<<= 18
1697     - rol $18,%ebp
1698     - # x15 ^= d
1699     - xor %rbp,%r15
1700     - # x15_stack = x15
1701     - movq %r15,176(%rsp)
1702     - # x5 = x5_stack
1703     - movq 160(%rsp),%r15
1704     - # a = x3 + x0
1705     - lea (%rsi,%rdx),%rbp
1706     - # (uint32) a <<<= 7
1707     - rol $7,%ebp
1708     - # x1 ^= a
1709     - xor %rbp,%rdi
1710     - # b = x4 + x5
1711     - lea (%r9,%r15),%rbp
1712     - # (uint32) b <<<= 7
1713     - rol $7,%ebp
1714     - # x6 ^= b
1715     - xor %rbp,%rax
1716     - # a = x0 + x1
1717     - lea (%rdx,%rdi),%rbp
1718     - # (uint32) a <<<= 9
1719     - rol $9,%ebp
1720     - # x2 ^= a
1721     - xor %rbp,%rcx
1722     - # b = x5 + x6
1723     - lea (%r15,%rax),%rbp
1724     - # (uint32) b <<<= 9
1725     - rol $9,%ebp
1726     - # x7 ^= b
1727     - xor %rbp,%r8
1728     - # a = x1 + x2
1729     - lea (%rdi,%rcx),%rbp
1730     - # (uint32) a <<<= 13
1731     - rol $13,%ebp
1732     - # x3 ^= a
1733     - xor %rbp,%rsi
1734     - # b = x6 + x7
1735     - lea (%rax,%r8),%rbp
1736     - # (uint32) b <<<= 13
1737     - rol $13,%ebp
1738     - # x4 ^= b
1739     - xor %rbp,%r9
1740     - # a = x2 + x3
1741     - lea (%rcx,%rsi),%rbp
1742     - # (uint32) a <<<= 18
1743     - rol $18,%ebp
1744     - # x0 ^= a
1745     - xor %rbp,%rdx
1746     - # b = x7 + x4
1747     - lea (%r8,%r9),%rbp
1748     - # (uint32) b <<<= 18
1749     - rol $18,%ebp
1750     - # x5 ^= b
1751     - xor %rbp,%r15
1752     - # x10 = x10_stack
1753     - movq 168(%rsp),%rbp
1754     - # x5_stack = x5
1755     - movq %r15,160(%rsp)
1756     - # c = x9 + x10
1757     - lea (%r10,%rbp),%r15
1758     - # (uint32) c <<<= 7
1759     - rol $7,%r15d
1760     - # x11 ^= c
1761     - xor %r15,%r12
1762     - # c = x10 + x11
1763     - lea (%rbp,%r12),%r15
1764     - # (uint32) c <<<= 9
1765     - rol $9,%r15d
1766     - # x8 ^= c
1767     - xor %r15,%r11
1768     - # c = x11 + x8
1769     - lea (%r12,%r11),%r15
1770     - # (uint32) c <<<= 13
1771     - rol $13,%r15d
1772     - # x9 ^= c
1773     - xor %r15,%r10
1774     - # c = x8 + x9
1775     - lea (%r11,%r10),%r15
1776     - # (uint32) c <<<= 18
1777     - rol $18,%r15d
1778     - # x10 ^= c
1779     - xor %r15,%rbp
1780     - # x15 = x15_stack
1781     - movq 176(%rsp),%r15
1782     - # x10_stack = x10
1783     - movq %rbp,168(%rsp)
1784     - # d = x14 + x15
1785     - lea (%rbx,%r15),%rbp
1786     - # (uint32) d <<<= 7
1787     - rol $7,%ebp
1788     - # x12 ^= d
1789     - xor %rbp,%r14
1790     - # d = x15 + x12
1791     - lea (%r15,%r14),%rbp
1792     - # (uint32) d <<<= 9
1793     - rol $9,%ebp
1794     - # x13 ^= d
1795     - xor %rbp,%r13
1796     - # d = x12 + x13
1797     - lea (%r14,%r13),%rbp
1798     - # (uint32) d <<<= 13
1799     - rol $13,%ebp
1800     - # x14 ^= d
1801     - xor %rbp,%rbx
1802     - # d = x13 + x14
1803     - lea (%r13,%rbx),%rbp
1804     - # (uint32) d <<<= 18
1805     - rol $18,%ebp
1806     - # x15 ^= d
1807     - xor %rbp,%r15
1808     - # x15_stack = x15
1809     - movq %r15,176(%rsp)
1810     - # i = i_backup
1811     - movq 184(%rsp),%r15
1812     - # unsigned>? i -= 4
1813     - sub $4,%r15
1814     - # comment:fp stack unchanged by jump
1815     - # goto mainloop if unsigned>
1816     - ja ._mainloop
1817     - # (uint32) x2 += j2
1818     - addl 64(%rsp),%ecx
1819     - # x3 <<= 32
1820     - shl $32,%rsi
1821     - # x3 += j2
1822     - addq 64(%rsp),%rsi
1823     - # (uint64) x3 >>= 32
1824     - shr $32,%rsi
1825     - # x3 <<= 32
1826     - shl $32,%rsi
1827     - # x2 += x3
1828     - add %rsi,%rcx
1829     - # (uint32) x6 += j6
1830     - addl 80(%rsp),%eax
1831     - # x7 <<= 32
1832     - shl $32,%r8
1833     - # x7 += j6
1834     - addq 80(%rsp),%r8
1835     - # (uint64) x7 >>= 32
1836     - shr $32,%r8
1837     - # x7 <<= 32
1838     - shl $32,%r8
1839     - # x6 += x7
1840     - add %r8,%rax
1841     - # (uint32) x8 += j8
1842     - addl 88(%rsp),%r11d
1843     - # x9 <<= 32
1844     - shl $32,%r10
1845     - # x9 += j8
1846     - addq 88(%rsp),%r10
1847     - # (uint64) x9 >>= 32
1848     - shr $32,%r10
1849     - # x9 <<= 32
1850     - shl $32,%r10
1851     - # x8 += x9
1852     - add %r10,%r11
1853     - # (uint32) x12 += j12
1854     - addl 104(%rsp),%r14d
1855     - # x13 <<= 32
1856     - shl $32,%r13
1857     - # x13 += j12
1858     - addq 104(%rsp),%r13
1859     - # (uint64) x13 >>= 32
1860     - shr $32,%r13
1861     - # x13 <<= 32
1862     - shl $32,%r13
1863     - # x12 += x13
1864     - add %r13,%r14
1865     - # (uint32) x0 += j0
1866     - addl 56(%rsp),%edx
1867     - # x1 <<= 32
1868     - shl $32,%rdi
1869     - # x1 += j0
1870     - addq 56(%rsp),%rdi
1871     - # (uint64) x1 >>= 32
1872     - shr $32,%rdi
1873     - # x1 <<= 32
1874     - shl $32,%rdi
1875     - # x0 += x1
1876     - add %rdi,%rdx
1877     - # x5 = x5_stack
1878     - movq 160(%rsp),%rdi
1879     - # (uint32) x4 += j4
1880     - addl 72(%rsp),%r9d
1881     - # x5 <<= 32
1882     - shl $32,%rdi
1883     - # x5 += j4
1884     - addq 72(%rsp),%rdi
1885     - # (uint64) x5 >>= 32
1886     - shr $32,%rdi
1887     - # x5 <<= 32
1888     - shl $32,%rdi
1889     - # x4 += x5
1890     - add %rdi,%r9
1891     - # x10 = x10_stack
1892     - movq 168(%rsp),%r8
1893     - # (uint32) x10 += j10
1894     - addl 96(%rsp),%r8d
1895     - # x11 <<= 32
1896     - shl $32,%r12
1897     - # x11 += j10
1898     - addq 96(%rsp),%r12
1899     - # (uint64) x11 >>= 32
1900     - shr $32,%r12
1901     - # x11 <<= 32
1902     - shl $32,%r12
1903     - # x10 += x11
1904     - add %r12,%r8
1905     - # x15 = x15_stack
1906     - movq 176(%rsp),%rdi
1907     - # (uint32) x14 += j14
1908     - addl 112(%rsp),%ebx
1909     - # x15 <<= 32
1910     - shl $32,%rdi
1911     - # x15 += j14
1912     - addq 112(%rsp),%rdi
1913     - # (uint64) x15 >>= 32
1914     - shr $32,%rdi
1915     - # x15 <<= 32
1916     - shl $32,%rdi
1917     - # x14 += x15
1918     - add %rdi,%rbx
1919     - # out = out_backup
1920     - movq 136(%rsp),%rdi
1921     - # m = m_backup
1922     - movq 144(%rsp),%rsi
1923     - # x0 ^= *(uint64 *) (m + 0)
1924     - xorq 0(%rsi),%rdx
1925     - # *(uint64 *) (out + 0) = x0
1926     - movq %rdx,0(%rdi)
1927     - # x2 ^= *(uint64 *) (m + 8)
1928     - xorq 8(%rsi),%rcx
1929     - # *(uint64 *) (out + 8) = x2
1930     - movq %rcx,8(%rdi)
1931     - # x4 ^= *(uint64 *) (m + 16)
1932     - xorq 16(%rsi),%r9
1933     - # *(uint64 *) (out + 16) = x4
1934     - movq %r9,16(%rdi)
1935     - # x6 ^= *(uint64 *) (m + 24)
1936     - xorq 24(%rsi),%rax
1937     - # *(uint64 *) (out + 24) = x6
1938     - movq %rax,24(%rdi)
1939     - # x8 ^= *(uint64 *) (m + 32)
1940     - xorq 32(%rsi),%r11
1941     - # *(uint64 *) (out + 32) = x8
1942     - movq %r11,32(%rdi)
1943     - # x10 ^= *(uint64 *) (m + 40)
1944     - xorq 40(%rsi),%r8
1945     - # *(uint64 *) (out + 40) = x10
1946     - movq %r8,40(%rdi)
1947     - # x12 ^= *(uint64 *) (m + 48)
1948     - xorq 48(%rsi),%r14
1949     - # *(uint64 *) (out + 48) = x12
1950     - movq %r14,48(%rdi)
1951     - # x14 ^= *(uint64 *) (m + 56)
1952     - xorq 56(%rsi),%rbx
1953     - # *(uint64 *) (out + 56) = x14
1954     - movq %rbx,56(%rdi)
1955     - # bytes = bytes_backup
1956     - movq 152(%rsp),%rdx
1957     - # in8 = j8
1958     - movq 88(%rsp),%rcx
1959     - # in8 += 1
1960     - add $1,%rcx
1961     - # j8 = in8
1962     - movq %rcx,88(%rsp)
1963     - # unsigned>? unsigned<? bytes - 64
1964     - cmp $64,%rdx
1965     - # comment:fp stack unchanged by jump
1966     - # goto bytesatleast65 if unsigned>
1967     - ja ._bytesatleast65
1968     - # comment:fp stack unchanged by jump
1969     - # goto bytesatleast64 if !unsigned<
1970     - jae ._bytesatleast64
1971     - # m = out
1972     - mov %rdi,%rsi
1973     - # out = ctarget
1974     - movq 128(%rsp),%rdi
1975     - # i = bytes
1976     - mov %rdx,%rcx
1977     - # while (i) { *out++ = *m++; --i }
1978     - rep movsb
1979     - # comment:fp stack unchanged by fallthrough
1980     -# bytesatleast64:
1981     -._bytesatleast64:
1982     - # x = x_backup
1983     - movq 120(%rsp),%rdi
1984     - # in8 = j8
1985     - movq 88(%rsp),%rsi
1986     - # *(uint64 *) (x + 32) = in8
1987     - movq %rsi,32(%rdi)
1988     - # r11 = r11_stack
1989     - movq 0(%rsp),%r11
1990     - # r12 = r12_stack
1991     - movq 8(%rsp),%r12
1992     - # r13 = r13_stack
1993     - movq 16(%rsp),%r13
1994     - # r14 = r14_stack
1995     - movq 24(%rsp),%r14
1996     - # r15 = r15_stack
1997     - movq 32(%rsp),%r15
1998     - # rbx = rbx_stack
1999     - movq 40(%rsp),%rbx
2000     - # rbp = rbp_stack
2001     - movq 48(%rsp),%rbp
2002     - # comment:fp stack unchanged by fallthrough
2003     -# done:
2004     -._done:
2005     - # leave
2006     - add %r11,%rsp
2007     - mov %rdi,%rax
2008     - mov %rsi,%rdx
2009     - ret
2010     -# bytesatleast65:
2011     -._bytesatleast65:
2012     - # bytes -= 64
2013     - sub $64,%rdx
2014     - # out += 64
2015     - add $64,%rdi
2016     - # m += 64
2017     - add $64,%rsi
2018     - # comment:fp stack unchanged by jump
2019     - # goto bytesatleast1
2020     - jmp ._bytesatleast1
2021     -ENDPROC(salsa20_encrypt_bytes)
2022     diff --git a/arch/x86/crypto/salsa20_glue.c b/arch/x86/crypto/salsa20_glue.c
2023     deleted file mode 100644
2024     index b07d7d959806..000000000000
2025     --- a/arch/x86/crypto/salsa20_glue.c
2026     +++ /dev/null
2027     @@ -1,91 +0,0 @@
2028     -/*
2029     - * Glue code for optimized assembly version of Salsa20.
2030     - *
2031     - * Copyright (c) 2007 Tan Swee Heng <thesweeheng@gmail.com>
2032     - *
2033     - * The assembly codes are public domain assembly codes written by Daniel. J.
2034     - * Bernstein <djb@cr.yp.to>. The codes are modified to include indentation
2035     - * and to remove extraneous comments and functions that are not needed.
2036     - * - i586 version, renamed as salsa20-i586-asm_32.S
2037     - * available from <http://cr.yp.to/snuffle/salsa20/x86-pm/salsa20.s>
2038     - * - x86-64 version, renamed as salsa20-x86_64-asm_64.S
2039     - * available from <http://cr.yp.to/snuffle/salsa20/amd64-3/salsa20.s>
2040     - *
2041     - * Also modified to set up the initial state using the generic C code rather
2042     - * than in assembly.
2043     - *
2044     - * This program is free software; you can redistribute it and/or modify it
2045     - * under the terms of the GNU General Public License as published by the Free
2046     - * Software Foundation; either version 2 of the License, or (at your option)
2047     - * any later version.
2048     - *
2049     - */
2050     -
2051     -#include <asm/unaligned.h>
2052     -#include <crypto/internal/skcipher.h>
2053     -#include <crypto/salsa20.h>
2054     -#include <linux/module.h>
2055     -
2056     -asmlinkage void salsa20_encrypt_bytes(u32 state[16], const u8 *src, u8 *dst,
2057     - u32 bytes);
2058     -
2059     -static int salsa20_asm_crypt(struct skcipher_request *req)
2060     -{
2061     - struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req);
2062     - const struct salsa20_ctx *ctx = crypto_skcipher_ctx(tfm);
2063     - struct skcipher_walk walk;
2064     - u32 state[16];
2065     - int err;
2066     -
2067     - err = skcipher_walk_virt(&walk, req, true);
2068     -
2069     - crypto_salsa20_init(state, ctx, walk.iv);
2070     -
2071     - while (walk.nbytes > 0) {
2072     - unsigned int nbytes = walk.nbytes;
2073     -
2074     - if (nbytes < walk.total)
2075     - nbytes = round_down(nbytes, walk.stride);
2076     -
2077     - salsa20_encrypt_bytes(state, walk.src.virt.addr,
2078     - walk.dst.virt.addr, nbytes);
2079     - err = skcipher_walk_done(&walk, walk.nbytes - nbytes);
2080     - }
2081     -
2082     - return err;
2083     -}
2084     -
2085     -static struct skcipher_alg alg = {
2086     - .base.cra_name = "salsa20",
2087     - .base.cra_driver_name = "salsa20-asm",
2088     - .base.cra_priority = 200,
2089     - .base.cra_blocksize = 1,
2090     - .base.cra_ctxsize = sizeof(struct salsa20_ctx),
2091     - .base.cra_module = THIS_MODULE,
2092     -
2093     - .min_keysize = SALSA20_MIN_KEY_SIZE,
2094     - .max_keysize = SALSA20_MAX_KEY_SIZE,
2095     - .ivsize = SALSA20_IV_SIZE,
2096     - .chunksize = SALSA20_BLOCK_SIZE,
2097     - .setkey = crypto_salsa20_setkey,
2098     - .encrypt = salsa20_asm_crypt,
2099     - .decrypt = salsa20_asm_crypt,
2100     -};
2101     -
2102     -static int __init init(void)
2103     -{
2104     - return crypto_register_skcipher(&alg);
2105     -}
2106     -
2107     -static void __exit fini(void)
2108     -{
2109     - crypto_unregister_skcipher(&alg);
2110     -}
2111     -
2112     -module_init(init);
2113     -module_exit(fini);
2114     -
2115     -MODULE_LICENSE("GPL");
2116     -MODULE_DESCRIPTION ("Salsa20 stream cipher algorithm (optimized assembly version)");
2117     -MODULE_ALIAS_CRYPTO("salsa20");
2118     -MODULE_ALIAS_CRYPTO("salsa20-asm");
2119     diff --git a/arch/x86/include/asm/vmx.h b/arch/x86/include/asm/vmx.h
2120     index 5db8b0b10766..7cc81c586d71 100644
2121     --- a/arch/x86/include/asm/vmx.h
2122     +++ b/arch/x86/include/asm/vmx.h
2123     @@ -114,6 +114,7 @@
2124     #define VMX_MISC_PREEMPTION_TIMER_RATE_MASK 0x0000001f
2125     #define VMX_MISC_SAVE_EFER_LMA 0x00000020
2126     #define VMX_MISC_ACTIVITY_HLT 0x00000040
2127     +#define VMX_MISC_ZERO_LEN_INS 0x40000000
2128    
2129     /* VMFUNC functions */
2130     #define VMX_VMFUNC_EPTP_SWITCHING 0x00000001
2131     @@ -349,11 +350,13 @@ enum vmcs_field {
2132     #define VECTORING_INFO_VALID_MASK INTR_INFO_VALID_MASK
2133    
2134     #define INTR_TYPE_EXT_INTR (0 << 8) /* external interrupt */
2135     +#define INTR_TYPE_RESERVED (1 << 8) /* reserved */
2136     #define INTR_TYPE_NMI_INTR (2 << 8) /* NMI */
2137     #define INTR_TYPE_HARD_EXCEPTION (3 << 8) /* processor exception */
2138     #define INTR_TYPE_SOFT_INTR (4 << 8) /* software interrupt */
2139     #define INTR_TYPE_PRIV_SW_EXCEPTION (5 << 8) /* ICE breakpoint - undocumented */
2140     #define INTR_TYPE_SOFT_EXCEPTION (6 << 8) /* software exception */
2141     +#define INTR_TYPE_OTHER_EVENT (7 << 8) /* other event */
2142    
2143     /* GUEST_INTERRUPTIBILITY_INFO flags. */
2144     #define GUEST_INTR_STATE_STI 0x00000001
2145     diff --git a/arch/x86/kernel/uprobes.c b/arch/x86/kernel/uprobes.c
2146     index c84bb5396958..442fae7b8b61 100644
2147     --- a/arch/x86/kernel/uprobes.c
2148     +++ b/arch/x86/kernel/uprobes.c
2149     @@ -293,7 +293,7 @@ static int uprobe_init_insn(struct arch_uprobe *auprobe, struct insn *insn, bool
2150     insn_init(insn, auprobe->insn, sizeof(auprobe->insn), x86_64);
2151     /* has the side-effect of processing the entire instruction */
2152     insn_get_length(insn);
2153     - if (WARN_ON_ONCE(!insn_complete(insn)))
2154     + if (!insn_complete(insn))
2155     return -ENOEXEC;
2156    
2157     if (is_prefix_bad(insn))
2158     diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
2159     index 82f5e915e568..dd4366edc200 100644
2160     --- a/arch/x86/kvm/vmx.c
2161     +++ b/arch/x86/kvm/vmx.c
2162     @@ -1510,6 +1510,17 @@ static inline unsigned nested_cpu_vmx_misc_cr3_count(struct kvm_vcpu *vcpu)
2163     return vmx_misc_cr3_count(to_vmx(vcpu)->nested.msrs.misc_low);
2164     }
2165    
2166     +static inline bool nested_cpu_has_zero_length_injection(struct kvm_vcpu *vcpu)
2167     +{
2168     + return to_vmx(vcpu)->nested.msrs.misc_low & VMX_MISC_ZERO_LEN_INS;
2169     +}
2170     +
2171     +static inline bool nested_cpu_supports_monitor_trap_flag(struct kvm_vcpu *vcpu)
2172     +{
2173     + return to_vmx(vcpu)->nested.msrs.procbased_ctls_high &
2174     + CPU_BASED_MONITOR_TRAP_FLAG;
2175     +}
2176     +
2177     static inline bool nested_cpu_has(struct vmcs12 *vmcs12, u32 bit)
2178     {
2179     return vmcs12->cpu_based_vm_exec_control & bit;
2180     @@ -11364,6 +11375,62 @@ static int check_vmentry_prereqs(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12)
2181     !nested_cr3_valid(vcpu, vmcs12->host_cr3))
2182     return VMXERR_ENTRY_INVALID_HOST_STATE_FIELD;
2183    
2184     + /*
2185     + * From the Intel SDM, volume 3:
2186     + * Fields relevant to VM-entry event injection must be set properly.
2187     + * These fields are the VM-entry interruption-information field, the
2188     + * VM-entry exception error code, and the VM-entry instruction length.
2189     + */
2190     + if (vmcs12->vm_entry_intr_info_field & INTR_INFO_VALID_MASK) {
2191     + u32 intr_info = vmcs12->vm_entry_intr_info_field;
2192     + u8 vector = intr_info & INTR_INFO_VECTOR_MASK;
2193     + u32 intr_type = intr_info & INTR_INFO_INTR_TYPE_MASK;
2194     + bool has_error_code = intr_info & INTR_INFO_DELIVER_CODE_MASK;
2195     + bool should_have_error_code;
2196     + bool urg = nested_cpu_has2(vmcs12,
2197     + SECONDARY_EXEC_UNRESTRICTED_GUEST);
2198     + bool prot_mode = !urg || vmcs12->guest_cr0 & X86_CR0_PE;
2199     +
2200     + /* VM-entry interruption-info field: interruption type */
2201     + if (intr_type == INTR_TYPE_RESERVED ||
2202     + (intr_type == INTR_TYPE_OTHER_EVENT &&
2203     + !nested_cpu_supports_monitor_trap_flag(vcpu)))
2204     + return VMXERR_ENTRY_INVALID_CONTROL_FIELD;
2205     +
2206     + /* VM-entry interruption-info field: vector */
2207     + if ((intr_type == INTR_TYPE_NMI_INTR && vector != NMI_VECTOR) ||
2208     + (intr_type == INTR_TYPE_HARD_EXCEPTION && vector > 31) ||
2209     + (intr_type == INTR_TYPE_OTHER_EVENT && vector != 0))
2210     + return VMXERR_ENTRY_INVALID_CONTROL_FIELD;
2211     +
2212     + /* VM-entry interruption-info field: deliver error code */
2213     + should_have_error_code =
2214     + intr_type == INTR_TYPE_HARD_EXCEPTION && prot_mode &&
2215     + x86_exception_has_error_code(vector);
2216     + if (has_error_code != should_have_error_code)
2217     + return VMXERR_ENTRY_INVALID_CONTROL_FIELD;
2218     +
2219     + /* VM-entry exception error code */
2220     + if (has_error_code &&
2221     + vmcs12->vm_entry_exception_error_code & GENMASK(31, 15))
2222     + return VMXERR_ENTRY_INVALID_CONTROL_FIELD;
2223     +
2224     + /* VM-entry interruption-info field: reserved bits */
2225     + if (intr_info & INTR_INFO_RESVD_BITS_MASK)
2226     + return VMXERR_ENTRY_INVALID_CONTROL_FIELD;
2227     +
2228     + /* VM-entry instruction length */
2229     + switch (intr_type) {
2230     + case INTR_TYPE_SOFT_EXCEPTION:
2231     + case INTR_TYPE_SOFT_INTR:
2232     + case INTR_TYPE_PRIV_SW_EXCEPTION:
2233     + if ((vmcs12->vm_entry_instruction_len > 15) ||
2234     + (vmcs12->vm_entry_instruction_len == 0 &&
2235     + !nested_cpu_has_zero_length_injection(vcpu)))
2236     + return VMXERR_ENTRY_INVALID_CONTROL_FIELD;
2237     + }
2238     + }
2239     +
2240     return 0;
2241     }
2242    
2243     diff --git a/arch/x86/kvm/x86.h b/arch/x86/kvm/x86.h
2244     index 331993c49dae..257f27620bc2 100644
2245     --- a/arch/x86/kvm/x86.h
2246     +++ b/arch/x86/kvm/x86.h
2247     @@ -110,6 +110,15 @@ static inline bool is_la57_mode(struct kvm_vcpu *vcpu)
2248     #endif
2249     }
2250    
2251     +static inline bool x86_exception_has_error_code(unsigned int vector)
2252     +{
2253     + static u32 exception_has_error_code = BIT(DF_VECTOR) | BIT(TS_VECTOR) |
2254     + BIT(NP_VECTOR) | BIT(SS_VECTOR) | BIT(GP_VECTOR) |
2255     + BIT(PF_VECTOR) | BIT(AC_VECTOR);
2256     +
2257     + return (1U << vector) & exception_has_error_code;
2258     +}
2259     +
2260     static inline bool mmu_is_nested(struct kvm_vcpu *vcpu)
2261     {
2262     return vcpu->arch.walk_mmu == &vcpu->arch.nested_mmu;
2263     diff --git a/arch/x86/purgatory/Makefile b/arch/x86/purgatory/Makefile
2264     index 2e9ee023e6bc..81a8e33115ad 100644
2265     --- a/arch/x86/purgatory/Makefile
2266     +++ b/arch/x86/purgatory/Makefile
2267     @@ -6,7 +6,7 @@ purgatory-y := purgatory.o stack.o setup-x86_$(BITS).o sha256.o entry64.o string
2268     targets += $(purgatory-y)
2269     PURGATORY_OBJS = $(addprefix $(obj)/,$(purgatory-y))
2270    
2271     -$(obj)/sha256.o: $(srctree)/lib/sha256.c
2272     +$(obj)/sha256.o: $(srctree)/lib/sha256.c FORCE
2273     $(call if_changed_rule,cc_o_c)
2274    
2275     LDFLAGS_purgatory.ro := -e purgatory_start -r --no-undefined -nostdlib -z nodefaultlib
2276     diff --git a/arch/x86/xen/enlighten_pv.c b/arch/x86/xen/enlighten_pv.c
2277     index 357969a3697c..ce8f6a8d4ac9 100644
2278     --- a/arch/x86/xen/enlighten_pv.c
2279     +++ b/arch/x86/xen/enlighten_pv.c
2280     @@ -1206,12 +1206,20 @@ asmlinkage __visible void __init xen_start_kernel(void)
2281    
2282     xen_setup_features();
2283    
2284     - xen_setup_machphys_mapping();
2285     -
2286     /* Install Xen paravirt ops */
2287     pv_info = xen_info;
2288     pv_init_ops.patch = paravirt_patch_default;
2289     pv_cpu_ops = xen_cpu_ops;
2290     + xen_init_irq_ops();
2291     +
2292     + /*
2293     + * Setup xen_vcpu early because it is needed for
2294     + * local_irq_disable(), irqs_disabled(), e.g. in printk().
2295     + *
2296     + * Don't do the full vcpu_info placement stuff until we have
2297     + * the cpu_possible_mask and a non-dummy shared_info.
2298     + */
2299     + xen_vcpu_info_reset(0);
2300    
2301     x86_platform.get_nmi_reason = xen_get_nmi_reason;
2302    
2303     @@ -1224,10 +1232,12 @@ asmlinkage __visible void __init xen_start_kernel(void)
2304     * Set up some pagetable state before starting to set any ptes.
2305     */
2306    
2307     + xen_setup_machphys_mapping();
2308     xen_init_mmu_ops();
2309    
2310     /* Prevent unwanted bits from being set in PTEs. */
2311     __supported_pte_mask &= ~_PAGE_GLOBAL;
2312     + __default_kernel_pte_mask &= ~_PAGE_GLOBAL;
2313    
2314     /*
2315     * Prevent page tables from being allocated in highmem, even
2316     @@ -1248,20 +1258,9 @@ asmlinkage __visible void __init xen_start_kernel(void)
2317     get_cpu_cap(&boot_cpu_data);
2318     x86_configure_nx();
2319    
2320     - xen_init_irq_ops();
2321     -
2322     /* Let's presume PV guests always boot on vCPU with id 0. */
2323     per_cpu(xen_vcpu_id, 0) = 0;
2324    
2325     - /*
2326     - * Setup xen_vcpu early because idt_setup_early_handler needs it for
2327     - * local_irq_disable(), irqs_disabled().
2328     - *
2329     - * Don't do the full vcpu_info placement stuff until we have
2330     - * the cpu_possible_mask and a non-dummy shared_info.
2331     - */
2332     - xen_vcpu_info_reset(0);
2333     -
2334     idt_setup_early_handler();
2335    
2336     xen_init_capabilities();
2337     diff --git a/arch/x86/xen/irq.c b/arch/x86/xen/irq.c
2338     index 74179852e46c..7515a19fd324 100644
2339     --- a/arch/x86/xen/irq.c
2340     +++ b/arch/x86/xen/irq.c
2341     @@ -128,8 +128,6 @@ static const struct pv_irq_ops xen_irq_ops __initconst = {
2342    
2343     void __init xen_init_irq_ops(void)
2344     {
2345     - /* For PVH we use default pv_irq_ops settings. */
2346     - if (!xen_feature(XENFEAT_hvm_callback_vector))
2347     - pv_irq_ops = xen_irq_ops;
2348     + pv_irq_ops = xen_irq_ops;
2349     x86_init.irqs.intr_init = xen_init_IRQ;
2350     }
2351     diff --git a/block/bsg.c b/block/bsg.c
2352     index defa06c11858..7a54b645d469 100644
2353     --- a/block/bsg.c
2354     +++ b/block/bsg.c
2355     @@ -268,8 +268,6 @@ bsg_map_hdr(struct request_queue *q, struct sg_io_v4 *hdr, fmode_t mode)
2356     } else if (hdr->din_xfer_len) {
2357     ret = blk_rq_map_user(q, rq, NULL, uptr64(hdr->din_xferp),
2358     hdr->din_xfer_len, GFP_KERNEL);
2359     - } else {
2360     - ret = blk_rq_map_user(q, rq, NULL, NULL, 0, GFP_KERNEL);
2361     }
2362    
2363     if (ret)
2364     diff --git a/crypto/Kconfig b/crypto/Kconfig
2365     index 76e8c88c97b4..2f4d4f711950 100644
2366     --- a/crypto/Kconfig
2367     +++ b/crypto/Kconfig
2368     @@ -1335,34 +1335,6 @@ config CRYPTO_SALSA20
2369     The Salsa20 stream cipher algorithm is designed by Daniel J.
2370     Bernstein <djb@cr.yp.to>. See <http://cr.yp.to/snuffle.html>
2371    
2372     -config CRYPTO_SALSA20_586
2373     - tristate "Salsa20 stream cipher algorithm (i586)"
2374     - depends on (X86 || UML_X86) && !64BIT
2375     - select CRYPTO_BLKCIPHER
2376     - select CRYPTO_SALSA20
2377     - help
2378     - Salsa20 stream cipher algorithm.
2379     -
2380     - Salsa20 is a stream cipher submitted to eSTREAM, the ECRYPT
2381     - Stream Cipher Project. See <http://www.ecrypt.eu.org/stream/>
2382     -
2383     - The Salsa20 stream cipher algorithm is designed by Daniel J.
2384     - Bernstein <djb@cr.yp.to>. See <http://cr.yp.to/snuffle.html>
2385     -
2386     -config CRYPTO_SALSA20_X86_64
2387     - tristate "Salsa20 stream cipher algorithm (x86_64)"
2388     - depends on (X86 || UML_X86) && 64BIT
2389     - select CRYPTO_BLKCIPHER
2390     - select CRYPTO_SALSA20
2391     - help
2392     - Salsa20 stream cipher algorithm.
2393     -
2394     - Salsa20 is a stream cipher submitted to eSTREAM, the ECRYPT
2395     - Stream Cipher Project. See <http://www.ecrypt.eu.org/stream/>
2396     -
2397     - The Salsa20 stream cipher algorithm is designed by Daniel J.
2398     - Bernstein <djb@cr.yp.to>. See <http://cr.yp.to/snuffle.html>
2399     -
2400     config CRYPTO_CHACHA20
2401     tristate "ChaCha20 cipher algorithm"
2402     select CRYPTO_BLKCIPHER
2403     diff --git a/crypto/sha3_generic.c b/crypto/sha3_generic.c
2404     index 264ec12c0b9c..7f6735d9003f 100644
2405     --- a/crypto/sha3_generic.c
2406     +++ b/crypto/sha3_generic.c
2407     @@ -152,7 +152,7 @@ static SHA3_INLINE void keccakf_round(u64 st[25])
2408     st[24] ^= bc[ 4];
2409     }
2410    
2411     -static void __optimize("O3") keccakf(u64 st[25])
2412     +static void keccakf(u64 st[25])
2413     {
2414     int round;
2415    
2416     diff --git a/drivers/acpi/acpica/hwsleep.c b/drivers/acpi/acpica/hwsleep.c
2417     index fc0c2e2328cd..fe9d46d81750 100644
2418     --- a/drivers/acpi/acpica/hwsleep.c
2419     +++ b/drivers/acpi/acpica/hwsleep.c
2420     @@ -51,16 +51,23 @@ acpi_status acpi_hw_legacy_sleep(u8 sleep_state)
2421     return_ACPI_STATUS(status);
2422     }
2423    
2424     - /*
2425     - * 1) Disable all GPEs
2426     - * 2) Enable all wakeup GPEs
2427     - */
2428     + /* Disable all GPEs */
2429     status = acpi_hw_disable_all_gpes();
2430     if (ACPI_FAILURE(status)) {
2431     return_ACPI_STATUS(status);
2432     }
2433     + /*
2434     + * If the target sleep state is S5, clear all GPEs and fixed events too
2435     + */
2436     + if (sleep_state == ACPI_STATE_S5) {
2437     + status = acpi_hw_clear_acpi_status();
2438     + if (ACPI_FAILURE(status)) {
2439     + return_ACPI_STATUS(status);
2440     + }
2441     + }
2442     acpi_gbl_system_awake_and_running = FALSE;
2443    
2444     + /* Enable all wakeup GPEs */
2445     status = acpi_hw_enable_all_wakeup_gpes();
2446     if (ACPI_FAILURE(status)) {
2447     return_ACPI_STATUS(status);
2448     diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c
2449     index e2235ed3e4be..964106d173bd 100644
2450     --- a/drivers/acpi/nfit/core.c
2451     +++ b/drivers/acpi/nfit/core.c
2452     @@ -1272,7 +1272,7 @@ static ssize_t scrub_show(struct device *dev,
2453    
2454     mutex_lock(&acpi_desc->init_mutex);
2455     rc = sprintf(buf, "%d%s", acpi_desc->scrub_count,
2456     - work_busy(&acpi_desc->dwork.work)
2457     + acpi_desc->scrub_busy
2458     && !acpi_desc->cancel ? "+\n" : "\n");
2459     mutex_unlock(&acpi_desc->init_mutex);
2460     }
2461     @@ -2949,6 +2949,32 @@ static unsigned int __acpi_nfit_scrub(struct acpi_nfit_desc *acpi_desc,
2462     return 0;
2463     }
2464    
2465     +static void __sched_ars(struct acpi_nfit_desc *acpi_desc, unsigned int tmo)
2466     +{
2467     + lockdep_assert_held(&acpi_desc->init_mutex);
2468     +
2469     + acpi_desc->scrub_busy = 1;
2470     + /* note this should only be set from within the workqueue */
2471     + if (tmo)
2472     + acpi_desc->scrub_tmo = tmo;
2473     + queue_delayed_work(nfit_wq, &acpi_desc->dwork, tmo * HZ);
2474     +}
2475     +
2476     +static void sched_ars(struct acpi_nfit_desc *acpi_desc)
2477     +{
2478     + __sched_ars(acpi_desc, 0);
2479     +}
2480     +
2481     +static void notify_ars_done(struct acpi_nfit_desc *acpi_desc)
2482     +{
2483     + lockdep_assert_held(&acpi_desc->init_mutex);
2484     +
2485     + acpi_desc->scrub_busy = 0;
2486     + acpi_desc->scrub_count++;
2487     + if (acpi_desc->scrub_count_state)
2488     + sysfs_notify_dirent(acpi_desc->scrub_count_state);
2489     +}
2490     +
2491     static void acpi_nfit_scrub(struct work_struct *work)
2492     {
2493     struct acpi_nfit_desc *acpi_desc;
2494     @@ -2959,14 +2985,10 @@ static void acpi_nfit_scrub(struct work_struct *work)
2495     mutex_lock(&acpi_desc->init_mutex);
2496     query_rc = acpi_nfit_query_poison(acpi_desc);
2497     tmo = __acpi_nfit_scrub(acpi_desc, query_rc);
2498     - if (tmo) {
2499     - queue_delayed_work(nfit_wq, &acpi_desc->dwork, tmo * HZ);
2500     - acpi_desc->scrub_tmo = tmo;
2501     - } else {
2502     - acpi_desc->scrub_count++;
2503     - if (acpi_desc->scrub_count_state)
2504     - sysfs_notify_dirent(acpi_desc->scrub_count_state);
2505     - }
2506     + if (tmo)
2507     + __sched_ars(acpi_desc, tmo);
2508     + else
2509     + notify_ars_done(acpi_desc);
2510     memset(acpi_desc->ars_status, 0, acpi_desc->max_ars);
2511     mutex_unlock(&acpi_desc->init_mutex);
2512     }
2513     @@ -3047,7 +3069,7 @@ static int acpi_nfit_register_regions(struct acpi_nfit_desc *acpi_desc)
2514     break;
2515     }
2516    
2517     - queue_delayed_work(nfit_wq, &acpi_desc->dwork, 0);
2518     + sched_ars(acpi_desc);
2519     return 0;
2520     }
2521    
2522     @@ -3249,7 +3271,7 @@ int acpi_nfit_ars_rescan(struct acpi_nfit_desc *acpi_desc, unsigned long flags)
2523     }
2524     }
2525     if (scheduled) {
2526     - queue_delayed_work(nfit_wq, &acpi_desc->dwork, 0);
2527     + sched_ars(acpi_desc);
2528     dev_dbg(dev, "ars_scan triggered\n");
2529     }
2530     mutex_unlock(&acpi_desc->init_mutex);
2531     diff --git a/drivers/acpi/nfit/nfit.h b/drivers/acpi/nfit/nfit.h
2532     index 7d15856a739f..a97ff42fe311 100644
2533     --- a/drivers/acpi/nfit/nfit.h
2534     +++ b/drivers/acpi/nfit/nfit.h
2535     @@ -203,6 +203,7 @@ struct acpi_nfit_desc {
2536     unsigned int max_ars;
2537     unsigned int scrub_count;
2538     unsigned int scrub_mode;
2539     + unsigned int scrub_busy:1;
2540     unsigned int cancel:1;
2541     unsigned long dimm_cmd_force_en;
2542     unsigned long bus_cmd_force_en;
2543     diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
2544     index 738fb22978dd..b2b9eba1d214 100644
2545     --- a/drivers/ata/ahci.c
2546     +++ b/drivers/ata/ahci.c
2547     @@ -400,6 +400,7 @@ static const struct pci_device_id ahci_pci_tbl[] = {
2548     { PCI_VDEVICE(INTEL, 0x0f23), board_ahci_mobile }, /* Bay Trail AHCI */
2549     { PCI_VDEVICE(INTEL, 0x22a3), board_ahci_mobile }, /* Cherry Tr. AHCI */
2550     { PCI_VDEVICE(INTEL, 0x5ae3), board_ahci_mobile }, /* ApolloLake AHCI */
2551     + { PCI_VDEVICE(INTEL, 0x34d3), board_ahci_mobile }, /* Ice Lake LP AHCI */
2552    
2553     /* JMicron 360/1/3/5/6, match class to avoid IDE function */
2554     { PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
2555     @@ -1280,6 +1281,59 @@ static bool ahci_broken_suspend(struct pci_dev *pdev)
2556     return strcmp(buf, dmi->driver_data) < 0;
2557     }
2558    
2559     +static bool ahci_broken_lpm(struct pci_dev *pdev)
2560     +{
2561     + static const struct dmi_system_id sysids[] = {
2562     + /* Various Lenovo 50 series have LPM issues with older BIOSen */
2563     + {
2564     + .matches = {
2565     + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
2566     + DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X250"),
2567     + },
2568     + .driver_data = "20180406", /* 1.31 */
2569     + },
2570     + {
2571     + .matches = {
2572     + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
2573     + DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad L450"),
2574     + },
2575     + .driver_data = "20180420", /* 1.28 */
2576     + },
2577     + {
2578     + .matches = {
2579     + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
2580     + DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T450s"),
2581     + },
2582     + .driver_data = "20180315", /* 1.33 */
2583     + },
2584     + {
2585     + .matches = {
2586     + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
2587     + DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad W541"),
2588     + },
2589     + /*
2590     + * Note date based on release notes, 2.35 has been
2591     + * reported to be good, but I've been unable to get
2592     + * a hold of the reporter to get the DMI BIOS date.
2593     + * TODO: fix this.
2594     + */
2595     + .driver_data = "20180310", /* 2.35 */
2596     + },
2597     + { } /* terminate list */
2598     + };
2599     + const struct dmi_system_id *dmi = dmi_first_match(sysids);
2600     + int year, month, date;
2601     + char buf[9];
2602     +
2603     + if (!dmi)
2604     + return false;
2605     +
2606     + dmi_get_date(DMI_BIOS_DATE, &year, &month, &date);
2607     + snprintf(buf, sizeof(buf), "%04d%02d%02d", year, month, date);
2608     +
2609     + return strcmp(buf, dmi->driver_data) < 0;
2610     +}
2611     +
2612     static bool ahci_broken_online(struct pci_dev *pdev)
2613     {
2614     #define ENCODE_BUSDEVFN(bus, slot, func) \
2615     @@ -1694,6 +1748,12 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
2616     "quirky BIOS, skipping spindown on poweroff\n");
2617     }
2618    
2619     + if (ahci_broken_lpm(pdev)) {
2620     + pi.flags |= ATA_FLAG_NO_LPM;
2621     + dev_warn(&pdev->dev,
2622     + "BIOS update required for Link Power Management support\n");
2623     + }
2624     +
2625     if (ahci_broken_suspend(pdev)) {
2626     hpriv->flags |= AHCI_HFLAG_NO_SUSPEND;
2627     dev_warn(&pdev->dev,
2628     diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
2629     index 9bfd2f7e4542..55cbaab4bc20 100644
2630     --- a/drivers/ata/libata-core.c
2631     +++ b/drivers/ata/libata-core.c
2632     @@ -2502,6 +2502,9 @@ int ata_dev_configure(struct ata_device *dev)
2633     (id[ATA_ID_SATA_CAPABILITY] & 0xe) == 0x2)
2634     dev->horkage |= ATA_HORKAGE_NOLPM;
2635    
2636     + if (ap->flags & ATA_FLAG_NO_LPM)
2637     + dev->horkage |= ATA_HORKAGE_NOLPM;
2638     +
2639     if (dev->horkage & ATA_HORKAGE_NOLPM) {
2640     ata_dev_warn(dev, "LPM support broken, forcing max_power\n");
2641     dev->link->ap->target_lpm_policy = ATA_LPM_MAX_POWER;
2642     diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
2643     index 89a9d4a2efc8..c0ac1ea3e7a3 100644
2644     --- a/drivers/ata/libata-scsi.c
2645     +++ b/drivers/ata/libata-scsi.c
2646     @@ -3802,10 +3802,20 @@ static unsigned int ata_scsi_zbc_out_xlat(struct ata_queued_cmd *qc)
2647     */
2648     goto invalid_param_len;
2649     }
2650     - if (block > dev->n_sectors)
2651     - goto out_of_range;
2652    
2653     all = cdb[14] & 0x1;
2654     + if (all) {
2655     + /*
2656     + * Ignore the block address (zone ID) as defined by ZBC.
2657     + */
2658     + block = 0;
2659     + } else if (block >= dev->n_sectors) {
2660     + /*
2661     + * Block must be a valid zone ID (a zone start LBA).
2662     + */
2663     + fp = 2;
2664     + goto invalid_fld;
2665     + }
2666    
2667     if (ata_ncq_enabled(qc->dev) &&
2668     ata_fpdma_zac_mgmt_out_supported(qc->dev)) {
2669     @@ -3834,10 +3844,6 @@ static unsigned int ata_scsi_zbc_out_xlat(struct ata_queued_cmd *qc)
2670     invalid_fld:
2671     ata_scsi_set_invalid_field(qc->dev, scmd, fp, 0xff);
2672     return 1;
2673     - out_of_range:
2674     - /* "Logical Block Address out of range" */
2675     - ata_scsi_set_sense(qc->dev, scmd, ILLEGAL_REQUEST, 0x21, 0x00);
2676     - return 1;
2677     invalid_param_len:
2678     /* "Parameter list length error" */
2679     ata_scsi_set_sense(qc->dev, scmd, ILLEGAL_REQUEST, 0x1a, 0x0);
2680     diff --git a/drivers/block/loop.c b/drivers/block/loop.c
2681     index 55cf554bc914..1a2777bc5a57 100644
2682     --- a/drivers/block/loop.c
2683     +++ b/drivers/block/loop.c
2684     @@ -644,6 +644,36 @@ static void loop_reread_partitions(struct loop_device *lo,
2685     __func__, lo->lo_number, lo->lo_file_name, rc);
2686     }
2687    
2688     +static inline int is_loop_device(struct file *file)
2689     +{
2690     + struct inode *i = file->f_mapping->host;
2691     +
2692     + return i && S_ISBLK(i->i_mode) && MAJOR(i->i_rdev) == LOOP_MAJOR;
2693     +}
2694     +
2695     +static int loop_validate_file(struct file *file, struct block_device *bdev)
2696     +{
2697     + struct inode *inode = file->f_mapping->host;
2698     + struct file *f = file;
2699     +
2700     + /* Avoid recursion */
2701     + while (is_loop_device(f)) {
2702     + struct loop_device *l;
2703     +
2704     + if (f->f_mapping->host->i_bdev == bdev)
2705     + return -EBADF;
2706     +
2707     + l = f->f_mapping->host->i_bdev->bd_disk->private_data;
2708     + if (l->lo_state == Lo_unbound) {
2709     + return -EINVAL;
2710     + }
2711     + f = l->lo_backing_file;
2712     + }
2713     + if (!S_ISREG(inode->i_mode) && !S_ISBLK(inode->i_mode))
2714     + return -EINVAL;
2715     + return 0;
2716     +}
2717     +
2718     /*
2719     * loop_change_fd switched the backing store of a loopback device to
2720     * a new file. This is useful for operating system installers to free up
2721     @@ -673,14 +703,15 @@ static int loop_change_fd(struct loop_device *lo, struct block_device *bdev,
2722     if (!file)
2723     goto out;
2724    
2725     + error = loop_validate_file(file, bdev);
2726     + if (error)
2727     + goto out_putf;
2728     +
2729     inode = file->f_mapping->host;
2730     old_file = lo->lo_backing_file;
2731    
2732     error = -EINVAL;
2733    
2734     - if (!S_ISREG(inode->i_mode) && !S_ISBLK(inode->i_mode))
2735     - goto out_putf;
2736     -
2737     /* size of the new backing store needs to be the same */
2738     if (get_loop_size(lo, file) != get_loop_size(lo, old_file))
2739     goto out_putf;
2740     @@ -706,13 +737,6 @@ static int loop_change_fd(struct loop_device *lo, struct block_device *bdev,
2741     return error;
2742     }
2743    
2744     -static inline int is_loop_device(struct file *file)
2745     -{
2746     - struct inode *i = file->f_mapping->host;
2747     -
2748     - return i && S_ISBLK(i->i_mode) && MAJOR(i->i_rdev) == LOOP_MAJOR;
2749     -}
2750     -
2751     /* loop sysfs attributes */
2752    
2753     static ssize_t loop_attr_show(struct device *dev, char *page,
2754     @@ -809,16 +833,17 @@ static struct attribute_group loop_attribute_group = {
2755     .attrs= loop_attrs,
2756     };
2757    
2758     -static int loop_sysfs_init(struct loop_device *lo)
2759     +static void loop_sysfs_init(struct loop_device *lo)
2760     {
2761     - return sysfs_create_group(&disk_to_dev(lo->lo_disk)->kobj,
2762     - &loop_attribute_group);
2763     + lo->sysfs_inited = !sysfs_create_group(&disk_to_dev(lo->lo_disk)->kobj,
2764     + &loop_attribute_group);
2765     }
2766    
2767     static void loop_sysfs_exit(struct loop_device *lo)
2768     {
2769     - sysfs_remove_group(&disk_to_dev(lo->lo_disk)->kobj,
2770     - &loop_attribute_group);
2771     + if (lo->sysfs_inited)
2772     + sysfs_remove_group(&disk_to_dev(lo->lo_disk)->kobj,
2773     + &loop_attribute_group);
2774     }
2775    
2776     static void loop_config_discard(struct loop_device *lo)
2777     @@ -877,7 +902,7 @@ static int loop_prepare_queue(struct loop_device *lo)
2778     static int loop_set_fd(struct loop_device *lo, fmode_t mode,
2779     struct block_device *bdev, unsigned int arg)
2780     {
2781     - struct file *file, *f;
2782     + struct file *file;
2783     struct inode *inode;
2784     struct address_space *mapping;
2785     int lo_flags = 0;
2786     @@ -896,29 +921,13 @@ static int loop_set_fd(struct loop_device *lo, fmode_t mode,
2787     if (lo->lo_state != Lo_unbound)
2788     goto out_putf;
2789    
2790     - /* Avoid recursion */
2791     - f = file;
2792     - while (is_loop_device(f)) {
2793     - struct loop_device *l;
2794     -
2795     - if (f->f_mapping->host->i_bdev == bdev)
2796     - goto out_putf;
2797     -
2798     - l = f->f_mapping->host->i_bdev->bd_disk->private_data;
2799     - if (l->lo_state == Lo_unbound) {
2800     - error = -EINVAL;
2801     - goto out_putf;
2802     - }
2803     - f = l->lo_backing_file;
2804     - }
2805     + error = loop_validate_file(file, bdev);
2806     + if (error)
2807     + goto out_putf;
2808    
2809     mapping = file->f_mapping;
2810     inode = mapping->host;
2811    
2812     - error = -EINVAL;
2813     - if (!S_ISREG(inode->i_mode) && !S_ISBLK(inode->i_mode))
2814     - goto out_putf;
2815     -
2816     if (!(file->f_mode & FMODE_WRITE) || !(mode & FMODE_WRITE) ||
2817     !file->f_op->write_iter)
2818     lo_flags |= LO_FLAGS_READ_ONLY;
2819     diff --git a/drivers/block/loop.h b/drivers/block/loop.h
2820     index b78de9879f4f..4d42c7af7de7 100644
2821     --- a/drivers/block/loop.h
2822     +++ b/drivers/block/loop.h
2823     @@ -58,6 +58,7 @@ struct loop_device {
2824     struct kthread_worker worker;
2825     struct task_struct *worker_task;
2826     bool use_dio;
2827     + bool sysfs_inited;
2828    
2829     struct request_queue *lo_queue;
2830     struct blk_mq_tag_set tag_set;
2831     diff --git a/drivers/gpu/drm/etnaviv/etnaviv_drv.c b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
2832     index ab50090d066c..ff1a9ffbf17f 100644
2833     --- a/drivers/gpu/drm/etnaviv/etnaviv_drv.c
2834     +++ b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
2835     @@ -693,8 +693,11 @@ static struct platform_driver etnaviv_platform_driver = {
2836     },
2837     };
2838    
2839     +static struct platform_device *etnaviv_drm;
2840     +
2841     static int __init etnaviv_init(void)
2842     {
2843     + struct platform_device *pdev;
2844     int ret;
2845     struct device_node *np;
2846    
2847     @@ -706,7 +709,7 @@ static int __init etnaviv_init(void)
2848    
2849     ret = platform_driver_register(&etnaviv_platform_driver);
2850     if (ret != 0)
2851     - platform_driver_unregister(&etnaviv_gpu_driver);
2852     + goto unregister_gpu_driver;
2853    
2854     /*
2855     * If the DT contains at least one available GPU device, instantiate
2856     @@ -715,20 +718,33 @@ static int __init etnaviv_init(void)
2857     for_each_compatible_node(np, NULL, "vivante,gc") {
2858     if (!of_device_is_available(np))
2859     continue;
2860     -
2861     - platform_device_register_simple("etnaviv", -1, NULL, 0);
2862     + pdev = platform_device_register_simple("etnaviv", -1,
2863     + NULL, 0);
2864     + if (IS_ERR(pdev)) {
2865     + ret = PTR_ERR(pdev);
2866     + of_node_put(np);
2867     + goto unregister_platform_driver;
2868     + }
2869     + etnaviv_drm = pdev;
2870     of_node_put(np);
2871     break;
2872     }
2873    
2874     + return 0;
2875     +
2876     +unregister_platform_driver:
2877     + platform_driver_unregister(&etnaviv_platform_driver);
2878     +unregister_gpu_driver:
2879     + platform_driver_unregister(&etnaviv_gpu_driver);
2880     return ret;
2881     }
2882     module_init(etnaviv_init);
2883    
2884     static void __exit etnaviv_exit(void)
2885     {
2886     - platform_driver_unregister(&etnaviv_gpu_driver);
2887     + platform_device_unregister(etnaviv_drm);
2888     platform_driver_unregister(&etnaviv_platform_driver);
2889     + platform_driver_unregister(&etnaviv_gpu_driver);
2890     }
2891     module_exit(etnaviv_exit);
2892    
2893     diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.h b/drivers/gpu/drm/etnaviv/etnaviv_gpu.h
2894     index 3c3005501846..feb3c6fab382 100644
2895     --- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.h
2896     +++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.h
2897     @@ -142,6 +142,9 @@ struct etnaviv_gpu {
2898     struct work_struct sync_point_work;
2899     int sync_point_event;
2900    
2901     + /* hang detection */
2902     + u32 hangcheck_dma_addr;
2903     +
2904     void __iomem *mmio;
2905     int irq;
2906    
2907     diff --git a/drivers/gpu/drm/etnaviv/etnaviv_sched.c b/drivers/gpu/drm/etnaviv/etnaviv_sched.c
2908     index 6cf0775dbcd7..506b05a67dfe 100644
2909     --- a/drivers/gpu/drm/etnaviv/etnaviv_sched.c
2910     +++ b/drivers/gpu/drm/etnaviv/etnaviv_sched.c
2911     @@ -21,6 +21,7 @@
2912     #include "etnaviv_gem.h"
2913     #include "etnaviv_gpu.h"
2914     #include "etnaviv_sched.h"
2915     +#include "state.xml.h"
2916    
2917     static int etnaviv_job_hang_limit = 0;
2918     module_param_named(job_hang_limit, etnaviv_job_hang_limit, int , 0444);
2919     @@ -96,6 +97,29 @@ static void etnaviv_sched_timedout_job(struct drm_sched_job *sched_job)
2920     {
2921     struct etnaviv_gem_submit *submit = to_etnaviv_submit(sched_job);
2922     struct etnaviv_gpu *gpu = submit->gpu;
2923     + u32 dma_addr;
2924     + int change;
2925     +
2926     + /*
2927     + * If the GPU managed to complete this jobs fence, the timout is
2928     + * spurious. Bail out.
2929     + */
2930     + if (fence_completed(gpu, submit->out_fence->seqno))
2931     + return;
2932     +
2933     + /*
2934     + * If the GPU is still making forward progress on the front-end (which
2935     + * should never loop) we shift out the timeout to give it a chance to
2936     + * finish the job.
2937     + */
2938     + dma_addr = gpu_read(gpu, VIVS_FE_DMA_ADDRESS);
2939     + change = dma_addr - gpu->hangcheck_dma_addr;
2940     + if (change < 0 || change > 16) {
2941     + gpu->hangcheck_dma_addr = dma_addr;
2942     + schedule_delayed_work(&sched_job->work_tdr,
2943     + sched_job->sched->timeout);
2944     + return;
2945     + }
2946    
2947     /* block scheduler */
2948     kthread_park(gpu->sched.thread);
2949     diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
2950     index 60292d243e24..ec2d11af6c78 100644
2951     --- a/drivers/i2c/busses/i2c-tegra.c
2952     +++ b/drivers/i2c/busses/i2c-tegra.c
2953     @@ -547,6 +547,14 @@ static int tegra_i2c_disable_packet_mode(struct tegra_i2c_dev *i2c_dev)
2954     {
2955     u32 cnfg;
2956    
2957     + /*
2958     + * NACK interrupt is generated before the I2C controller generates
2959     + * the STOP condition on the bus. So wait for 2 clock periods
2960     + * before disabling the controller so that the STOP condition has
2961     + * been delivered properly.
2962     + */
2963     + udelay(DIV_ROUND_UP(2 * 1000000, i2c_dev->bus_clk_rate));
2964     +
2965     cnfg = i2c_readl(i2c_dev, I2C_CNFG);
2966     if (cnfg & I2C_CNFG_PACKET_MODE_EN)
2967     i2c_writel(i2c_dev, cnfg & ~I2C_CNFG_PACKET_MODE_EN, I2C_CNFG);
2968     @@ -708,15 +716,6 @@ static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev,
2969     if (likely(i2c_dev->msg_err == I2C_ERR_NONE))
2970     return 0;
2971    
2972     - /*
2973     - * NACK interrupt is generated before the I2C controller generates
2974     - * the STOP condition on the bus. So wait for 2 clock periods
2975     - * before resetting the controller so that the STOP condition has
2976     - * been delivered properly.
2977     - */
2978     - if (i2c_dev->msg_err == I2C_ERR_NO_ACK)
2979     - udelay(DIV_ROUND_UP(2 * 1000000, i2c_dev->bus_clk_rate));
2980     -
2981     tegra_i2c_init(i2c_dev);
2982     if (i2c_dev->msg_err == I2C_ERR_NO_ACK) {
2983     if (msg->flags & I2C_M_IGNORE_NAK)
2984     diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c
2985     index 1ba40bb2b966..1b6e80123fba 100644
2986     --- a/drivers/i2c/i2c-core-base.c
2987     +++ b/drivers/i2c/i2c-core-base.c
2988     @@ -198,7 +198,16 @@ int i2c_generic_scl_recovery(struct i2c_adapter *adap)
2989    
2990     val = !val;
2991     bri->set_scl(adap, val);
2992     - ndelay(RECOVERY_NDELAY);
2993     +
2994     + /*
2995     + * If we can set SDA, we will always create STOP here to ensure
2996     + * the additional pulses will do no harm. This is achieved by
2997     + * letting SDA follow SCL half a cycle later.
2998     + */
2999     + ndelay(RECOVERY_NDELAY / 2);
3000     + if (bri->set_sda)
3001     + bri->set_sda(adap, val);
3002     + ndelay(RECOVERY_NDELAY / 2);
3003     }
3004    
3005     /* check if recovery actually succeeded */
3006     diff --git a/drivers/infiniband/Kconfig b/drivers/infiniband/Kconfig
3007     index 2a972ed6851b..b03af54367c0 100644
3008     --- a/drivers/infiniband/Kconfig
3009     +++ b/drivers/infiniband/Kconfig
3010     @@ -35,6 +35,17 @@ config INFINIBAND_USER_ACCESS
3011     libibverbs, libibcm and a hardware driver library from
3012     rdma-core <https://github.com/linux-rdma/rdma-core>.
3013    
3014     +config INFINIBAND_USER_ACCESS_UCM
3015     + bool "Userspace CM (UCM, DEPRECATED)"
3016     + depends on BROKEN
3017     + depends on INFINIBAND_USER_ACCESS
3018     + help
3019     + The UCM module has known security flaws, which no one is
3020     + interested to fix. The user-space part of this code was
3021     + dropped from the upstream a long time ago.
3022     +
3023     + This option is DEPRECATED and planned to be removed.
3024     +
3025     config INFINIBAND_EXP_LEGACY_VERBS_NEW_UAPI
3026     bool "Allow experimental legacy verbs in new ioctl uAPI (EXPERIMENTAL)"
3027     depends on INFINIBAND_USER_ACCESS
3028     diff --git a/drivers/infiniband/core/Makefile b/drivers/infiniband/core/Makefile
3029     index dda9e856e3fa..e1acbf5f87f1 100644
3030     --- a/drivers/infiniband/core/Makefile
3031     +++ b/drivers/infiniband/core/Makefile
3032     @@ -5,8 +5,8 @@ user_access-$(CONFIG_INFINIBAND_ADDR_TRANS) := rdma_ucm.o
3033     obj-$(CONFIG_INFINIBAND) += ib_core.o ib_cm.o iw_cm.o \
3034     $(infiniband-y)
3035     obj-$(CONFIG_INFINIBAND_USER_MAD) += ib_umad.o
3036     -obj-$(CONFIG_INFINIBAND_USER_ACCESS) += ib_uverbs.o ib_ucm.o \
3037     - $(user_access-y)
3038     +obj-$(CONFIG_INFINIBAND_USER_ACCESS) += ib_uverbs.o $(user_access-y)
3039     +obj-$(CONFIG_INFINIBAND_USER_ACCESS_UCM) += ib_ucm.o $(user_access-y)
3040    
3041     ib_core-y := packer.o ud_header.o verbs.o cq.o rw.o sysfs.o \
3042     device.o fmr_pool.o cache.o netlink.o \
3043     diff --git a/drivers/infiniband/hw/cxgb4/mem.c b/drivers/infiniband/hw/cxgb4/mem.c
3044     index 1445918e3239..7b76e6f81aeb 100644
3045     --- a/drivers/infiniband/hw/cxgb4/mem.c
3046     +++ b/drivers/infiniband/hw/cxgb4/mem.c
3047     @@ -774,7 +774,7 @@ static int c4iw_set_page(struct ib_mr *ibmr, u64 addr)
3048     {
3049     struct c4iw_mr *mhp = to_c4iw_mr(ibmr);
3050    
3051     - if (unlikely(mhp->mpl_len == mhp->max_mpl_len))
3052     + if (unlikely(mhp->mpl_len == mhp->attr.pbl_size))
3053     return -ENOMEM;
3054    
3055     mhp->mpl[mhp->mpl_len++] = addr;
3056     diff --git a/drivers/infiniband/hw/hfi1/rc.c b/drivers/infiniband/hw/hfi1/rc.c
3057     index da58046a02ea..295d3c40a994 100644
3058     --- a/drivers/infiniband/hw/hfi1/rc.c
3059     +++ b/drivers/infiniband/hw/hfi1/rc.c
3060     @@ -271,7 +271,7 @@ int hfi1_make_rc_req(struct rvt_qp *qp, struct hfi1_pkt_state *ps)
3061    
3062     lockdep_assert_held(&qp->s_lock);
3063     ps->s_txreq = get_txreq(ps->dev, qp);
3064     - if (IS_ERR(ps->s_txreq))
3065     + if (!ps->s_txreq)
3066     goto bail_no_tx;
3067    
3068     if (priv->hdr_type == HFI1_PKT_TYPE_9B) {
3069     diff --git a/drivers/infiniband/hw/hfi1/uc.c b/drivers/infiniband/hw/hfi1/uc.c
3070     index 9d7a3110c14c..d140aaccdf14 100644
3071     --- a/drivers/infiniband/hw/hfi1/uc.c
3072     +++ b/drivers/infiniband/hw/hfi1/uc.c
3073     @@ -1,5 +1,5 @@
3074     /*
3075     - * Copyright(c) 2015, 2016 Intel Corporation.
3076     + * Copyright(c) 2015 - 2018 Intel Corporation.
3077     *
3078     * This file is provided under a dual BSD/GPLv2 license. When using or
3079     * redistributing this file, you may do so under either license.
3080     @@ -72,7 +72,7 @@ int hfi1_make_uc_req(struct rvt_qp *qp, struct hfi1_pkt_state *ps)
3081     int middle = 0;
3082    
3083     ps->s_txreq = get_txreq(ps->dev, qp);
3084     - if (IS_ERR(ps->s_txreq))
3085     + if (!ps->s_txreq)
3086     goto bail_no_tx;
3087    
3088     if (!(ib_rvt_state_ops[qp->state] & RVT_PROCESS_SEND_OK)) {
3089     diff --git a/drivers/infiniband/hw/hfi1/ud.c b/drivers/infiniband/hw/hfi1/ud.c
3090     index 69c17a5ef038..3ae10530f754 100644
3091     --- a/drivers/infiniband/hw/hfi1/ud.c
3092     +++ b/drivers/infiniband/hw/hfi1/ud.c
3093     @@ -1,5 +1,5 @@
3094     /*
3095     - * Copyright(c) 2015, 2016 Intel Corporation.
3096     + * Copyright(c) 2015 - 2018 Intel Corporation.
3097     *
3098     * This file is provided under a dual BSD/GPLv2 license. When using or
3099     * redistributing this file, you may do so under either license.
3100     @@ -482,7 +482,7 @@ int hfi1_make_ud_req(struct rvt_qp *qp, struct hfi1_pkt_state *ps)
3101     u32 lid;
3102    
3103     ps->s_txreq = get_txreq(ps->dev, qp);
3104     - if (IS_ERR(ps->s_txreq))
3105     + if (!ps->s_txreq)
3106     goto bail_no_tx;
3107    
3108     if (!(ib_rvt_state_ops[qp->state] & RVT_PROCESS_NEXT_SEND_OK)) {
3109     diff --git a/drivers/infiniband/hw/hfi1/verbs_txreq.c b/drivers/infiniband/hw/hfi1/verbs_txreq.c
3110     index 873e48ea923f..c4ab2d5b4502 100644
3111     --- a/drivers/infiniband/hw/hfi1/verbs_txreq.c
3112     +++ b/drivers/infiniband/hw/hfi1/verbs_txreq.c
3113     @@ -1,5 +1,5 @@
3114     /*
3115     - * Copyright(c) 2016 - 2017 Intel Corporation.
3116     + * Copyright(c) 2016 - 2018 Intel Corporation.
3117     *
3118     * This file is provided under a dual BSD/GPLv2 license. When using or
3119     * redistributing this file, you may do so under either license.
3120     @@ -94,7 +94,7 @@ struct verbs_txreq *__get_txreq(struct hfi1_ibdev *dev,
3121     struct rvt_qp *qp)
3122     __must_hold(&qp->s_lock)
3123     {
3124     - struct verbs_txreq *tx = ERR_PTR(-EBUSY);
3125     + struct verbs_txreq *tx = NULL;
3126    
3127     write_seqlock(&dev->txwait_lock);
3128     if (ib_rvt_state_ops[qp->state] & RVT_PROCESS_RECV_OK) {
3129     diff --git a/drivers/infiniband/hw/hfi1/verbs_txreq.h b/drivers/infiniband/hw/hfi1/verbs_txreq.h
3130     index 729244c3086c..1c19bbc764b2 100644
3131     --- a/drivers/infiniband/hw/hfi1/verbs_txreq.h
3132     +++ b/drivers/infiniband/hw/hfi1/verbs_txreq.h
3133     @@ -1,5 +1,5 @@
3134     /*
3135     - * Copyright(c) 2016 Intel Corporation.
3136     + * Copyright(c) 2016 - 2018 Intel Corporation.
3137     *
3138     * This file is provided under a dual BSD/GPLv2 license. When using or
3139     * redistributing this file, you may do so under either license.
3140     @@ -83,7 +83,7 @@ static inline struct verbs_txreq *get_txreq(struct hfi1_ibdev *dev,
3141     if (unlikely(!tx)) {
3142     /* call slow path to get the lock */
3143     tx = __get_txreq(dev, qp);
3144     - if (IS_ERR(tx))
3145     + if (!tx)
3146     return tx;
3147     }
3148     tx->qp = qp;
3149     diff --git a/drivers/misc/ibmasm/ibmasmfs.c b/drivers/misc/ibmasm/ibmasmfs.c
3150     index e05c3245930a..fa840666bdd1 100644
3151     --- a/drivers/misc/ibmasm/ibmasmfs.c
3152     +++ b/drivers/misc/ibmasm/ibmasmfs.c
3153     @@ -507,35 +507,14 @@ static int remote_settings_file_close(struct inode *inode, struct file *file)
3154     static ssize_t remote_settings_file_read(struct file *file, char __user *buf, size_t count, loff_t *offset)
3155     {
3156     void __iomem *address = (void __iomem *)file->private_data;
3157     - unsigned char *page;
3158     - int retval;
3159     int len = 0;
3160     unsigned int value;
3161     -
3162     - if (*offset < 0)
3163     - return -EINVAL;
3164     - if (count == 0 || count > 1024)
3165     - return 0;
3166     - if (*offset != 0)
3167     - return 0;
3168     -
3169     - page = (unsigned char *)__get_free_page(GFP_KERNEL);
3170     - if (!page)
3171     - return -ENOMEM;
3172     + char lbuf[20];
3173    
3174     value = readl(address);
3175     - len = sprintf(page, "%d\n", value);
3176     -
3177     - if (copy_to_user(buf, page, len)) {
3178     - retval = -EFAULT;
3179     - goto exit;
3180     - }
3181     - *offset += len;
3182     - retval = len;
3183     + len = snprintf(lbuf, sizeof(lbuf), "%d\n", value);
3184    
3185     -exit:
3186     - free_page((unsigned long)page);
3187     - return retval;
3188     + return simple_read_from_buffer(buf, count, offset, lbuf, len);
3189     }
3190    
3191     static ssize_t remote_settings_file_write(struct file *file, const char __user *ubuff, size_t count, loff_t *offset)
3192     diff --git a/drivers/misc/mei/interrupt.c b/drivers/misc/mei/interrupt.c
3193     index b0b8f18a85e3..6649f0d56d2f 100644
3194     --- a/drivers/misc/mei/interrupt.c
3195     +++ b/drivers/misc/mei/interrupt.c
3196     @@ -310,8 +310,11 @@ int mei_irq_read_handler(struct mei_device *dev,
3197     if (&cl->link == &dev->file_list) {
3198     /* A message for not connected fixed address clients
3199     * should be silently discarded
3200     + * On power down client may be force cleaned,
3201     + * silently discard such messages
3202     */
3203     - if (hdr_is_fixed(mei_hdr)) {
3204     + if (hdr_is_fixed(mei_hdr) ||
3205     + dev->dev_state == MEI_DEV_POWER_DOWN) {
3206     mei_irq_discard_msg(dev, mei_hdr);
3207     ret = 0;
3208     goto reset_slots;
3209     diff --git a/drivers/misc/vmw_balloon.c b/drivers/misc/vmw_balloon.c
3210     index efd733472a35..56c6f79a5c5a 100644
3211     --- a/drivers/misc/vmw_balloon.c
3212     +++ b/drivers/misc/vmw_balloon.c
3213     @@ -467,7 +467,7 @@ static int vmballoon_send_batched_lock(struct vmballoon *b,
3214     unsigned int num_pages, bool is_2m_pages, unsigned int *target)
3215     {
3216     unsigned long status;
3217     - unsigned long pfn = page_to_pfn(b->page);
3218     + unsigned long pfn = PHYS_PFN(virt_to_phys(b->batch_page));
3219    
3220     STATS_INC(b->stats.lock[is_2m_pages]);
3221    
3222     @@ -515,7 +515,7 @@ static bool vmballoon_send_batched_unlock(struct vmballoon *b,
3223     unsigned int num_pages, bool is_2m_pages, unsigned int *target)
3224     {
3225     unsigned long status;
3226     - unsigned long pfn = page_to_pfn(b->page);
3227     + unsigned long pfn = PHYS_PFN(virt_to_phys(b->batch_page));
3228    
3229     STATS_INC(b->stats.unlock[is_2m_pages]);
3230    
3231     diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
3232     index 29a1afa81f66..3ee8f57fd612 100644
3233     --- a/drivers/mmc/host/dw_mmc.c
3234     +++ b/drivers/mmc/host/dw_mmc.c
3235     @@ -1065,8 +1065,8 @@ static void dw_mci_ctrl_thld(struct dw_mci *host, struct mmc_data *data)
3236     * It's used when HS400 mode is enabled.
3237     */
3238     if (data->flags & MMC_DATA_WRITE &&
3239     - !(host->timing != MMC_TIMING_MMC_HS400))
3240     - return;
3241     + host->timing != MMC_TIMING_MMC_HS400)
3242     + goto disable;
3243    
3244     if (data->flags & MMC_DATA_WRITE)
3245     enable = SDMMC_CARD_WR_THR_EN;
3246     @@ -1074,7 +1074,8 @@ static void dw_mci_ctrl_thld(struct dw_mci *host, struct mmc_data *data)
3247     enable = SDMMC_CARD_RD_THR_EN;
3248    
3249     if (host->timing != MMC_TIMING_MMC_HS200 &&
3250     - host->timing != MMC_TIMING_UHS_SDR104)
3251     + host->timing != MMC_TIMING_UHS_SDR104 &&
3252     + host->timing != MMC_TIMING_MMC_HS400)
3253     goto disable;
3254    
3255     blksz_depth = blksz / (1 << host->data_shift);
3256     diff --git a/drivers/mmc/host/renesas_sdhi_internal_dmac.c b/drivers/mmc/host/renesas_sdhi_internal_dmac.c
3257     index eb027cdc8f24..8d19b5903fd1 100644
3258     --- a/drivers/mmc/host/renesas_sdhi_internal_dmac.c
3259     +++ b/drivers/mmc/host/renesas_sdhi_internal_dmac.c
3260     @@ -139,8 +139,7 @@ renesas_sdhi_internal_dmac_abort_dma(struct tmio_mmc_host *host) {
3261     renesas_sdhi_internal_dmac_dm_write(host, DM_CM_RST,
3262     RST_RESERVED_BITS | val);
3263    
3264     - if (host->data && host->data->flags & MMC_DATA_READ)
3265     - clear_bit(SDHI_INTERNAL_DMAC_RX_IN_USE, &global_flags);
3266     + clear_bit(SDHI_INTERNAL_DMAC_RX_IN_USE, &global_flags);
3267    
3268     renesas_sdhi_internal_dmac_enable_dma(host, true);
3269     }
3270     diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
3271     index cd2b5f643a15..6891be4ff9f1 100644
3272     --- a/drivers/mmc/host/sdhci-esdhc-imx.c
3273     +++ b/drivers/mmc/host/sdhci-esdhc-imx.c
3274     @@ -306,6 +306,15 @@ static u32 esdhc_readl_le(struct sdhci_host *host, int reg)
3275    
3276     if (imx_data->socdata->flags & ESDHC_FLAG_HS400)
3277     val |= SDHCI_SUPPORT_HS400;
3278     +
3279     + /*
3280     + * Do not advertise faster UHS modes if there are no
3281     + * pinctrl states for 100MHz/200MHz.
3282     + */
3283     + if (IS_ERR_OR_NULL(imx_data->pins_100mhz) ||
3284     + IS_ERR_OR_NULL(imx_data->pins_200mhz))
3285     + val &= ~(SDHCI_SUPPORT_SDR50 | SDHCI_SUPPORT_DDR50
3286     + | SDHCI_SUPPORT_SDR104 | SDHCI_SUPPORT_HS400);
3287     }
3288     }
3289    
3290     @@ -1136,18 +1145,6 @@ sdhci_esdhc_imx_probe_dt(struct platform_device *pdev,
3291     ESDHC_PINCTRL_STATE_100MHZ);
3292     imx_data->pins_200mhz = pinctrl_lookup_state(imx_data->pinctrl,
3293     ESDHC_PINCTRL_STATE_200MHZ);
3294     - if (IS_ERR(imx_data->pins_100mhz) ||
3295     - IS_ERR(imx_data->pins_200mhz)) {
3296     - dev_warn(mmc_dev(host->mmc),
3297     - "could not get ultra high speed state, work on normal mode\n");
3298     - /*
3299     - * fall back to not supporting uhs by specifying no
3300     - * 1.8v quirk
3301     - */
3302     - host->quirks2 |= SDHCI_QUIRK2_NO_1_8_V;
3303     - }
3304     - } else {
3305     - host->quirks2 |= SDHCI_QUIRK2_NO_1_8_V;
3306     }
3307    
3308     /* call to generic mmc_of_parse to support additional capabilities */
3309     diff --git a/drivers/mtd/spi-nor/cadence-quadspi.c b/drivers/mtd/spi-nor/cadence-quadspi.c
3310     index 5872f31eaa60..5cf9ef6cf259 100644
3311     --- a/drivers/mtd/spi-nor/cadence-quadspi.c
3312     +++ b/drivers/mtd/spi-nor/cadence-quadspi.c
3313     @@ -920,10 +920,12 @@ static ssize_t cqspi_write(struct spi_nor *nor, loff_t to,
3314     if (ret)
3315     return ret;
3316    
3317     - if (f_pdata->use_direct_mode)
3318     + if (f_pdata->use_direct_mode) {
3319     memcpy_toio(cqspi->ahb_base + to, buf, len);
3320     - else
3321     + ret = cqspi_wait_idle(cqspi);
3322     + } else {
3323     ret = cqspi_indirect_write_execute(nor, to, buf, len);
3324     + }
3325     if (ret)
3326     return ret;
3327    
3328     diff --git a/drivers/staging/rtl8723bs/core/rtw_ap.c b/drivers/staging/rtl8723bs/core/rtw_ap.c
3329     index 0b530ea7fd81..4b39b7ddf506 100644
3330     --- a/drivers/staging/rtl8723bs/core/rtw_ap.c
3331     +++ b/drivers/staging/rtl8723bs/core/rtw_ap.c
3332     @@ -1059,7 +1059,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len)
3333     return _FAIL;
3334    
3335    
3336     - if (len > MAX_IE_SZ)
3337     + if (len < 0 || len > MAX_IE_SZ)
3338     return _FAIL;
3339    
3340     pbss_network->IELength = len;
3341     diff --git a/drivers/staging/rtlwifi/rtl8822be/hw.c b/drivers/staging/rtlwifi/rtl8822be/hw.c
3342     index 74386003044f..c6db2bd20594 100644
3343     --- a/drivers/staging/rtlwifi/rtl8822be/hw.c
3344     +++ b/drivers/staging/rtlwifi/rtl8822be/hw.c
3345     @@ -814,7 +814,7 @@ static void _rtl8822be_enable_aspm_back_door(struct ieee80211_hw *hw)
3346     return;
3347    
3348     pci_read_config_byte(rtlpci->pdev, 0x70f, &tmp);
3349     - pci_write_config_byte(rtlpci->pdev, 0x70f, tmp | BIT(7));
3350     + pci_write_config_byte(rtlpci->pdev, 0x70f, tmp | ASPM_L1_LATENCY << 3);
3351    
3352     pci_read_config_byte(rtlpci->pdev, 0x719, &tmp);
3353     pci_write_config_byte(rtlpci->pdev, 0x719, tmp | BIT(3) | BIT(4));
3354     diff --git a/drivers/staging/rtlwifi/wifi.h b/drivers/staging/rtlwifi/wifi.h
3355     index a23bb1719e35..0ab1e2d50535 100644
3356     --- a/drivers/staging/rtlwifi/wifi.h
3357     +++ b/drivers/staging/rtlwifi/wifi.h
3358     @@ -99,6 +99,7 @@
3359     #define RTL_USB_MAX_RX_COUNT 100
3360     #define QBSS_LOAD_SIZE 5
3361     #define MAX_WMMELE_LENGTH 64
3362     +#define ASPM_L1_LATENCY 7
3363    
3364     #define TOTAL_CAM_ENTRY 32
3365    
3366     diff --git a/drivers/thunderbolt/domain.c b/drivers/thunderbolt/domain.c
3367     index 6281266b8ec0..a923ebdeb73c 100644
3368     --- a/drivers/thunderbolt/domain.c
3369     +++ b/drivers/thunderbolt/domain.c
3370     @@ -213,6 +213,10 @@ static ssize_t boot_acl_store(struct device *dev, struct device_attribute *attr,
3371     goto err_free_acl;
3372     }
3373     ret = tb->cm_ops->set_boot_acl(tb, acl, tb->nboot_acl);
3374     + if (!ret) {
3375     + /* Notify userspace about the change */
3376     + kobject_uevent(&tb->dev.kobj, KOBJ_CHANGE);
3377     + }
3378     mutex_unlock(&tb->lock);
3379    
3380     err_free_acl:
3381     diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
3382     index c55def2f1320..097057d2eacf 100644
3383     --- a/drivers/usb/core/quirks.c
3384     +++ b/drivers/usb/core/quirks.c
3385     @@ -378,6 +378,10 @@ static const struct usb_device_id usb_quirk_list[] = {
3386     /* Corsair K70 RGB */
3387     { USB_DEVICE(0x1b1c, 0x1b13), .driver_info = USB_QUIRK_DELAY_INIT },
3388    
3389     + /* Corsair Strafe */
3390     + { USB_DEVICE(0x1b1c, 0x1b15), .driver_info = USB_QUIRK_DELAY_INIT |
3391     + USB_QUIRK_DELAY_CTRL_MSG },
3392     +
3393     /* Corsair Strafe RGB */
3394     { USB_DEVICE(0x1b1c, 0x1b20), .driver_info = USB_QUIRK_DELAY_INIT |
3395     USB_QUIRK_DELAY_CTRL_MSG },
3396     diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
3397     index 99e7547f234f..0b424a4b58ec 100644
3398     --- a/drivers/usb/host/xhci-mem.c
3399     +++ b/drivers/usb/host/xhci-mem.c
3400     @@ -591,7 +591,7 @@ struct xhci_ring *xhci_stream_id_to_ring(
3401     if (!ep->stream_info)
3402     return NULL;
3403    
3404     - if (stream_id > ep->stream_info->num_streams)
3405     + if (stream_id >= ep->stream_info->num_streams)
3406     return NULL;
3407     return ep->stream_info->stream_rings[stream_id];
3408     }
3409     diff --git a/drivers/usb/misc/yurex.c b/drivers/usb/misc/yurex.c
3410     index 8abb6cbbd98a..3be40eaa1ac9 100644
3411     --- a/drivers/usb/misc/yurex.c
3412     +++ b/drivers/usb/misc/yurex.c
3413     @@ -396,8 +396,7 @@ static ssize_t yurex_read(struct file *file, char __user *buffer, size_t count,
3414     loff_t *ppos)
3415     {
3416     struct usb_yurex *dev;
3417     - int retval = 0;
3418     - int bytes_read = 0;
3419     + int len = 0;
3420     char in_buffer[20];
3421     unsigned long flags;
3422    
3423     @@ -405,26 +404,16 @@ static ssize_t yurex_read(struct file *file, char __user *buffer, size_t count,
3424    
3425     mutex_lock(&dev->io_mutex);
3426     if (!dev->interface) { /* already disconnected */
3427     - retval = -ENODEV;
3428     - goto exit;
3429     + mutex_unlock(&dev->io_mutex);
3430     + return -ENODEV;
3431     }
3432    
3433     spin_lock_irqsave(&dev->lock, flags);
3434     - bytes_read = snprintf(in_buffer, 20, "%lld\n", dev->bbu);
3435     + len = snprintf(in_buffer, 20, "%lld\n", dev->bbu);
3436     spin_unlock_irqrestore(&dev->lock, flags);
3437     -
3438     - if (*ppos < bytes_read) {
3439     - if (copy_to_user(buffer, in_buffer + *ppos, bytes_read - *ppos))
3440     - retval = -EFAULT;
3441     - else {
3442     - retval = bytes_read - *ppos;
3443     - *ppos += bytes_read;
3444     - }
3445     - }
3446     -
3447     -exit:
3448     mutex_unlock(&dev->io_mutex);
3449     - return retval;
3450     +
3451     + return simple_read_from_buffer(buffer, count, ppos, in_buffer, len);
3452     }
3453    
3454     static ssize_t yurex_write(struct file *file, const char __user *user_buffer,
3455     diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c
3456     index bdd7a5ad3bf1..3bb1fff02bed 100644
3457     --- a/drivers/usb/serial/ch341.c
3458     +++ b/drivers/usb/serial/ch341.c
3459     @@ -128,7 +128,7 @@ static int ch341_control_in(struct usb_device *dev,
3460     r = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), request,
3461     USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN,
3462     value, index, buf, bufsize, DEFAULT_TIMEOUT);
3463     - if (r < bufsize) {
3464     + if (r < (int)bufsize) {
3465     if (r >= 0) {
3466     dev_err(&dev->dev,
3467     "short control message received (%d < %u)\n",
3468     diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
3469     index ee0cc1d90b51..626a29d9aa58 100644
3470     --- a/drivers/usb/serial/cp210x.c
3471     +++ b/drivers/usb/serial/cp210x.c
3472     @@ -149,6 +149,7 @@ static const struct usb_device_id id_table[] = {
3473     { USB_DEVICE(0x10C4, 0x8977) }, /* CEL MeshWorks DevKit Device */
3474     { USB_DEVICE(0x10C4, 0x8998) }, /* KCF Technologies PRN */
3475     { USB_DEVICE(0x10C4, 0x89A4) }, /* CESINEL FTBC Flexible Thyristor Bridge Controller */
3476     + { USB_DEVICE(0x10C4, 0x89FB) }, /* Qivicon ZigBee USB Radio Stick */
3477     { USB_DEVICE(0x10C4, 0x8A2A) }, /* HubZ dual ZigBee and Z-Wave dongle */
3478     { USB_DEVICE(0x10C4, 0x8A5E) }, /* CEL EM3588 ZigBee USB Stick Long Range */
3479     { USB_DEVICE(0x10C4, 0x8B34) }, /* Qivicon ZigBee USB Radio Stick */
3480     diff --git a/drivers/usb/serial/keyspan_pda.c b/drivers/usb/serial/keyspan_pda.c
3481     index 5169624d8b11..38d43c4b7ce5 100644
3482     --- a/drivers/usb/serial/keyspan_pda.c
3483     +++ b/drivers/usb/serial/keyspan_pda.c
3484     @@ -369,8 +369,10 @@ static int keyspan_pda_get_modem_info(struct usb_serial *serial,
3485     3, /* get pins */
3486     USB_TYPE_VENDOR|USB_RECIP_INTERFACE|USB_DIR_IN,
3487     0, 0, data, 1, 2000);
3488     - if (rc >= 0)
3489     + if (rc == 1)
3490     *value = *data;
3491     + else if (rc >= 0)
3492     + rc = -EIO;
3493    
3494     kfree(data);
3495     return rc;
3496     diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
3497     index fdceb46d9fc6..b580b4c7fa48 100644
3498     --- a/drivers/usb/serial/mos7840.c
3499     +++ b/drivers/usb/serial/mos7840.c
3500     @@ -468,6 +468,9 @@ static void mos7840_control_callback(struct urb *urb)
3501     }
3502    
3503     dev_dbg(dev, "%s urb buffer size is %d\n", __func__, urb->actual_length);
3504     + if (urb->actual_length < 1)
3505     + goto out;
3506     +
3507     dev_dbg(dev, "%s mos7840_port->MsrLsr is %d port %d\n", __func__,
3508     mos7840_port->MsrLsr, mos7840_port->port_num);
3509     data = urb->transfer_buffer;
3510     diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
3511     index 4ad6f669fe34..39d3a724a4b4 100644
3512     --- a/fs/binfmt_elf.c
3513     +++ b/fs/binfmt_elf.c
3514     @@ -1259,9 +1259,8 @@ static int load_elf_library(struct file *file)
3515     goto out_free_ph;
3516     }
3517    
3518     - len = ELF_PAGESTART(eppnt->p_filesz + eppnt->p_vaddr +
3519     - ELF_MIN_ALIGN - 1);
3520     - bss = eppnt->p_memsz + eppnt->p_vaddr;
3521     + len = ELF_PAGEALIGN(eppnt->p_filesz + eppnt->p_vaddr);
3522     + bss = ELF_PAGEALIGN(eppnt->p_memsz + eppnt->p_vaddr);
3523     if (bss > len) {
3524     error = vm_brk(len, bss - len);
3525     if (error)
3526     diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
3527     index 1df7f10476d6..20149b8771d9 100644
3528     --- a/fs/f2fs/f2fs.h
3529     +++ b/fs/f2fs/f2fs.h
3530     @@ -1586,18 +1586,6 @@ static inline bool __exist_node_summaries(struct f2fs_sb_info *sbi)
3531     is_set_ckpt_flags(sbi, CP_FASTBOOT_FLAG));
3532     }
3533    
3534     -/*
3535     - * Check whether the given nid is within node id range.
3536     - */
3537     -static inline int check_nid_range(struct f2fs_sb_info *sbi, nid_t nid)
3538     -{
3539     - if (unlikely(nid < F2FS_ROOT_INO(sbi)))
3540     - return -EINVAL;
3541     - if (unlikely(nid >= NM_I(sbi)->max_nid))
3542     - return -EINVAL;
3543     - return 0;
3544     -}
3545     -
3546     /*
3547     * Check whether the inode has blocks or not
3548     */
3549     @@ -2720,6 +2708,7 @@ f2fs_hash_t f2fs_dentry_hash(const struct qstr *name_info,
3550     struct dnode_of_data;
3551     struct node_info;
3552    
3553     +int check_nid_range(struct f2fs_sb_info *sbi, nid_t nid);
3554     bool available_free_memory(struct f2fs_sb_info *sbi, int type);
3555     int need_dentry_mark(struct f2fs_sb_info *sbi, nid_t nid);
3556     bool is_checkpointed_node(struct f2fs_sb_info *sbi, nid_t nid);
3557     diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c
3558     index f8ef04c9f69d..3d91bea4ec90 100644
3559     --- a/fs/f2fs/inode.c
3560     +++ b/fs/f2fs/inode.c
3561     @@ -185,6 +185,21 @@ void f2fs_inode_chksum_set(struct f2fs_sb_info *sbi, struct page *page)
3562     ri->i_inode_checksum = cpu_to_le32(f2fs_inode_chksum(sbi, page));
3563     }
3564    
3565     +static bool sanity_check_inode(struct inode *inode)
3566     +{
3567     + struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
3568     +
3569     + if (f2fs_sb_has_flexible_inline_xattr(sbi->sb)
3570     + && !f2fs_has_extra_attr(inode)) {
3571     + set_sbi_flag(sbi, SBI_NEED_FSCK);
3572     + f2fs_msg(sbi->sb, KERN_WARNING,
3573     + "%s: corrupted inode ino=%lx, run fsck to fix.",
3574     + __func__, inode->i_ino);
3575     + return false;
3576     + }
3577     + return true;
3578     +}
3579     +
3580     static int do_read_inode(struct inode *inode)
3581     {
3582     struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
3583     @@ -194,12 +209,8 @@ static int do_read_inode(struct inode *inode)
3584     projid_t i_projid;
3585    
3586     /* Check if ino is within scope */
3587     - if (check_nid_range(sbi, inode->i_ino)) {
3588     - f2fs_msg(inode->i_sb, KERN_ERR, "bad inode number: %lu",
3589     - (unsigned long) inode->i_ino);
3590     - WARN_ON(1);
3591     + if (check_nid_range(sbi, inode->i_ino))
3592     return -EINVAL;
3593     - }
3594    
3595     node_page = get_node_page(sbi, inode->i_ino);
3596     if (IS_ERR(node_page))
3597     @@ -239,7 +250,6 @@ static int do_read_inode(struct inode *inode)
3598     le16_to_cpu(ri->i_extra_isize) : 0;
3599    
3600     if (f2fs_sb_has_flexible_inline_xattr(sbi->sb)) {
3601     - f2fs_bug_on(sbi, !f2fs_has_extra_attr(inode));
3602     fi->i_inline_xattr_size = le16_to_cpu(ri->i_inline_xattr_size);
3603     } else if (f2fs_has_inline_xattr(inode) ||
3604     f2fs_has_inline_dentry(inode)) {
3605     @@ -317,6 +327,10 @@ struct inode *f2fs_iget(struct super_block *sb, unsigned long ino)
3606     ret = do_read_inode(inode);
3607     if (ret)
3608     goto bad_inode;
3609     + if (!sanity_check_inode(inode)) {
3610     + ret = -EINVAL;
3611     + goto bad_inode;
3612     + }
3613     make_now:
3614     if (ino == F2FS_NODE_INO(sbi)) {
3615     inode->i_mapping->a_ops = &f2fs_node_aops;
3616     @@ -588,8 +602,11 @@ void f2fs_evict_inode(struct inode *inode)
3617     alloc_nid_failed(sbi, inode->i_ino);
3618     clear_inode_flag(inode, FI_FREE_NID);
3619     } else {
3620     - f2fs_bug_on(sbi, err &&
3621     - !exist_written_data(sbi, inode->i_ino, ORPHAN_INO));
3622     + /*
3623     + * If xattr nid is corrupted, we can reach out error condition,
3624     + * err & !exist_written_data(sbi, inode->i_ino, ORPHAN_INO)).
3625     + * In that case, check_nid_range() is enough to give a clue.
3626     + */
3627     }
3628     out_clear:
3629     fscrypt_put_encryption_info(inode);
3630     diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
3631     index f202398e20ea..de48222f48e3 100644
3632     --- a/fs/f2fs/node.c
3633     +++ b/fs/f2fs/node.c
3634     @@ -29,6 +29,21 @@ static struct kmem_cache *nat_entry_slab;
3635     static struct kmem_cache *free_nid_slab;
3636     static struct kmem_cache *nat_entry_set_slab;
3637    
3638     +/*
3639     + * Check whether the given nid is within node id range.
3640     + */
3641     +int check_nid_range(struct f2fs_sb_info *sbi, nid_t nid)
3642     +{
3643     + if (unlikely(nid < F2FS_ROOT_INO(sbi) || nid >= NM_I(sbi)->max_nid)) {
3644     + set_sbi_flag(sbi, SBI_NEED_FSCK);
3645     + f2fs_msg(sbi->sb, KERN_WARNING,
3646     + "%s: out-of-range nid=%x, run fsck to fix.",
3647     + __func__, nid);
3648     + return -EINVAL;
3649     + }
3650     + return 0;
3651     +}
3652     +
3653     bool available_free_memory(struct f2fs_sb_info *sbi, int type)
3654     {
3655     struct f2fs_nm_info *nm_i = NM_I(sbi);
3656     @@ -1158,7 +1173,8 @@ void ra_node_page(struct f2fs_sb_info *sbi, nid_t nid)
3657    
3658     if (!nid)
3659     return;
3660     - f2fs_bug_on(sbi, check_nid_range(sbi, nid));
3661     + if (check_nid_range(sbi, nid))
3662     + return;
3663    
3664     rcu_read_lock();
3665     apage = radix_tree_lookup(&NODE_MAPPING(sbi)->i_pages, nid);
3666     @@ -1182,7 +1198,8 @@ static struct page *__get_node_page(struct f2fs_sb_info *sbi, pgoff_t nid,
3667    
3668     if (!nid)
3669     return ERR_PTR(-ENOENT);
3670     - f2fs_bug_on(sbi, check_nid_range(sbi, nid));
3671     + if (check_nid_range(sbi, nid))
3672     + return ERR_PTR(-EINVAL);
3673     repeat:
3674     page = f2fs_grab_cache_page(NODE_MAPPING(sbi), nid, false);
3675     if (!page)
3676     diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
3677     index be8d1b16b8d1..cffaf842f4e7 100644
3678     --- a/fs/f2fs/segment.c
3679     +++ b/fs/f2fs/segment.c
3680     @@ -3600,6 +3600,7 @@ static int build_sit_entries(struct f2fs_sb_info *sbi)
3681     unsigned int i, start, end;
3682     unsigned int readed, start_blk = 0;
3683     int err = 0;
3684     + block_t total_node_blocks = 0;
3685    
3686     do {
3687     readed = ra_meta_pages(sbi, start_blk, BIO_MAX_PAGES,
3688     @@ -3622,6 +3623,8 @@ static int build_sit_entries(struct f2fs_sb_info *sbi)
3689     if (err)
3690     return err;
3691     seg_info_from_raw_sit(se, &sit);
3692     + if (IS_NODESEG(se->type))
3693     + total_node_blocks += se->valid_blocks;
3694    
3695     /* build discard map only one time */
3696     if (f2fs_discard_en(sbi)) {
3697     @@ -3650,15 +3653,28 @@ static int build_sit_entries(struct f2fs_sb_info *sbi)
3698     unsigned int old_valid_blocks;
3699    
3700     start = le32_to_cpu(segno_in_journal(journal, i));
3701     + if (start >= MAIN_SEGS(sbi)) {
3702     + f2fs_msg(sbi->sb, KERN_ERR,
3703     + "Wrong journal entry on segno %u",
3704     + start);
3705     + set_sbi_flag(sbi, SBI_NEED_FSCK);
3706     + err = -EINVAL;
3707     + break;
3708     + }
3709     +
3710     se = &sit_i->sentries[start];
3711     sit = sit_in_journal(journal, i);
3712    
3713     old_valid_blocks = se->valid_blocks;
3714     + if (IS_NODESEG(se->type))
3715     + total_node_blocks -= old_valid_blocks;
3716    
3717     err = check_block_count(sbi, start, &sit);
3718     if (err)
3719     break;
3720     seg_info_from_raw_sit(se, &sit);
3721     + if (IS_NODESEG(se->type))
3722     + total_node_blocks += se->valid_blocks;
3723    
3724     if (f2fs_discard_en(sbi)) {
3725     if (is_set_ckpt_flags(sbi, CP_TRIMMED_FLAG)) {
3726     @@ -3677,6 +3693,15 @@ static int build_sit_entries(struct f2fs_sb_info *sbi)
3727     se->valid_blocks - old_valid_blocks;
3728     }
3729     up_read(&curseg->journal_rwsem);
3730     +
3731     + if (!err && total_node_blocks != valid_node_count(sbi)) {
3732     + f2fs_msg(sbi->sb, KERN_ERR,
3733     + "SIT is corrupted node# %u vs %u",
3734     + total_node_blocks, valid_node_count(sbi));
3735     + set_sbi_flag(sbi, SBI_NEED_FSCK);
3736     + err = -EINVAL;
3737     + }
3738     +
3739     return err;
3740     }
3741    
3742     diff --git a/fs/inode.c b/fs/inode.c
3743     index 3b55391072f3..6c6fef8c7c27 100644
3744     --- a/fs/inode.c
3745     +++ b/fs/inode.c
3746     @@ -2013,8 +2013,14 @@ void inode_init_owner(struct inode *inode, const struct inode *dir,
3747     inode->i_uid = current_fsuid();
3748     if (dir && dir->i_mode & S_ISGID) {
3749     inode->i_gid = dir->i_gid;
3750     +
3751     + /* Directories are special, and always inherit S_ISGID */
3752     if (S_ISDIR(mode))
3753     mode |= S_ISGID;
3754     + else if ((mode & (S_ISGID | S_IXGRP)) == (S_ISGID | S_IXGRP) &&
3755     + !in_group_p(inode->i_gid) &&
3756     + !capable_wrt_inode_uidgid(dir, CAP_FSETID))
3757     + mode &= ~S_ISGID;
3758     } else
3759     inode->i_gid = current_fsgid();
3760     inode->i_mode = mode;
3761     diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
3762     index c486ad4b43f0..b0abfe02beab 100644
3763     --- a/fs/proc/task_mmu.c
3764     +++ b/fs/proc/task_mmu.c
3765     @@ -831,7 +831,8 @@ static int show_smap(struct seq_file *m, void *v, int is_pid)
3766     SEQ_PUT_DEC(" kB\nSwap: ", mss->swap);
3767     SEQ_PUT_DEC(" kB\nSwapPss: ",
3768     mss->swap_pss >> PSS_SHIFT);
3769     - SEQ_PUT_DEC(" kB\nLocked: ", mss->pss >> PSS_SHIFT);
3770     + SEQ_PUT_DEC(" kB\nLocked: ",
3771     + mss->pss_locked >> PSS_SHIFT);
3772     seq_puts(m, " kB\n");
3773     }
3774     if (!rollup_mode) {
3775     diff --git a/fs/xfs/libxfs/xfs_ialloc_btree.c b/fs/xfs/libxfs/xfs_ialloc_btree.c
3776     index 367e9a0726e6..ead8c4842c29 100644
3777     --- a/fs/xfs/libxfs/xfs_ialloc_btree.c
3778     +++ b/fs/xfs/libxfs/xfs_ialloc_btree.c
3779     @@ -296,7 +296,7 @@ xfs_inobt_verify(
3780     case cpu_to_be32(XFS_FIBT_MAGIC):
3781     break;
3782     default:
3783     - return NULL;
3784     + return __this_address;
3785     }
3786    
3787     /* level verification */
3788     diff --git a/include/linux/libata.h b/include/linux/libata.h
3789     index 1795fecdea17..6fed495af95c 100644
3790     --- a/include/linux/libata.h
3791     +++ b/include/linux/libata.h
3792     @@ -211,6 +211,7 @@ enum {
3793     ATA_FLAG_SLAVE_POSS = (1 << 0), /* host supports slave dev */
3794     /* (doesn't imply presence) */
3795     ATA_FLAG_SATA = (1 << 1),
3796     + ATA_FLAG_NO_LPM = (1 << 2), /* host not happy with LPM */
3797     ATA_FLAG_NO_LOG_PAGE = (1 << 5), /* do not issue log page read */
3798     ATA_FLAG_NO_ATAPI = (1 << 6), /* No ATAPI support */
3799     ATA_FLAG_PIO_DMA = (1 << 7), /* PIO cmds via DMA */
3800     diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
3801     index 1904e814f282..56212edd6f23 100644
3802     --- a/kernel/bpf/verifier.c
3803     +++ b/kernel/bpf/verifier.c
3804     @@ -1610,6 +1610,30 @@ static int get_callee_stack_depth(struct bpf_verifier_env *env,
3805     }
3806     #endif
3807    
3808     +static int check_ctx_reg(struct bpf_verifier_env *env,
3809     + const struct bpf_reg_state *reg, int regno)
3810     +{
3811     + /* Access to ctx or passing it to a helper is only allowed in
3812     + * its original, unmodified form.
3813     + */
3814     +
3815     + if (reg->off) {
3816     + verbose(env, "dereference of modified ctx ptr R%d off=%d disallowed\n",
3817     + regno, reg->off);
3818     + return -EACCES;
3819     + }
3820     +
3821     + if (!tnum_is_const(reg->var_off) || reg->var_off.value) {
3822     + char tn_buf[48];
3823     +
3824     + tnum_strn(tn_buf, sizeof(tn_buf), reg->var_off);
3825     + verbose(env, "variable ctx access var_off=%s disallowed\n", tn_buf);
3826     + return -EACCES;
3827     + }
3828     +
3829     + return 0;
3830     +}
3831     +
3832     /* truncate register to smaller size (in bytes)
3833     * must be called with size < BPF_REG_SIZE
3834     */
3835     @@ -1679,24 +1703,11 @@ static int check_mem_access(struct bpf_verifier_env *env, int insn_idx, u32 regn
3836     verbose(env, "R%d leaks addr into ctx\n", value_regno);
3837     return -EACCES;
3838     }
3839     - /* ctx accesses must be at a fixed offset, so that we can
3840     - * determine what type of data were returned.
3841     - */
3842     - if (reg->off) {
3843     - verbose(env,
3844     - "dereference of modified ctx ptr R%d off=%d+%d, ctx+const is allowed, ctx+const+const is not\n",
3845     - regno, reg->off, off - reg->off);
3846     - return -EACCES;
3847     - }
3848     - if (!tnum_is_const(reg->var_off) || reg->var_off.value) {
3849     - char tn_buf[48];
3850    
3851     - tnum_strn(tn_buf, sizeof(tn_buf), reg->var_off);
3852     - verbose(env,
3853     - "variable ctx access var_off=%s off=%d size=%d",
3854     - tn_buf, off, size);
3855     - return -EACCES;
3856     - }
3857     + err = check_ctx_reg(env, reg, regno);
3858     + if (err < 0)
3859     + return err;
3860     +
3861     err = check_ctx_access(env, insn_idx, off, size, t, &reg_type);
3862     if (!err && t == BPF_READ && value_regno >= 0) {
3863     /* ctx access returns either a scalar, or a
3864     @@ -1977,6 +1988,9 @@ static int check_func_arg(struct bpf_verifier_env *env, u32 regno,
3865     expected_type = PTR_TO_CTX;
3866     if (type != expected_type)
3867     goto err_type;
3868     + err = check_ctx_reg(env, reg, regno);
3869     + if (err < 0)
3870     + return err;
3871     } else if (arg_type_is_mem_ptr(arg_type)) {
3872     expected_type = PTR_TO_STACK;
3873     /* One exception here. In case function allows for NULL to be
3874     diff --git a/kernel/power/user.c b/kernel/power/user.c
3875     index 75c959de4b29..abd225550271 100644
3876     --- a/kernel/power/user.c
3877     +++ b/kernel/power/user.c
3878     @@ -186,6 +186,11 @@ static ssize_t snapshot_write(struct file *filp, const char __user *buf,
3879     res = PAGE_SIZE - pg_offp;
3880     }
3881    
3882     + if (!data_of(data->handle)) {
3883     + res = -EINVAL;
3884     + goto unlock;
3885     + }
3886     +
3887     res = simple_write_to_buffer(data_of(data->handle), res, &pg_offp,
3888     buf, count);
3889     if (res > 0)
3890     diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
3891     index bcd93031d042..4e67d0020337 100644
3892     --- a/kernel/trace/trace.c
3893     +++ b/kernel/trace/trace.c
3894     @@ -3363,8 +3363,8 @@ static void print_func_help_header(struct trace_buffer *buf, struct seq_file *m,
3895    
3896     print_event_info(buf, m);
3897    
3898     - seq_printf(m, "# TASK-PID CPU# %s TIMESTAMP FUNCTION\n", tgid ? "TGID " : "");
3899     - seq_printf(m, "# | | | %s | |\n", tgid ? " | " : "");
3900     + seq_printf(m, "# TASK-PID %s CPU# TIMESTAMP FUNCTION\n", tgid ? "TGID " : "");
3901     + seq_printf(m, "# | | %s | | |\n", tgid ? " | " : "");
3902     }
3903    
3904     static void print_func_help_header_irq(struct trace_buffer *buf, struct seq_file *m,
3905     @@ -3384,9 +3384,9 @@ static void print_func_help_header_irq(struct trace_buffer *buf, struct seq_file
3906     tgid ? tgid_space : space);
3907     seq_printf(m, "# %s||| / delay\n",
3908     tgid ? tgid_space : space);
3909     - seq_printf(m, "# TASK-PID CPU#%s|||| TIMESTAMP FUNCTION\n",
3910     + seq_printf(m, "# TASK-PID %sCPU# |||| TIMESTAMP FUNCTION\n",
3911     tgid ? " TGID " : space);
3912     - seq_printf(m, "# | | | %s|||| | |\n",
3913     + seq_printf(m, "# | | %s | |||| | |\n",
3914     tgid ? " | " : space);
3915     }
3916    
3917     diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
3918     index 02aed76e0978..eebc7c92f6d0 100644
3919     --- a/kernel/trace/trace_kprobe.c
3920     +++ b/kernel/trace/trace_kprobe.c
3921     @@ -1451,8 +1451,10 @@ create_local_trace_kprobe(char *func, void *addr, unsigned long offs,
3922     }
3923    
3924     ret = __register_trace_kprobe(tk);
3925     - if (ret < 0)
3926     + if (ret < 0) {
3927     + kfree(tk->tp.call.print_fmt);
3928     goto error;
3929     + }
3930    
3931     return &tk->tp.call;
3932     error:
3933     @@ -1472,6 +1474,8 @@ void destroy_local_trace_kprobe(struct trace_event_call *event_call)
3934     }
3935    
3936     __unregister_trace_kprobe(tk);
3937     +
3938     + kfree(tk->tp.call.print_fmt);
3939     free_trace_kprobe(tk);
3940     }
3941     #endif /* CONFIG_PERF_EVENTS */
3942     diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c
3943     index 90db994ac900..1c8e30fda46a 100644
3944     --- a/kernel/trace/trace_output.c
3945     +++ b/kernel/trace/trace_output.c
3946     @@ -594,8 +594,7 @@ int trace_print_context(struct trace_iterator *iter)
3947    
3948     trace_find_cmdline(entry->pid, comm);
3949    
3950     - trace_seq_printf(s, "%16s-%-5d [%03d] ",
3951     - comm, entry->pid, iter->cpu);
3952     + trace_seq_printf(s, "%16s-%-5d ", comm, entry->pid);
3953    
3954     if (tr->trace_flags & TRACE_ITER_RECORD_TGID) {
3955     unsigned int tgid = trace_find_tgid(entry->pid);
3956     @@ -606,6 +605,8 @@ int trace_print_context(struct trace_iterator *iter)
3957     trace_seq_printf(s, "(%5d) ", tgid);
3958     }
3959    
3960     + trace_seq_printf(s, "[%03d] ", iter->cpu);
3961     +
3962     if (tr->trace_flags & TRACE_ITER_IRQ_INFO)
3963     trace_print_lat_fmt(s, entry);
3964    
3965     diff --git a/mm/gup.c b/mm/gup.c
3966     index 3d8472d48a0b..e608e6650d60 100644
3967     --- a/mm/gup.c
3968     +++ b/mm/gup.c
3969     @@ -1222,8 +1222,6 @@ int __mm_populate(unsigned long start, unsigned long len, int ignore_errors)
3970     int locked = 0;
3971     long ret = 0;
3972    
3973     - VM_BUG_ON(start & ~PAGE_MASK);
3974     - VM_BUG_ON(len != PAGE_ALIGN(len));
3975     end = start + len;
3976    
3977     for (nstart = start; nstart < end; nstart = nend) {
3978     diff --git a/mm/mmap.c b/mm/mmap.c
3979     index fc41c0543d7f..540cfab8c2c4 100644
3980     --- a/mm/mmap.c
3981     +++ b/mm/mmap.c
3982     @@ -186,8 +186,8 @@ static struct vm_area_struct *remove_vma(struct vm_area_struct *vma)
3983     return next;
3984     }
3985    
3986     -static int do_brk(unsigned long addr, unsigned long len, struct list_head *uf);
3987     -
3988     +static int do_brk_flags(unsigned long addr, unsigned long request, unsigned long flags,
3989     + struct list_head *uf);
3990     SYSCALL_DEFINE1(brk, unsigned long, brk)
3991     {
3992     unsigned long retval;
3993     @@ -245,7 +245,7 @@ SYSCALL_DEFINE1(brk, unsigned long, brk)
3994     goto out;
3995    
3996     /* Ok, looks good - let it rip. */
3997     - if (do_brk(oldbrk, newbrk-oldbrk, &uf) < 0)
3998     + if (do_brk_flags(oldbrk, newbrk-oldbrk, 0, &uf) < 0)
3999     goto out;
4000    
4001     set_brk:
4002     @@ -2929,21 +2929,14 @@ static inline void verify_mm_writelocked(struct mm_struct *mm)
4003     * anonymous maps. eventually we may be able to do some
4004     * brk-specific accounting here.
4005     */
4006     -static int do_brk_flags(unsigned long addr, unsigned long request, unsigned long flags, struct list_head *uf)
4007     +static int do_brk_flags(unsigned long addr, unsigned long len, unsigned long flags, struct list_head *uf)
4008     {
4009     struct mm_struct *mm = current->mm;
4010     struct vm_area_struct *vma, *prev;
4011     - unsigned long len;
4012     struct rb_node **rb_link, *rb_parent;
4013     pgoff_t pgoff = addr >> PAGE_SHIFT;
4014     int error;
4015    
4016     - len = PAGE_ALIGN(request);
4017     - if (len < request)
4018     - return -ENOMEM;
4019     - if (!len)
4020     - return 0;
4021     -
4022     /* Until we need other flags, refuse anything except VM_EXEC. */
4023     if ((flags & (~VM_EXEC)) != 0)
4024     return -EINVAL;
4025     @@ -3015,18 +3008,20 @@ static int do_brk_flags(unsigned long addr, unsigned long request, unsigned long
4026     return 0;
4027     }
4028    
4029     -static int do_brk(unsigned long addr, unsigned long len, struct list_head *uf)
4030     -{
4031     - return do_brk_flags(addr, len, 0, uf);
4032     -}
4033     -
4034     -int vm_brk_flags(unsigned long addr, unsigned long len, unsigned long flags)
4035     +int vm_brk_flags(unsigned long addr, unsigned long request, unsigned long flags)
4036     {
4037     struct mm_struct *mm = current->mm;
4038     + unsigned long len;
4039     int ret;
4040     bool populate;
4041     LIST_HEAD(uf);
4042    
4043     + len = PAGE_ALIGN(request);
4044     + if (len < request)
4045     + return -ENOMEM;
4046     + if (!len)
4047     + return 0;
4048     +
4049     if (down_write_killable(&mm->mmap_sem))
4050     return -EINTR;
4051    
4052     diff --git a/mm/page_alloc.c b/mm/page_alloc.c
4053     index d2d0eb9536a3..322cb12a142f 100644
4054     --- a/mm/page_alloc.c
4055     +++ b/mm/page_alloc.c
4056     @@ -6841,6 +6841,7 @@ void __init free_area_init_nodes(unsigned long *max_zone_pfn)
4057     /* Initialise every node */
4058     mminit_verify_pageflags_layout();
4059     setup_nr_node_ids();
4060     + zero_resv_unavail();
4061     for_each_online_node(nid) {
4062     pg_data_t *pgdat = NODE_DATA(nid);
4063     free_area_init_node(nid, NULL,
4064     @@ -6851,7 +6852,6 @@ void __init free_area_init_nodes(unsigned long *max_zone_pfn)
4065     node_set_state(nid, N_MEMORY);
4066     check_for_memory(pgdat, nid);
4067     }
4068     - zero_resv_unavail();
4069     }
4070    
4071     static int __init cmdline_parse_core(char *p, unsigned long *core,
4072     @@ -7027,9 +7027,9 @@ void __init set_dma_reserve(unsigned long new_dma_reserve)
4073    
4074     void __init free_area_init(unsigned long *zones_size)
4075     {
4076     + zero_resv_unavail();
4077     free_area_init_node(0, zones_size,
4078     __pa(PAGE_OFFSET) >> PAGE_SHIFT, NULL);
4079     - zero_resv_unavail();
4080     }
4081    
4082     static int page_alloc_cpu_dead(unsigned int cpu)
4083     diff --git a/mm/rmap.c b/mm/rmap.c
4084     index 8d5337fed37b..09a799c9aebd 100644
4085     --- a/mm/rmap.c
4086     +++ b/mm/rmap.c
4087     @@ -64,6 +64,7 @@
4088     #include <linux/backing-dev.h>
4089     #include <linux/page_idle.h>
4090     #include <linux/memremap.h>
4091     +#include <linux/userfaultfd_k.h>
4092    
4093     #include <asm/tlbflush.h>
4094    
4095     @@ -1481,11 +1482,16 @@ static bool try_to_unmap_one(struct page *page, struct vm_area_struct *vma,
4096     set_pte_at(mm, address, pvmw.pte, pteval);
4097     }
4098    
4099     - } else if (pte_unused(pteval)) {
4100     + } else if (pte_unused(pteval) && !userfaultfd_armed(vma)) {
4101     /*
4102     * The guest indicated that the page content is of no
4103     * interest anymore. Simply discard the pte, vmscan
4104     * will take care of the rest.
4105     + * A future reference will then fault in a new zero
4106     + * page. When userfaultfd is active, we must not drop
4107     + * this page though, as its main user (postcopy
4108     + * migration) will not expect userfaults on already
4109     + * copied pages.
4110     */
4111     dec_mm_counter(mm, mm_counter(page));
4112     /* We have to invalidate as we cleared the pte */
4113     diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c
4114     index 6ba639f6c51d..499123afcab5 100644
4115     --- a/net/bridge/netfilter/ebtables.c
4116     +++ b/net/bridge/netfilter/ebtables.c
4117     @@ -694,6 +694,8 @@ ebt_check_entry(struct ebt_entry *e, struct net *net,
4118     }
4119     i = 0;
4120    
4121     + memset(&mtpar, 0, sizeof(mtpar));
4122     + memset(&tgpar, 0, sizeof(tgpar));
4123     mtpar.net = tgpar.net = net;
4124     mtpar.table = tgpar.table = name;
4125     mtpar.entryinfo = tgpar.entryinfo = e;
4126     diff --git a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c
4127     index e85f35b89c49..f6130704f052 100644
4128     --- a/net/ipv4/netfilter/ip_tables.c
4129     +++ b/net/ipv4/netfilter/ip_tables.c
4130     @@ -531,6 +531,7 @@ find_check_entry(struct ipt_entry *e, struct net *net, const char *name,
4131     return -ENOMEM;
4132    
4133     j = 0;
4134     + memset(&mtpar, 0, sizeof(mtpar));
4135     mtpar.net = net;
4136     mtpar.table = name;
4137     mtpar.entryinfo = &e->ip;
4138     diff --git a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c
4139     index 97f79dc943d7..685c2168f524 100644
4140     --- a/net/ipv6/netfilter/ip6_tables.c
4141     +++ b/net/ipv6/netfilter/ip6_tables.c
4142     @@ -551,6 +551,7 @@ find_check_entry(struct ip6t_entry *e, struct net *net, const char *name,
4143     return -ENOMEM;
4144    
4145     j = 0;
4146     + memset(&mtpar, 0, sizeof(mtpar));
4147     mtpar.net = net;
4148     mtpar.table = name;
4149     mtpar.entryinfo = &e->ipv6;
4150     diff --git a/net/netfilter/nfnetlink_queue.c b/net/netfilter/nfnetlink_queue.c
4151     index 74a04638ef03..93b3e4b86870 100644
4152     --- a/net/netfilter/nfnetlink_queue.c
4153     +++ b/net/netfilter/nfnetlink_queue.c
4154     @@ -1223,6 +1223,9 @@ static int nfqnl_recv_unsupp(struct net *net, struct sock *ctnl,
4155     static const struct nla_policy nfqa_cfg_policy[NFQA_CFG_MAX+1] = {
4156     [NFQA_CFG_CMD] = { .len = sizeof(struct nfqnl_msg_config_cmd) },
4157     [NFQA_CFG_PARAMS] = { .len = sizeof(struct nfqnl_msg_config_params) },
4158     + [NFQA_CFG_QUEUE_MAXLEN] = { .type = NLA_U32 },
4159     + [NFQA_CFG_MASK] = { .type = NLA_U32 },
4160     + [NFQA_CFG_FLAGS] = { .type = NLA_U32 },
4161     };
4162    
4163     static const struct nf_queue_handler nfqh = {
4164     diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
4165     index ed39a77f9253..76d82eebeef2 100644
4166     --- a/sound/pci/hda/patch_hdmi.c
4167     +++ b/sound/pci/hda/patch_hdmi.c
4168     @@ -33,6 +33,7 @@
4169     #include <linux/delay.h>
4170     #include <linux/slab.h>
4171     #include <linux/module.h>
4172     +#include <linux/pm_runtime.h>
4173     #include <sound/core.h>
4174     #include <sound/jack.h>
4175     #include <sound/asoundef.h>
4176     @@ -764,8 +765,10 @@ static void check_presence_and_report(struct hda_codec *codec, hda_nid_t nid,
4177    
4178     if (pin_idx < 0)
4179     return;
4180     + mutex_lock(&spec->pcm_lock);
4181     if (hdmi_present_sense(get_pin(spec, pin_idx), 1))
4182     snd_hda_jack_report_sync(codec);
4183     + mutex_unlock(&spec->pcm_lock);
4184     }
4185    
4186     static void jack_callback(struct hda_codec *codec,
4187     @@ -1628,21 +1631,23 @@ static void sync_eld_via_acomp(struct hda_codec *codec,
4188     static bool hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll)
4189     {
4190     struct hda_codec *codec = per_pin->codec;
4191     - struct hdmi_spec *spec = codec->spec;
4192     int ret;
4193    
4194     /* no temporary power up/down needed for component notifier */
4195     - if (!codec_has_acomp(codec))
4196     - snd_hda_power_up_pm(codec);
4197     + if (!codec_has_acomp(codec)) {
4198     + ret = snd_hda_power_up_pm(codec);
4199     + if (ret < 0 && pm_runtime_suspended(hda_codec_dev(codec))) {
4200     + snd_hda_power_down_pm(codec);
4201     + return false;
4202     + }
4203     + }
4204    
4205     - mutex_lock(&spec->pcm_lock);
4206     if (codec_has_acomp(codec)) {
4207     sync_eld_via_acomp(codec, per_pin);
4208     ret = false; /* don't call snd_hda_jack_report_sync() */
4209     } else {
4210     ret = hdmi_present_sense_via_verbs(per_pin, repoll);
4211     }
4212     - mutex_unlock(&spec->pcm_lock);
4213    
4214     if (!codec_has_acomp(codec))
4215     snd_hda_power_down_pm(codec);
4216     @@ -1654,12 +1659,16 @@ static void hdmi_repoll_eld(struct work_struct *work)
4217     {
4218     struct hdmi_spec_per_pin *per_pin =
4219     container_of(to_delayed_work(work), struct hdmi_spec_per_pin, work);
4220     + struct hda_codec *codec = per_pin->codec;
4221     + struct hdmi_spec *spec = codec->spec;
4222    
4223     if (per_pin->repoll_count++ > 6)
4224     per_pin->repoll_count = 0;
4225    
4226     + mutex_lock(&spec->pcm_lock);
4227     if (hdmi_present_sense(per_pin, per_pin->repoll_count))
4228     snd_hda_jack_report_sync(per_pin->codec);
4229     + mutex_unlock(&spec->pcm_lock);
4230     }
4231    
4232     static void intel_haswell_fixup_connect_list(struct hda_codec *codec,
4233     diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
4234     index cb9a977bf188..066efe783fe8 100644
4235     --- a/sound/pci/hda/patch_realtek.c
4236     +++ b/sound/pci/hda/patch_realtek.c
4237     @@ -6586,7 +6586,6 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
4238     SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
4239     SND_PCI_QUIRK(0x17aa, 0x312a, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
4240     SND_PCI_QUIRK(0x17aa, 0x312f, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
4241     - SND_PCI_QUIRK(0x17aa, 0x3136, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
4242     SND_PCI_QUIRK(0x17aa, 0x313c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
4243     SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
4244     SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
4245     @@ -6770,6 +6769,11 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
4246     {0x1a, 0x02a11040},
4247     {0x1b, 0x01014020},
4248     {0x21, 0x0221101f}),
4249     + SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
4250     + {0x14, 0x90170110},
4251     + {0x19, 0x02a11020},
4252     + {0x1a, 0x02a11030},
4253     + {0x21, 0x0221101f}),
4254     SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
4255     {0x12, 0x90a60140},
4256     {0x14, 0x90170110},
4257     diff --git a/tools/build/Build.include b/tools/build/Build.include
4258     index a4bbb984941d..d9048f145f97 100644
4259     --- a/tools/build/Build.include
4260     +++ b/tools/build/Build.include
4261     @@ -63,8 +63,8 @@ dep-cmd = $(if $(wildcard $(fixdep)),
4262     $(fixdep) $(depfile) $@ '$(make-cmd)' > $(dot-target).tmp; \
4263     rm -f $(depfile); \
4264     mv -f $(dot-target).tmp $(dot-target).cmd, \
4265     - printf '\# cannot find fixdep (%s)\n' $(fixdep) > $(dot-target).cmd; \
4266     - printf '\# using basic dep data\n\n' >> $(dot-target).cmd; \
4267     + printf '$(pound) cannot find fixdep (%s)\n' $(fixdep) > $(dot-target).cmd; \
4268     + printf '$(pound) using basic dep data\n\n' >> $(dot-target).cmd; \
4269     cat $(depfile) >> $(dot-target).cmd; \
4270     printf '\n%s\n' 'cmd_$@ := $(make-cmd)' >> $(dot-target).cmd)
4271    
4272     diff --git a/tools/testing/selftests/bpf/test_verifier.c b/tools/testing/selftests/bpf/test_verifier.c
4273     index fd7de7eb329e..30025d7e75e4 100644
4274     --- a/tools/testing/selftests/bpf/test_verifier.c
4275     +++ b/tools/testing/selftests/bpf/test_verifier.c
4276     @@ -8190,7 +8190,7 @@ static struct bpf_test tests[] = {
4277     offsetof(struct __sk_buff, mark)),
4278     BPF_EXIT_INSN(),
4279     },
4280     - .errstr = "dereference of modified ctx ptr R1 off=68+8, ctx+const is allowed, ctx+const+const is not",
4281     + .errstr = "dereference of modified ctx ptr",
4282     .result = REJECT,
4283     .prog_type = BPF_PROG_TYPE_SCHED_CLS,
4284     },
4285     @@ -11423,6 +11423,62 @@ static struct bpf_test tests[] = {
4286     .errstr = "BPF_XADD stores into R2 packet",
4287     .prog_type = BPF_PROG_TYPE_XDP,
4288     },
4289     + {
4290     + "pass unmodified ctx pointer to helper",
4291     + .insns = {
4292     + BPF_MOV64_IMM(BPF_REG_2, 0),
4293     + BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0,
4294     + BPF_FUNC_csum_update),
4295     + BPF_MOV64_IMM(BPF_REG_0, 0),
4296     + BPF_EXIT_INSN(),
4297     + },
4298     + .prog_type = BPF_PROG_TYPE_SCHED_CLS,
4299     + .result = ACCEPT,
4300     + },
4301     + {
4302     + "pass modified ctx pointer to helper, 1",
4303     + .insns = {
4304     + BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, -612),
4305     + BPF_MOV64_IMM(BPF_REG_2, 0),
4306     + BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0,
4307     + BPF_FUNC_csum_update),
4308     + BPF_MOV64_IMM(BPF_REG_0, 0),
4309     + BPF_EXIT_INSN(),
4310     + },
4311     + .prog_type = BPF_PROG_TYPE_SCHED_CLS,
4312     + .result = REJECT,
4313     + .errstr = "dereference of modified ctx ptr",
4314     + },
4315     + {
4316     + "pass modified ctx pointer to helper, 2",
4317     + .insns = {
4318     + BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, -612),
4319     + BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0,
4320     + BPF_FUNC_get_socket_cookie),
4321     + BPF_MOV64_IMM(BPF_REG_0, 0),
4322     + BPF_EXIT_INSN(),
4323     + },
4324     + .result_unpriv = REJECT,
4325     + .result = REJECT,
4326     + .errstr_unpriv = "dereference of modified ctx ptr",
4327     + .errstr = "dereference of modified ctx ptr",
4328     + },
4329     + {
4330     + "pass modified ctx pointer to helper, 3",
4331     + .insns = {
4332     + BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1, 0),
4333     + BPF_ALU64_IMM(BPF_AND, BPF_REG_3, 4),
4334     + BPF_ALU64_REG(BPF_ADD, BPF_REG_1, BPF_REG_3),
4335     + BPF_MOV64_IMM(BPF_REG_2, 0),
4336     + BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0,
4337     + BPF_FUNC_csum_update),
4338     + BPF_MOV64_IMM(BPF_REG_0, 0),
4339     + BPF_EXIT_INSN(),
4340     + },
4341     + .prog_type = BPF_PROG_TYPE_SCHED_CLS,
4342     + .result = REJECT,
4343     + .errstr = "variable ctx access var_off=(0x0; 0x4)",
4344     + },
4345     };
4346    
4347     static int probe_filter_length(const struct bpf_insn *fp)