1 |
commit: 0a7b3b377ca2adb363bd764b113e1f4a3ee75165 |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Nov 27 16:17:33 2018 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Nov 27 16:17:33 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=0a7b3b37 |
7 |
|
8 |
proj/linux-patches: Linux patch 4.14.84 |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1083_linux-4.14.84.patch | 2271 ++++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 2275 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index 37903b0..b8625f0 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -375,6 +375,10 @@ Patch: 1082-4.14.83.patch |
21 |
From: http://www.kernel.org |
22 |
Desc: Linux 4.14.83 |
23 |
|
24 |
+Patch: 1083-4.14.84.patch |
25 |
+From: http://www.kernel.org |
26 |
+Desc: Linux 4.14.84 |
27 |
+ |
28 |
Patch: 1500_XATTR_USER_PREFIX.patch |
29 |
From: https://bugs.gentoo.org/show_bug.cgi?id=470644 |
30 |
Desc: Support for namespace user.pax.* on tmpfs. |
31 |
|
32 |
diff --git a/1083_linux-4.14.84.patch b/1083_linux-4.14.84.patch |
33 |
new file mode 100644 |
34 |
index 0000000..bc3fcf5 |
35 |
--- /dev/null |
36 |
+++ b/1083_linux-4.14.84.patch |
37 |
@@ -0,0 +1,2271 @@ |
38 |
+diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt |
39 |
+index 9841bad6f271..99a08722124d 100644 |
40 |
+--- a/Documentation/admin-guide/kernel-parameters.txt |
41 |
++++ b/Documentation/admin-guide/kernel-parameters.txt |
42 |
+@@ -1011,7 +1011,7 @@ |
43 |
+ earlyprintk=serial[,0x...[,baudrate]] |
44 |
+ earlyprintk=ttySn[,baudrate] |
45 |
+ earlyprintk=dbgp[debugController#] |
46 |
+- earlyprintk=pciserial,bus:device.function[,baudrate] |
47 |
++ earlyprintk=pciserial[,force],bus:device.function[,baudrate] |
48 |
+ earlyprintk=xdbc[xhciController#] |
49 |
+ |
50 |
+ earlyprintk is useful when the kernel crashes before |
51 |
+@@ -1043,6 +1043,10 @@ |
52 |
+ |
53 |
+ The sclp output can only be used on s390. |
54 |
+ |
55 |
++ The optional "force" to "pciserial" enables use of a |
56 |
++ PCI device even when its classcode is not of the |
57 |
++ UART class. |
58 |
++ |
59 |
+ edac_report= [HW,EDAC] Control how to report EDAC event |
60 |
+ Format: {"on" | "off" | "force"} |
61 |
+ on: enable EDAC to report H/W event. May be overridden |
62 |
+diff --git a/Documentation/x86/x86_64/mm.txt b/Documentation/x86/x86_64/mm.txt |
63 |
+index ea91cb61a602..43f066cde67d 100644 |
64 |
+--- a/Documentation/x86/x86_64/mm.txt |
65 |
++++ b/Documentation/x86/x86_64/mm.txt |
66 |
+@@ -4,8 +4,9 @@ Virtual memory map with 4 level page tables: |
67 |
+ 0000000000000000 - 00007fffffffffff (=47 bits) user space, different per mm |
68 |
+ hole caused by [47:63] sign extension |
69 |
+ ffff800000000000 - ffff87ffffffffff (=43 bits) guard hole, reserved for hypervisor |
70 |
+-ffff880000000000 - ffffc7ffffffffff (=64 TB) direct mapping of all phys. memory |
71 |
+-ffffc80000000000 - ffffc8ffffffffff (=40 bits) hole |
72 |
++ffff880000000000 - ffff887fffffffff (=39 bits) LDT remap for PTI |
73 |
++ffff888000000000 - ffffc87fffffffff (=64 TB) direct mapping of all phys. memory |
74 |
++ffffc88000000000 - ffffc8ffffffffff (=39 bits) hole |
75 |
+ ffffc90000000000 - ffffe8ffffffffff (=45 bits) vmalloc/ioremap space |
76 |
+ ffffe90000000000 - ffffe9ffffffffff (=40 bits) hole |
77 |
+ ffffea0000000000 - ffffeaffffffffff (=40 bits) virtual memory map (1TB) |
78 |
+@@ -30,8 +31,9 @@ Virtual memory map with 5 level page tables: |
79 |
+ 0000000000000000 - 00ffffffffffffff (=56 bits) user space, different per mm |
80 |
+ hole caused by [56:63] sign extension |
81 |
+ ff00000000000000 - ff0fffffffffffff (=52 bits) guard hole, reserved for hypervisor |
82 |
+-ff10000000000000 - ff8fffffffffffff (=55 bits) direct mapping of all phys. memory |
83 |
+-ff90000000000000 - ff9fffffffffffff (=52 bits) LDT remap for PTI |
84 |
++ff10000000000000 - ff10ffffffffffff (=48 bits) LDT remap for PTI |
85 |
++ff11000000000000 - ff90ffffffffffff (=55 bits) direct mapping of all phys. memory |
86 |
++ff91000000000000 - ff9fffffffffffff (=3840 TB) hole |
87 |
+ ffa0000000000000 - ffd1ffffffffffff (=54 bits) vmalloc/ioremap space (12800 TB) |
88 |
+ ffd2000000000000 - ffd3ffffffffffff (=49 bits) hole |
89 |
+ ffd4000000000000 - ffd5ffffffffffff (=49 bits) virtual memory map (512TB) |
90 |
+diff --git a/Makefile b/Makefile |
91 |
+index 0f42814095a4..874d72a3e6a7 100644 |
92 |
+--- a/Makefile |
93 |
++++ b/Makefile |
94 |
+@@ -1,7 +1,7 @@ |
95 |
+ # SPDX-License-Identifier: GPL-2.0 |
96 |
+ VERSION = 4 |
97 |
+ PATCHLEVEL = 14 |
98 |
+-SUBLEVEL = 83 |
99 |
++SUBLEVEL = 84 |
100 |
+ EXTRAVERSION = |
101 |
+ NAME = Petit Gorille |
102 |
+ |
103 |
+diff --git a/arch/arm64/include/asm/percpu.h b/arch/arm64/include/asm/percpu.h |
104 |
+index 43393208229e..d79eaa816f29 100644 |
105 |
+--- a/arch/arm64/include/asm/percpu.h |
106 |
++++ b/arch/arm64/include/asm/percpu.h |
107 |
+@@ -93,6 +93,7 @@ static inline unsigned long __percpu_##op(void *ptr, \ |
108 |
+ : [val] "Ir" (val)); \ |
109 |
+ break; \ |
110 |
+ default: \ |
111 |
++ ret = 0; \ |
112 |
+ BUILD_BUG(); \ |
113 |
+ } \ |
114 |
+ \ |
115 |
+@@ -122,6 +123,7 @@ static inline unsigned long __percpu_read(void *ptr, int size) |
116 |
+ ret = READ_ONCE(*(u64 *)ptr); |
117 |
+ break; |
118 |
+ default: |
119 |
++ ret = 0; |
120 |
+ BUILD_BUG(); |
121 |
+ } |
122 |
+ |
123 |
+@@ -191,6 +193,7 @@ static inline unsigned long __percpu_xchg(void *ptr, unsigned long val, |
124 |
+ : [val] "r" (val)); |
125 |
+ break; |
126 |
+ default: |
127 |
++ ret = 0; |
128 |
+ BUILD_BUG(); |
129 |
+ } |
130 |
+ |
131 |
+diff --git a/arch/arm64/kernel/probes/kprobes.c b/arch/arm64/kernel/probes/kprobes.c |
132 |
+index 22a5921562c7..0417c929d21a 100644 |
133 |
+--- a/arch/arm64/kernel/probes/kprobes.c |
134 |
++++ b/arch/arm64/kernel/probes/kprobes.c |
135 |
+@@ -23,7 +23,9 @@ |
136 |
+ #include <linux/slab.h> |
137 |
+ #include <linux/stop_machine.h> |
138 |
+ #include <linux/sched/debug.h> |
139 |
++#include <linux/set_memory.h> |
140 |
+ #include <linux/stringify.h> |
141 |
++#include <linux/vmalloc.h> |
142 |
+ #include <asm/traps.h> |
143 |
+ #include <asm/ptrace.h> |
144 |
+ #include <asm/cacheflush.h> |
145 |
+@@ -42,10 +44,21 @@ DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk); |
146 |
+ static void __kprobes |
147 |
+ post_kprobe_handler(struct kprobe_ctlblk *, struct pt_regs *); |
148 |
+ |
149 |
++static int __kprobes patch_text(kprobe_opcode_t *addr, u32 opcode) |
150 |
++{ |
151 |
++ void *addrs[1]; |
152 |
++ u32 insns[1]; |
153 |
++ |
154 |
++ addrs[0] = addr; |
155 |
++ insns[0] = opcode; |
156 |
++ |
157 |
++ return aarch64_insn_patch_text(addrs, insns, 1); |
158 |
++} |
159 |
++ |
160 |
+ static void __kprobes arch_prepare_ss_slot(struct kprobe *p) |
161 |
+ { |
162 |
+ /* prepare insn slot */ |
163 |
+- p->ainsn.api.insn[0] = cpu_to_le32(p->opcode); |
164 |
++ patch_text(p->ainsn.api.insn, p->opcode); |
165 |
+ |
166 |
+ flush_icache_range((uintptr_t) (p->ainsn.api.insn), |
167 |
+ (uintptr_t) (p->ainsn.api.insn) + |
168 |
+@@ -118,15 +131,15 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p) |
169 |
+ return 0; |
170 |
+ } |
171 |
+ |
172 |
+-static int __kprobes patch_text(kprobe_opcode_t *addr, u32 opcode) |
173 |
++void *alloc_insn_page(void) |
174 |
+ { |
175 |
+- void *addrs[1]; |
176 |
+- u32 insns[1]; |
177 |
++ void *page; |
178 |
+ |
179 |
+- addrs[0] = (void *)addr; |
180 |
+- insns[0] = (u32)opcode; |
181 |
++ page = vmalloc_exec(PAGE_SIZE); |
182 |
++ if (page) |
183 |
++ set_memory_ro((unsigned long)page, 1); |
184 |
+ |
185 |
+- return aarch64_insn_patch_text(addrs, insns, 1); |
186 |
++ return page; |
187 |
+ } |
188 |
+ |
189 |
+ /* arm kprobe: install breakpoint in text */ |
190 |
+diff --git a/arch/mips/configs/cavium_octeon_defconfig b/arch/mips/configs/cavium_octeon_defconfig |
191 |
+index 490b12af103c..c52d0efacd14 100644 |
192 |
+--- a/arch/mips/configs/cavium_octeon_defconfig |
193 |
++++ b/arch/mips/configs/cavium_octeon_defconfig |
194 |
+@@ -140,6 +140,7 @@ CONFIG_RTC_CLASS=y |
195 |
+ CONFIG_RTC_DRV_DS1307=y |
196 |
+ CONFIG_STAGING=y |
197 |
+ CONFIG_OCTEON_ETHERNET=y |
198 |
++CONFIG_OCTEON_USB=y |
199 |
+ # CONFIG_IOMMU_SUPPORT is not set |
200 |
+ CONFIG_RAS=y |
201 |
+ CONFIG_EXT4_FS=y |
202 |
+diff --git a/arch/s390/kernel/perf_cpum_cf.c b/arch/s390/kernel/perf_cpum_cf.c |
203 |
+index 746d03423333..61e91fee8467 100644 |
204 |
+--- a/arch/s390/kernel/perf_cpum_cf.c |
205 |
++++ b/arch/s390/kernel/perf_cpum_cf.c |
206 |
+@@ -376,7 +376,7 @@ static int __hw_perf_event_init(struct perf_event *event) |
207 |
+ return -ENOENT; |
208 |
+ |
209 |
+ if (ev > PERF_CPUM_CF_MAX_CTR) |
210 |
+- return -EINVAL; |
211 |
++ return -ENOENT; |
212 |
+ |
213 |
+ /* Obtain the counter set to which the specified counter belongs */ |
214 |
+ set = get_counter_set(ev); |
215 |
+diff --git a/arch/s390/kernel/vdso32/Makefile b/arch/s390/kernel/vdso32/Makefile |
216 |
+index 308564b9bf68..101cadabfc89 100644 |
217 |
+--- a/arch/s390/kernel/vdso32/Makefile |
218 |
++++ b/arch/s390/kernel/vdso32/Makefile |
219 |
+@@ -33,7 +33,7 @@ UBSAN_SANITIZE := n |
220 |
+ $(obj)/vdso32_wrapper.o : $(obj)/vdso32.so |
221 |
+ |
222 |
+ # link rule for the .so file, .lds has to be first |
223 |
+-$(obj)/vdso32.so.dbg: $(src)/vdso32.lds $(obj-vdso32) |
224 |
++$(obj)/vdso32.so.dbg: $(src)/vdso32.lds $(obj-vdso32) FORCE |
225 |
+ $(call if_changed,vdso32ld) |
226 |
+ |
227 |
+ # strip rule for the .so file |
228 |
+@@ -42,12 +42,12 @@ $(obj)/%.so: $(obj)/%.so.dbg FORCE |
229 |
+ $(call if_changed,objcopy) |
230 |
+ |
231 |
+ # assembly rules for the .S files |
232 |
+-$(obj-vdso32): %.o: %.S |
233 |
++$(obj-vdso32): %.o: %.S FORCE |
234 |
+ $(call if_changed_dep,vdso32as) |
235 |
+ |
236 |
+ # actual build commands |
237 |
+ quiet_cmd_vdso32ld = VDSO32L $@ |
238 |
+- cmd_vdso32ld = $(CC) $(c_flags) -Wl,-T $^ -o $@ |
239 |
++ cmd_vdso32ld = $(CC) $(c_flags) -Wl,-T $(filter %.lds %.o,$^) -o $@ |
240 |
+ quiet_cmd_vdso32as = VDSO32A $@ |
241 |
+ cmd_vdso32as = $(CC) $(a_flags) -c -o $@ $< |
242 |
+ |
243 |
+diff --git a/arch/s390/kernel/vdso64/Makefile b/arch/s390/kernel/vdso64/Makefile |
244 |
+index f81ae7998883..36bbafcf4a77 100644 |
245 |
+--- a/arch/s390/kernel/vdso64/Makefile |
246 |
++++ b/arch/s390/kernel/vdso64/Makefile |
247 |
+@@ -33,7 +33,7 @@ UBSAN_SANITIZE := n |
248 |
+ $(obj)/vdso64_wrapper.o : $(obj)/vdso64.so |
249 |
+ |
250 |
+ # link rule for the .so file, .lds has to be first |
251 |
+-$(obj)/vdso64.so.dbg: $(src)/vdso64.lds $(obj-vdso64) |
252 |
++$(obj)/vdso64.so.dbg: $(src)/vdso64.lds $(obj-vdso64) FORCE |
253 |
+ $(call if_changed,vdso64ld) |
254 |
+ |
255 |
+ # strip rule for the .so file |
256 |
+@@ -42,12 +42,12 @@ $(obj)/%.so: $(obj)/%.so.dbg FORCE |
257 |
+ $(call if_changed,objcopy) |
258 |
+ |
259 |
+ # assembly rules for the .S files |
260 |
+-$(obj-vdso64): %.o: %.S |
261 |
++$(obj-vdso64): %.o: %.S FORCE |
262 |
+ $(call if_changed_dep,vdso64as) |
263 |
+ |
264 |
+ # actual build commands |
265 |
+ quiet_cmd_vdso64ld = VDSO64L $@ |
266 |
+- cmd_vdso64ld = $(CC) $(c_flags) -Wl,-T $^ -o $@ |
267 |
++ cmd_vdso64ld = $(CC) $(c_flags) -Wl,-T $(filter %.lds %.o,$^) -o $@ |
268 |
+ quiet_cmd_vdso64as = VDSO64A $@ |
269 |
+ cmd_vdso64as = $(CC) $(a_flags) -c -o $@ $< |
270 |
+ |
271 |
+diff --git a/arch/s390/numa/numa.c b/arch/s390/numa/numa.c |
272 |
+index 5bd374491f94..6c151b42e65d 100644 |
273 |
+--- a/arch/s390/numa/numa.c |
274 |
++++ b/arch/s390/numa/numa.c |
275 |
+@@ -54,6 +54,7 @@ int __node_distance(int a, int b) |
276 |
+ { |
277 |
+ return mode->distance ? mode->distance(a, b) : 0; |
278 |
+ } |
279 |
++EXPORT_SYMBOL(__node_distance); |
280 |
+ |
281 |
+ int numa_debug_enabled; |
282 |
+ |
283 |
+diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c |
284 |
+index c94c3bd70ccd..df4a985716eb 100644 |
285 |
+--- a/arch/um/os-Linux/skas/process.c |
286 |
++++ b/arch/um/os-Linux/skas/process.c |
287 |
+@@ -610,6 +610,11 @@ int start_idle_thread(void *stack, jmp_buf *switch_buf) |
288 |
+ fatal_sigsegv(); |
289 |
+ } |
290 |
+ longjmp(*switch_buf, 1); |
291 |
++ |
292 |
++ /* unreachable */ |
293 |
++ printk(UM_KERN_ERR "impossible long jump!"); |
294 |
++ fatal_sigsegv(); |
295 |
++ return 0; |
296 |
+ } |
297 |
+ |
298 |
+ void initial_thread_cb_skas(void (*proc)(void *), void *arg) |
299 |
+diff --git a/arch/x86/include/asm/page_64_types.h b/arch/x86/include/asm/page_64_types.h |
300 |
+index e1407312c412..74d531f6d518 100644 |
301 |
+--- a/arch/x86/include/asm/page_64_types.h |
302 |
++++ b/arch/x86/include/asm/page_64_types.h |
303 |
+@@ -33,14 +33,16 @@ |
304 |
+ |
305 |
+ /* |
306 |
+ * Set __PAGE_OFFSET to the most negative possible address + |
307 |
+- * PGDIR_SIZE*16 (pgd slot 272). The gap is to allow a space for a |
308 |
+- * hypervisor to fit. Choosing 16 slots here is arbitrary, but it's |
309 |
+- * what Xen requires. |
310 |
++ * PGDIR_SIZE*17 (pgd slot 273). |
311 |
++ * |
312 |
++ * The gap is to allow a space for LDT remap for PTI (1 pgd slot) and space for |
313 |
++ * a hypervisor (16 slots). Choosing 16 slots for a hypervisor is arbitrary, |
314 |
++ * but it's what Xen requires. |
315 |
+ */ |
316 |
+ #ifdef CONFIG_X86_5LEVEL |
317 |
+-#define __PAGE_OFFSET_BASE _AC(0xff10000000000000, UL) |
318 |
++#define __PAGE_OFFSET_BASE _AC(0xff11000000000000, UL) |
319 |
+ #else |
320 |
+-#define __PAGE_OFFSET_BASE _AC(0xffff880000000000, UL) |
321 |
++#define __PAGE_OFFSET_BASE _AC(0xffff888000000000, UL) |
322 |
+ #endif |
323 |
+ |
324 |
+ #ifdef CONFIG_RANDOMIZE_MEMORY |
325 |
+diff --git a/arch/x86/include/asm/pgtable_64_types.h b/arch/x86/include/asm/pgtable_64_types.h |
326 |
+index 6b8f73dcbc2c..7764617b8f9c 100644 |
327 |
+--- a/arch/x86/include/asm/pgtable_64_types.h |
328 |
++++ b/arch/x86/include/asm/pgtable_64_types.h |
329 |
+@@ -88,16 +88,15 @@ typedef struct { pteval_t pte; } pte_t; |
330 |
+ # define VMALLOC_SIZE_TB _AC(12800, UL) |
331 |
+ # define __VMALLOC_BASE _AC(0xffa0000000000000, UL) |
332 |
+ # define __VMEMMAP_BASE _AC(0xffd4000000000000, UL) |
333 |
+-# define LDT_PGD_ENTRY _AC(-112, UL) |
334 |
+-# define LDT_BASE_ADDR (LDT_PGD_ENTRY << PGDIR_SHIFT) |
335 |
+ #else |
336 |
+ # define VMALLOC_SIZE_TB _AC(32, UL) |
337 |
+ # define __VMALLOC_BASE _AC(0xffffc90000000000, UL) |
338 |
+ # define __VMEMMAP_BASE _AC(0xffffea0000000000, UL) |
339 |
+-# define LDT_PGD_ENTRY _AC(-3, UL) |
340 |
+-# define LDT_BASE_ADDR (LDT_PGD_ENTRY << PGDIR_SHIFT) |
341 |
+ #endif |
342 |
+ |
343 |
++#define LDT_PGD_ENTRY -240UL |
344 |
++#define LDT_BASE_ADDR (LDT_PGD_ENTRY << PGDIR_SHIFT) |
345 |
++ |
346 |
+ #ifdef CONFIG_RANDOMIZE_MEMORY |
347 |
+ # define VMALLOC_START vmalloc_base |
348 |
+ # define VMEMMAP_START vmemmap_base |
349 |
+diff --git a/arch/x86/kernel/early_printk.c b/arch/x86/kernel/early_printk.c |
350 |
+index 5e801c8c8ce7..374a52fa5296 100644 |
351 |
+--- a/arch/x86/kernel/early_printk.c |
352 |
++++ b/arch/x86/kernel/early_printk.c |
353 |
+@@ -213,8 +213,9 @@ static unsigned int mem32_serial_in(unsigned long addr, int offset) |
354 |
+ * early_pci_serial_init() |
355 |
+ * |
356 |
+ * This function is invoked when the early_printk param starts with "pciserial" |
357 |
+- * The rest of the param should be ",B:D.F,baud" where B, D & F describe the |
358 |
+- * location of a PCI device that must be a UART device. |
359 |
++ * The rest of the param should be "[force],B:D.F,baud", where B, D & F describe |
360 |
++ * the location of a PCI device that must be a UART device. "force" is optional |
361 |
++ * and overrides the use of an UART device with a wrong PCI class code. |
362 |
+ */ |
363 |
+ static __init void early_pci_serial_init(char *s) |
364 |
+ { |
365 |
+@@ -224,17 +225,23 @@ static __init void early_pci_serial_init(char *s) |
366 |
+ u32 classcode, bar0; |
367 |
+ u16 cmdreg; |
368 |
+ char *e; |
369 |
++ int force = 0; |
370 |
+ |
371 |
+- |
372 |
+- /* |
373 |
+- * First, part the param to get the BDF values |
374 |
+- */ |
375 |
+ if (*s == ',') |
376 |
+ ++s; |
377 |
+ |
378 |
+ if (*s == 0) |
379 |
+ return; |
380 |
+ |
381 |
++ /* Force the use of an UART device with wrong class code */ |
382 |
++ if (!strncmp(s, "force,", 6)) { |
383 |
++ force = 1; |
384 |
++ s += 6; |
385 |
++ } |
386 |
++ |
387 |
++ /* |
388 |
++ * Part the param to get the BDF values |
389 |
++ */ |
390 |
+ bus = (u8)simple_strtoul(s, &e, 16); |
391 |
+ s = e; |
392 |
+ if (*s != ':') |
393 |
+@@ -253,7 +260,7 @@ static __init void early_pci_serial_init(char *s) |
394 |
+ s++; |
395 |
+ |
396 |
+ /* |
397 |
+- * Second, find the device from the BDF |
398 |
++ * Find the device from the BDF |
399 |
+ */ |
400 |
+ cmdreg = read_pci_config(bus, slot, func, PCI_COMMAND); |
401 |
+ classcode = read_pci_config(bus, slot, func, PCI_CLASS_REVISION); |
402 |
+@@ -264,8 +271,10 @@ static __init void early_pci_serial_init(char *s) |
403 |
+ */ |
404 |
+ if (((classcode >> 16 != PCI_CLASS_COMMUNICATION_MODEM) && |
405 |
+ (classcode >> 16 != PCI_CLASS_COMMUNICATION_SERIAL)) || |
406 |
+- (((classcode >> 8) & 0xff) != 0x02)) /* 16550 I/F at BAR0 */ |
407 |
+- return; |
408 |
++ (((classcode >> 8) & 0xff) != 0x02)) /* 16550 I/F at BAR0 */ { |
409 |
++ if (!force) |
410 |
++ return; |
411 |
++ } |
412 |
+ |
413 |
+ /* |
414 |
+ * Determine if it is IO or memory mapped |
415 |
+@@ -289,7 +298,7 @@ static __init void early_pci_serial_init(char *s) |
416 |
+ } |
417 |
+ |
418 |
+ /* |
419 |
+- * Lastly, initialize the hardware |
420 |
++ * Initialize the hardware |
421 |
+ */ |
422 |
+ if (*s) { |
423 |
+ if (strcmp(s, "nocfg") == 0) |
424 |
+diff --git a/arch/x86/kernel/ldt.c b/arch/x86/kernel/ldt.c |
425 |
+index 26d713ecad34..65df298d4e9e 100644 |
426 |
+--- a/arch/x86/kernel/ldt.c |
427 |
++++ b/arch/x86/kernel/ldt.c |
428 |
+@@ -103,14 +103,6 @@ static struct ldt_struct *alloc_ldt_struct(unsigned int num_entries) |
429 |
+ /* |
430 |
+ * If PTI is enabled, this maps the LDT into the kernelmode and |
431 |
+ * usermode tables for the given mm. |
432 |
+- * |
433 |
+- * There is no corresponding unmap function. Even if the LDT is freed, we |
434 |
+- * leave the PTEs around until the slot is reused or the mm is destroyed. |
435 |
+- * This is harmless: the LDT is always in ordinary memory, and no one will |
436 |
+- * access the freed slot. |
437 |
+- * |
438 |
+- * If we wanted to unmap freed LDTs, we'd also need to do a flush to make |
439 |
+- * it useful, and the flush would slow down modify_ldt(). |
440 |
+ */ |
441 |
+ static int |
442 |
+ map_ldt_struct(struct mm_struct *mm, struct ldt_struct *ldt, int slot) |
443 |
+@@ -119,8 +111,8 @@ map_ldt_struct(struct mm_struct *mm, struct ldt_struct *ldt, int slot) |
444 |
+ bool is_vmalloc, had_top_level_entry; |
445 |
+ unsigned long va; |
446 |
+ spinlock_t *ptl; |
447 |
++ int i, nr_pages; |
448 |
+ pgd_t *pgd; |
449 |
+- int i; |
450 |
+ |
451 |
+ if (!static_cpu_has(X86_FEATURE_PTI)) |
452 |
+ return 0; |
453 |
+@@ -141,7 +133,9 @@ map_ldt_struct(struct mm_struct *mm, struct ldt_struct *ldt, int slot) |
454 |
+ |
455 |
+ is_vmalloc = is_vmalloc_addr(ldt->entries); |
456 |
+ |
457 |
+- for (i = 0; i * PAGE_SIZE < ldt->nr_entries * LDT_ENTRY_SIZE; i++) { |
458 |
++ nr_pages = DIV_ROUND_UP(ldt->nr_entries * LDT_ENTRY_SIZE, PAGE_SIZE); |
459 |
++ |
460 |
++ for (i = 0; i < nr_pages; i++) { |
461 |
+ unsigned long offset = i << PAGE_SHIFT; |
462 |
+ const void *src = (char *)ldt->entries + offset; |
463 |
+ unsigned long pfn; |
464 |
+@@ -189,14 +183,42 @@ map_ldt_struct(struct mm_struct *mm, struct ldt_struct *ldt, int slot) |
465 |
+ } |
466 |
+ } |
467 |
+ |
468 |
+- va = (unsigned long)ldt_slot_va(slot); |
469 |
+- flush_tlb_mm_range(mm, va, va + LDT_SLOT_STRIDE, 0); |
470 |
+- |
471 |
+ ldt->slot = slot; |
472 |
+ #endif |
473 |
+ return 0; |
474 |
+ } |
475 |
+ |
476 |
++static void unmap_ldt_struct(struct mm_struct *mm, struct ldt_struct *ldt) |
477 |
++{ |
478 |
++#ifdef CONFIG_PAGE_TABLE_ISOLATION |
479 |
++ unsigned long va; |
480 |
++ int i, nr_pages; |
481 |
++ |
482 |
++ if (!ldt) |
483 |
++ return; |
484 |
++ |
485 |
++ /* LDT map/unmap is only required for PTI */ |
486 |
++ if (!static_cpu_has(X86_FEATURE_PTI)) |
487 |
++ return; |
488 |
++ |
489 |
++ nr_pages = DIV_ROUND_UP(ldt->nr_entries * LDT_ENTRY_SIZE, PAGE_SIZE); |
490 |
++ |
491 |
++ for (i = 0; i < nr_pages; i++) { |
492 |
++ unsigned long offset = i << PAGE_SHIFT; |
493 |
++ spinlock_t *ptl; |
494 |
++ pte_t *ptep; |
495 |
++ |
496 |
++ va = (unsigned long)ldt_slot_va(ldt->slot) + offset; |
497 |
++ ptep = get_locked_pte(mm, va, &ptl); |
498 |
++ pte_clear(mm, va, ptep); |
499 |
++ pte_unmap_unlock(ptep, ptl); |
500 |
++ } |
501 |
++ |
502 |
++ va = (unsigned long)ldt_slot_va(ldt->slot); |
503 |
++ flush_tlb_mm_range(mm, va, va + nr_pages * PAGE_SIZE, 0); |
504 |
++#endif /* CONFIG_PAGE_TABLE_ISOLATION */ |
505 |
++} |
506 |
++ |
507 |
+ static void free_ldt_pgtables(struct mm_struct *mm) |
508 |
+ { |
509 |
+ #ifdef CONFIG_PAGE_TABLE_ISOLATION |
510 |
+@@ -433,6 +455,7 @@ static int write_ldt(void __user *ptr, unsigned long bytecount, int oldmode) |
511 |
+ } |
512 |
+ |
513 |
+ install_ldt(mm, new_ldt); |
514 |
++ unmap_ldt_struct(mm, old_ldt); |
515 |
+ free_ldt_struct(old_ldt); |
516 |
+ error = 0; |
517 |
+ |
518 |
+diff --git a/arch/x86/xen/mmu_pv.c b/arch/x86/xen/mmu_pv.c |
519 |
+index 8ed11a5b1a9d..b33fa127a613 100644 |
520 |
+--- a/arch/x86/xen/mmu_pv.c |
521 |
++++ b/arch/x86/xen/mmu_pv.c |
522 |
+@@ -1869,7 +1869,7 @@ void __init xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn) |
523 |
+ init_top_pgt[0] = __pgd(0); |
524 |
+ |
525 |
+ /* Pre-constructed entries are in pfn, so convert to mfn */ |
526 |
+- /* L4[272] -> level3_ident_pgt */ |
527 |
++ /* L4[273] -> level3_ident_pgt */ |
528 |
+ /* L4[511] -> level3_kernel_pgt */ |
529 |
+ convert_pfn_mfn(init_top_pgt); |
530 |
+ |
531 |
+@@ -1889,8 +1889,8 @@ void __init xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn) |
532 |
+ addr[0] = (unsigned long)pgd; |
533 |
+ addr[1] = (unsigned long)l3; |
534 |
+ addr[2] = (unsigned long)l2; |
535 |
+- /* Graft it onto L4[272][0]. Note that we creating an aliasing problem: |
536 |
+- * Both L4[272][0] and L4[511][510] have entries that point to the same |
537 |
++ /* Graft it onto L4[273][0]. Note that we creating an aliasing problem: |
538 |
++ * Both L4[273][0] and L4[511][510] have entries that point to the same |
539 |
+ * L2 (PMD) tables. Meaning that if you modify it in __va space |
540 |
+ * it will be also modified in the __ka space! (But if you just |
541 |
+ * modify the PMD table to point to other PTE's or none, then you |
542 |
+diff --git a/drivers/acpi/acpi_platform.c b/drivers/acpi/acpi_platform.c |
543 |
+index 88cd949003f3..ecd84d910ed2 100644 |
544 |
+--- a/drivers/acpi/acpi_platform.c |
545 |
++++ b/drivers/acpi/acpi_platform.c |
546 |
+@@ -30,6 +30,7 @@ static const struct acpi_device_id forbidden_id_list[] = { |
547 |
+ {"PNP0200", 0}, /* AT DMA Controller */ |
548 |
+ {"ACPI0009", 0}, /* IOxAPIC */ |
549 |
+ {"ACPI000A", 0}, /* IOAPIC */ |
550 |
++ {"SMB0001", 0}, /* ACPI SMBUS virtual device */ |
551 |
+ {"", 0}, |
552 |
+ }; |
553 |
+ |
554 |
+diff --git a/drivers/acpi/acpi_watchdog.c b/drivers/acpi/acpi_watchdog.c |
555 |
+index 4bde16fb97d8..95600309ce42 100644 |
556 |
+--- a/drivers/acpi/acpi_watchdog.c |
557 |
++++ b/drivers/acpi/acpi_watchdog.c |
558 |
+@@ -12,35 +12,51 @@ |
559 |
+ #define pr_fmt(fmt) "ACPI: watchdog: " fmt |
560 |
+ |
561 |
+ #include <linux/acpi.h> |
562 |
+-#include <linux/dmi.h> |
563 |
+ #include <linux/ioport.h> |
564 |
+ #include <linux/platform_device.h> |
565 |
+ |
566 |
+ #include "internal.h" |
567 |
+ |
568 |
+-static const struct dmi_system_id acpi_watchdog_skip[] = { |
569 |
+- { |
570 |
+- /* |
571 |
+- * On Lenovo Z50-70 there are two issues with the WDAT |
572 |
+- * table. First some of the instructions use RTC SRAM |
573 |
+- * to store persistent information. This does not work well |
574 |
+- * with Linux RTC driver. Second, more important thing is |
575 |
+- * that the instructions do not actually reset the system. |
576 |
+- * |
577 |
+- * On this particular system iTCO_wdt seems to work just |
578 |
+- * fine so we prefer that over WDAT for now. |
579 |
+- * |
580 |
+- * See also https://bugzilla.kernel.org/show_bug.cgi?id=199033. |
581 |
+- */ |
582 |
+- .ident = "Lenovo Z50-70", |
583 |
+- .matches = { |
584 |
+- DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), |
585 |
+- DMI_MATCH(DMI_PRODUCT_NAME, "20354"), |
586 |
+- DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo Z50-70"), |
587 |
+- }, |
588 |
+- }, |
589 |
+- {} |
590 |
+-}; |
591 |
++#ifdef CONFIG_RTC_MC146818_LIB |
592 |
++#include <linux/mc146818rtc.h> |
593 |
++ |
594 |
++/* |
595 |
++ * There are several systems where the WDAT table is accessing RTC SRAM to |
596 |
++ * store persistent information. This does not work well with the Linux RTC |
597 |
++ * driver so on those systems we skip WDAT driver and prefer iTCO_wdt |
598 |
++ * instead. |
599 |
++ * |
600 |
++ * See also https://bugzilla.kernel.org/show_bug.cgi?id=199033. |
601 |
++ */ |
602 |
++static bool acpi_watchdog_uses_rtc(const struct acpi_table_wdat *wdat) |
603 |
++{ |
604 |
++ const struct acpi_wdat_entry *entries; |
605 |
++ int i; |
606 |
++ |
607 |
++ entries = (struct acpi_wdat_entry *)(wdat + 1); |
608 |
++ for (i = 0; i < wdat->entries; i++) { |
609 |
++ const struct acpi_generic_address *gas; |
610 |
++ |
611 |
++ gas = &entries[i].register_region; |
612 |
++ if (gas->space_id == ACPI_ADR_SPACE_SYSTEM_IO) { |
613 |
++ switch (gas->address) { |
614 |
++ case RTC_PORT(0): |
615 |
++ case RTC_PORT(1): |
616 |
++ case RTC_PORT(2): |
617 |
++ case RTC_PORT(3): |
618 |
++ return true; |
619 |
++ } |
620 |
++ } |
621 |
++ } |
622 |
++ |
623 |
++ return false; |
624 |
++} |
625 |
++#else |
626 |
++static bool acpi_watchdog_uses_rtc(const struct acpi_table_wdat *wdat) |
627 |
++{ |
628 |
++ return false; |
629 |
++} |
630 |
++#endif |
631 |
+ |
632 |
+ static const struct acpi_table_wdat *acpi_watchdog_get_wdat(void) |
633 |
+ { |
634 |
+@@ -50,9 +66,6 @@ static const struct acpi_table_wdat *acpi_watchdog_get_wdat(void) |
635 |
+ if (acpi_disabled) |
636 |
+ return NULL; |
637 |
+ |
638 |
+- if (dmi_check_system(acpi_watchdog_skip)) |
639 |
+- return NULL; |
640 |
+- |
641 |
+ status = acpi_get_table(ACPI_SIG_WDAT, 0, |
642 |
+ (struct acpi_table_header **)&wdat); |
643 |
+ if (ACPI_FAILURE(status)) { |
644 |
+@@ -60,6 +73,11 @@ static const struct acpi_table_wdat *acpi_watchdog_get_wdat(void) |
645 |
+ return NULL; |
646 |
+ } |
647 |
+ |
648 |
++ if (acpi_watchdog_uses_rtc(wdat)) { |
649 |
++ pr_info("Skipping WDAT on this system because it uses RTC SRAM\n"); |
650 |
++ return NULL; |
651 |
++ } |
652 |
++ |
653 |
+ return wdat; |
654 |
+ } |
655 |
+ |
656 |
+diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c |
657 |
+index 1e2648e4c286..27b202c64c84 100644 |
658 |
+--- a/drivers/block/zram/zram_drv.c |
659 |
++++ b/drivers/block/zram/zram_drv.c |
660 |
+@@ -1491,6 +1491,11 @@ static const struct attribute_group zram_disk_attr_group = { |
661 |
+ .attrs = zram_disk_attrs, |
662 |
+ }; |
663 |
+ |
664 |
++static const struct attribute_group *zram_disk_attr_groups[] = { |
665 |
++ &zram_disk_attr_group, |
666 |
++ NULL, |
667 |
++}; |
668 |
++ |
669 |
+ /* |
670 |
+ * Allocate and initialize new zram device. the function returns |
671 |
+ * '>= 0' device_id upon success, and negative value otherwise. |
672 |
+@@ -1568,23 +1573,14 @@ static int zram_add(void) |
673 |
+ if (ZRAM_LOGICAL_BLOCK_SIZE == PAGE_SIZE) |
674 |
+ blk_queue_max_write_zeroes_sectors(zram->disk->queue, UINT_MAX); |
675 |
+ |
676 |
++ disk_to_dev(zram->disk)->groups = zram_disk_attr_groups; |
677 |
+ add_disk(zram->disk); |
678 |
+ |
679 |
+- ret = sysfs_create_group(&disk_to_dev(zram->disk)->kobj, |
680 |
+- &zram_disk_attr_group); |
681 |
+- if (ret < 0) { |
682 |
+- pr_err("Error creating sysfs group for device %d\n", |
683 |
+- device_id); |
684 |
+- goto out_free_disk; |
685 |
+- } |
686 |
+ strlcpy(zram->compressor, default_compressor, sizeof(zram->compressor)); |
687 |
+ |
688 |
+ pr_info("Added device: %s\n", zram->disk->disk_name); |
689 |
+ return device_id; |
690 |
+ |
691 |
+-out_free_disk: |
692 |
+- del_gendisk(zram->disk); |
693 |
+- put_disk(zram->disk); |
694 |
+ out_free_queue: |
695 |
+ blk_cleanup_queue(queue); |
696 |
+ out_free_idr: |
697 |
+@@ -1612,16 +1608,6 @@ static int zram_remove(struct zram *zram) |
698 |
+ zram->claim = true; |
699 |
+ mutex_unlock(&bdev->bd_mutex); |
700 |
+ |
701 |
+- /* |
702 |
+- * Remove sysfs first, so no one will perform a disksize |
703 |
+- * store while we destroy the devices. This also helps during |
704 |
+- * hot_remove -- zram_reset_device() is the last holder of |
705 |
+- * ->init_lock, no later/concurrent disksize_store() or any |
706 |
+- * other sysfs handlers are possible. |
707 |
+- */ |
708 |
+- sysfs_remove_group(&disk_to_dev(zram->disk)->kobj, |
709 |
+- &zram_disk_attr_group); |
710 |
+- |
711 |
+ /* Make sure all the pending I/O are finished */ |
712 |
+ fsync_bdev(bdev); |
713 |
+ zram_reset_device(zram); |
714 |
+diff --git a/drivers/clk/clk-fixed-factor.c b/drivers/clk/clk-fixed-factor.c |
715 |
+index 20724abd38bd..7df6b5b1e7ee 100644 |
716 |
+--- a/drivers/clk/clk-fixed-factor.c |
717 |
++++ b/drivers/clk/clk-fixed-factor.c |
718 |
+@@ -210,6 +210,7 @@ static int of_fixed_factor_clk_remove(struct platform_device *pdev) |
719 |
+ { |
720 |
+ struct clk *clk = platform_get_drvdata(pdev); |
721 |
+ |
722 |
++ of_clk_del_provider(pdev->dev.of_node); |
723 |
+ clk_unregister_fixed_factor(clk); |
724 |
+ |
725 |
+ return 0; |
726 |
+diff --git a/drivers/clk/clk-fixed-rate.c b/drivers/clk/clk-fixed-rate.c |
727 |
+index b5c46b3f8764..6d6475c32ee5 100644 |
728 |
+--- a/drivers/clk/clk-fixed-rate.c |
729 |
++++ b/drivers/clk/clk-fixed-rate.c |
730 |
+@@ -200,6 +200,7 @@ static int of_fixed_clk_remove(struct platform_device *pdev) |
731 |
+ { |
732 |
+ struct clk *clk = platform_get_drvdata(pdev); |
733 |
+ |
734 |
++ of_clk_del_provider(pdev->dev.of_node); |
735 |
+ clk_unregister_fixed_rate(clk); |
736 |
+ |
737 |
+ return 0; |
738 |
+diff --git a/drivers/clk/samsung/clk-exynos5420.c b/drivers/clk/samsung/clk-exynos5420.c |
739 |
+index 25601967d1cd..500a55415e90 100644 |
740 |
+--- a/drivers/clk/samsung/clk-exynos5420.c |
741 |
++++ b/drivers/clk/samsung/clk-exynos5420.c |
742 |
+@@ -280,6 +280,7 @@ static const struct samsung_clk_reg_dump exynos5420_set_clksrc[] = { |
743 |
+ { .offset = GATE_BUS_TOP, .value = 0xffffffff, }, |
744 |
+ { .offset = GATE_BUS_DISP1, .value = 0xffffffff, }, |
745 |
+ { .offset = GATE_IP_PERIC, .value = 0xffffffff, }, |
746 |
++ { .offset = GATE_IP_PERIS, .value = 0xffffffff, }, |
747 |
+ }; |
748 |
+ |
749 |
+ static int exynos5420_clk_suspend(void) |
750 |
+diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c |
751 |
+index d1191ebed072..ed01e3aae0e8 100644 |
752 |
+--- a/drivers/gpu/drm/drm_edid.c |
753 |
++++ b/drivers/gpu/drm/drm_edid.c |
754 |
+@@ -120,6 +120,9 @@ static const struct edid_quirk { |
755 |
+ /* SDC panel of Lenovo B50-80 reports 8 bpc, but is a 6 bpc panel */ |
756 |
+ { "SDC", 0x3652, EDID_QUIRK_FORCE_6BPC }, |
757 |
+ |
758 |
++ /* BOE model 0x0771 reports 8 bpc, but is a 6 bpc panel */ |
759 |
++ { "BOE", 0x0771, EDID_QUIRK_FORCE_6BPC }, |
760 |
++ |
761 |
+ /* Belinea 10 15 55 */ |
762 |
+ { "MAX", 1516, EDID_QUIRK_PREFER_LARGE_60 }, |
763 |
+ { "MAX", 0x77e, EDID_QUIRK_PREFER_LARGE_60 }, |
764 |
+diff --git a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c |
765 |
+index f905c214fdd0..5a5b3535411f 100644 |
766 |
+--- a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c |
767 |
++++ b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c |
768 |
+@@ -160,13 +160,6 @@ static u32 decon_get_frame_count(struct decon_context *ctx, bool end) |
769 |
+ return frm; |
770 |
+ } |
771 |
+ |
772 |
+-static u32 decon_get_vblank_counter(struct exynos_drm_crtc *crtc) |
773 |
+-{ |
774 |
+- struct decon_context *ctx = crtc->ctx; |
775 |
+- |
776 |
+- return decon_get_frame_count(ctx, false); |
777 |
+-} |
778 |
+- |
779 |
+ static void decon_setup_trigger(struct decon_context *ctx) |
780 |
+ { |
781 |
+ if (!ctx->crtc->i80_mode && !(ctx->out_type & I80_HW_TRG)) |
782 |
+@@ -532,7 +525,6 @@ static const struct exynos_drm_crtc_ops decon_crtc_ops = { |
783 |
+ .disable = decon_disable, |
784 |
+ .enable_vblank = decon_enable_vblank, |
785 |
+ .disable_vblank = decon_disable_vblank, |
786 |
+- .get_vblank_counter = decon_get_vblank_counter, |
787 |
+ .atomic_begin = decon_atomic_begin, |
788 |
+ .update_plane = decon_update_plane, |
789 |
+ .disable_plane = decon_disable_plane, |
790 |
+@@ -550,7 +542,6 @@ static int decon_bind(struct device *dev, struct device *master, void *data) |
791 |
+ int ret; |
792 |
+ |
793 |
+ ctx->drm_dev = drm_dev; |
794 |
+- drm_dev->max_vblank_count = 0xffffffff; |
795 |
+ |
796 |
+ for (win = ctx->first_win; win < WINDOWS_NR; win++) { |
797 |
+ int tmp = (win == ctx->first_win) ? 0 : win; |
798 |
+diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c b/drivers/gpu/drm/exynos/exynos_drm_crtc.c |
799 |
+index 6ce0821590df..4787560bf93e 100644 |
800 |
+--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c |
801 |
++++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c |
802 |
+@@ -147,16 +147,6 @@ static void exynos_drm_crtc_disable_vblank(struct drm_crtc *crtc) |
803 |
+ exynos_crtc->ops->disable_vblank(exynos_crtc); |
804 |
+ } |
805 |
+ |
806 |
+-static u32 exynos_drm_crtc_get_vblank_counter(struct drm_crtc *crtc) |
807 |
+-{ |
808 |
+- struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc); |
809 |
+- |
810 |
+- if (exynos_crtc->ops->get_vblank_counter) |
811 |
+- return exynos_crtc->ops->get_vblank_counter(exynos_crtc); |
812 |
+- |
813 |
+- return 0; |
814 |
+-} |
815 |
+- |
816 |
+ static const struct drm_crtc_funcs exynos_crtc_funcs = { |
817 |
+ .set_config = drm_atomic_helper_set_config, |
818 |
+ .page_flip = drm_atomic_helper_page_flip, |
819 |
+@@ -166,7 +156,6 @@ static const struct drm_crtc_funcs exynos_crtc_funcs = { |
820 |
+ .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state, |
821 |
+ .enable_vblank = exynos_drm_crtc_enable_vblank, |
822 |
+ .disable_vblank = exynos_drm_crtc_disable_vblank, |
823 |
+- .get_vblank_counter = exynos_drm_crtc_get_vblank_counter, |
824 |
+ }; |
825 |
+ |
826 |
+ struct exynos_drm_crtc *exynos_drm_crtc_create(struct drm_device *drm_dev, |
827 |
+diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h |
828 |
+index f8bae4cb4823..d228b5148dbc 100644 |
829 |
+--- a/drivers/gpu/drm/exynos/exynos_drm_drv.h |
830 |
++++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h |
831 |
+@@ -133,7 +133,6 @@ struct exynos_drm_crtc_ops { |
832 |
+ void (*disable)(struct exynos_drm_crtc *crtc); |
833 |
+ int (*enable_vblank)(struct exynos_drm_crtc *crtc); |
834 |
+ void (*disable_vblank)(struct exynos_drm_crtc *crtc); |
835 |
+- u32 (*get_vblank_counter)(struct exynos_drm_crtc *crtc); |
836 |
+ enum drm_mode_status (*mode_valid)(struct exynos_drm_crtc *crtc, |
837 |
+ const struct drm_display_mode *mode); |
838 |
+ int (*atomic_check)(struct exynos_drm_crtc *crtc, |
839 |
+diff --git a/drivers/hid/uhid.c b/drivers/hid/uhid.c |
840 |
+index 6f819f144cb4..6f67d73b184e 100644 |
841 |
+--- a/drivers/hid/uhid.c |
842 |
++++ b/drivers/hid/uhid.c |
843 |
+@@ -12,6 +12,7 @@ |
844 |
+ |
845 |
+ #include <linux/atomic.h> |
846 |
+ #include <linux/compat.h> |
847 |
++#include <linux/cred.h> |
848 |
+ #include <linux/device.h> |
849 |
+ #include <linux/fs.h> |
850 |
+ #include <linux/hid.h> |
851 |
+@@ -722,6 +723,17 @@ static ssize_t uhid_char_write(struct file *file, const char __user *buffer, |
852 |
+ |
853 |
+ switch (uhid->input_buf.type) { |
854 |
+ case UHID_CREATE: |
855 |
++ /* |
856 |
++ * 'struct uhid_create_req' contains a __user pointer which is |
857 |
++ * copied from, so it's unsafe to allow this with elevated |
858 |
++ * privileges (e.g. from a setuid binary) or via kernel_write(). |
859 |
++ */ |
860 |
++ if (file->f_cred != current_cred() || uaccess_kernel()) { |
861 |
++ pr_err_once("UHID_CREATE from different security context by process %d (%s), this is not allowed.\n", |
862 |
++ task_tgid_vnr(current), current->comm); |
863 |
++ ret = -EACCES; |
864 |
++ goto unlock; |
865 |
++ } |
866 |
+ ret = uhid_dev_create(uhid, &uhid->input_buf); |
867 |
+ break; |
868 |
+ case UHID_CREATE2: |
869 |
+diff --git a/drivers/hwmon/ibmpowernv.c b/drivers/hwmon/ibmpowernv.c |
870 |
+index 5ccdd0b52650..b38f4951c94e 100644 |
871 |
+--- a/drivers/hwmon/ibmpowernv.c |
872 |
++++ b/drivers/hwmon/ibmpowernv.c |
873 |
+@@ -126,7 +126,7 @@ static ssize_t show_label(struct device *dev, struct device_attribute *devattr, |
874 |
+ return sprintf(buf, "%s\n", sdata->label); |
875 |
+ } |
876 |
+ |
877 |
+-static int __init get_logical_cpu(int hwcpu) |
878 |
++static int get_logical_cpu(int hwcpu) |
879 |
+ { |
880 |
+ int cpu; |
881 |
+ |
882 |
+@@ -137,9 +137,8 @@ static int __init get_logical_cpu(int hwcpu) |
883 |
+ return -ENOENT; |
884 |
+ } |
885 |
+ |
886 |
+-static void __init make_sensor_label(struct device_node *np, |
887 |
+- struct sensor_data *sdata, |
888 |
+- const char *label) |
889 |
++static void make_sensor_label(struct device_node *np, |
890 |
++ struct sensor_data *sdata, const char *label) |
891 |
+ { |
892 |
+ u32 id; |
893 |
+ size_t n; |
894 |
+diff --git a/drivers/media/v4l2-core/v4l2-event.c b/drivers/media/v4l2-core/v4l2-event.c |
895 |
+index 568dd4affb33..011907eff660 100644 |
896 |
+--- a/drivers/media/v4l2-core/v4l2-event.c |
897 |
++++ b/drivers/media/v4l2-core/v4l2-event.c |
898 |
+@@ -193,6 +193,22 @@ int v4l2_event_pending(struct v4l2_fh *fh) |
899 |
+ } |
900 |
+ EXPORT_SYMBOL_GPL(v4l2_event_pending); |
901 |
+ |
902 |
++static void __v4l2_event_unsubscribe(struct v4l2_subscribed_event *sev) |
903 |
++{ |
904 |
++ struct v4l2_fh *fh = sev->fh; |
905 |
++ unsigned int i; |
906 |
++ |
907 |
++ lockdep_assert_held(&fh->subscribe_lock); |
908 |
++ assert_spin_locked(&fh->vdev->fh_lock); |
909 |
++ |
910 |
++ /* Remove any pending events for this subscription */ |
911 |
++ for (i = 0; i < sev->in_use; i++) { |
912 |
++ list_del(&sev->events[sev_pos(sev, i)].list); |
913 |
++ fh->navailable--; |
914 |
++ } |
915 |
++ list_del(&sev->list); |
916 |
++} |
917 |
++ |
918 |
+ int v4l2_event_subscribe(struct v4l2_fh *fh, |
919 |
+ const struct v4l2_event_subscription *sub, unsigned elems, |
920 |
+ const struct v4l2_subscribed_event_ops *ops) |
921 |
+@@ -225,27 +241,23 @@ int v4l2_event_subscribe(struct v4l2_fh *fh, |
922 |
+ |
923 |
+ spin_lock_irqsave(&fh->vdev->fh_lock, flags); |
924 |
+ found_ev = v4l2_event_subscribed(fh, sub->type, sub->id); |
925 |
++ if (!found_ev) |
926 |
++ list_add(&sev->list, &fh->subscribed); |
927 |
+ spin_unlock_irqrestore(&fh->vdev->fh_lock, flags); |
928 |
+ |
929 |
+ if (found_ev) { |
930 |
+ /* Already listening */ |
931 |
+ kvfree(sev); |
932 |
+- goto out_unlock; |
933 |
+- } |
934 |
+- |
935 |
+- if (sev->ops && sev->ops->add) { |
936 |
++ } else if (sev->ops && sev->ops->add) { |
937 |
+ ret = sev->ops->add(sev, elems); |
938 |
+ if (ret) { |
939 |
++ spin_lock_irqsave(&fh->vdev->fh_lock, flags); |
940 |
++ __v4l2_event_unsubscribe(sev); |
941 |
++ spin_unlock_irqrestore(&fh->vdev->fh_lock, flags); |
942 |
+ kvfree(sev); |
943 |
+- goto out_unlock; |
944 |
+ } |
945 |
+ } |
946 |
+ |
947 |
+- spin_lock_irqsave(&fh->vdev->fh_lock, flags); |
948 |
+- list_add(&sev->list, &fh->subscribed); |
949 |
+- spin_unlock_irqrestore(&fh->vdev->fh_lock, flags); |
950 |
+- |
951 |
+-out_unlock: |
952 |
+ mutex_unlock(&fh->subscribe_lock); |
953 |
+ |
954 |
+ return ret; |
955 |
+@@ -280,7 +292,6 @@ int v4l2_event_unsubscribe(struct v4l2_fh *fh, |
956 |
+ { |
957 |
+ struct v4l2_subscribed_event *sev; |
958 |
+ unsigned long flags; |
959 |
+- int i; |
960 |
+ |
961 |
+ if (sub->type == V4L2_EVENT_ALL) { |
962 |
+ v4l2_event_unsubscribe_all(fh); |
963 |
+@@ -292,14 +303,8 @@ int v4l2_event_unsubscribe(struct v4l2_fh *fh, |
964 |
+ spin_lock_irqsave(&fh->vdev->fh_lock, flags); |
965 |
+ |
966 |
+ sev = v4l2_event_subscribed(fh, sub->type, sub->id); |
967 |
+- if (sev != NULL) { |
968 |
+- /* Remove any pending events for this subscription */ |
969 |
+- for (i = 0; i < sev->in_use; i++) { |
970 |
+- list_del(&sev->events[sev_pos(sev, i)].list); |
971 |
+- fh->navailable--; |
972 |
+- } |
973 |
+- list_del(&sev->list); |
974 |
+- } |
975 |
++ if (sev != NULL) |
976 |
++ __v4l2_event_unsubscribe(sev); |
977 |
+ |
978 |
+ spin_unlock_irqrestore(&fh->vdev->fh_lock, flags); |
979 |
+ |
980 |
+diff --git a/drivers/misc/atmel-ssc.c b/drivers/misc/atmel-ssc.c |
981 |
+index b2a0340f277e..d8e3cc2dc747 100644 |
982 |
+--- a/drivers/misc/atmel-ssc.c |
983 |
++++ b/drivers/misc/atmel-ssc.c |
984 |
+@@ -132,7 +132,7 @@ static const struct of_device_id atmel_ssc_dt_ids[] = { |
985 |
+ MODULE_DEVICE_TABLE(of, atmel_ssc_dt_ids); |
986 |
+ #endif |
987 |
+ |
988 |
+-static inline const struct atmel_ssc_platform_data * __init |
989 |
++static inline const struct atmel_ssc_platform_data * |
990 |
+ atmel_ssc_get_driver_data(struct platform_device *pdev) |
991 |
+ { |
992 |
+ if (pdev->dev.of_node) { |
993 |
+diff --git a/drivers/misc/sgi-gru/grukdump.c b/drivers/misc/sgi-gru/grukdump.c |
994 |
+index 313da3150262..1540a7785e14 100644 |
995 |
+--- a/drivers/misc/sgi-gru/grukdump.c |
996 |
++++ b/drivers/misc/sgi-gru/grukdump.c |
997 |
+@@ -27,6 +27,9 @@ |
998 |
+ #include <linux/delay.h> |
999 |
+ #include <linux/bitops.h> |
1000 |
+ #include <asm/uv/uv_hub.h> |
1001 |
++ |
1002 |
++#include <linux/nospec.h> |
1003 |
++ |
1004 |
+ #include "gru.h" |
1005 |
+ #include "grutables.h" |
1006 |
+ #include "gruhandles.h" |
1007 |
+@@ -196,6 +199,7 @@ int gru_dump_chiplet_request(unsigned long arg) |
1008 |
+ /* Currently, only dump by gid is implemented */ |
1009 |
+ if (req.gid >= gru_max_gids) |
1010 |
+ return -EINVAL; |
1011 |
++ req.gid = array_index_nospec(req.gid, gru_max_gids); |
1012 |
+ |
1013 |
+ gru = GID_TO_GRU(req.gid); |
1014 |
+ ubuf = req.buf; |
1015 |
+diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c |
1016 |
+index 04dbf64fb1cb..176c99b8251d 100644 |
1017 |
+--- a/drivers/net/ethernet/intel/i40e/i40e_main.c |
1018 |
++++ b/drivers/net/ethernet/intel/i40e/i40e_main.c |
1019 |
+@@ -9688,6 +9688,8 @@ static int i40e_config_netdev(struct i40e_vsi *vsi) |
1020 |
+ NETIF_F_GSO_GRE | |
1021 |
+ NETIF_F_GSO_GRE_CSUM | |
1022 |
+ NETIF_F_GSO_PARTIAL | |
1023 |
++ NETIF_F_GSO_IPXIP4 | |
1024 |
++ NETIF_F_GSO_IPXIP6 | |
1025 |
+ NETIF_F_GSO_UDP_TUNNEL | |
1026 |
+ NETIF_F_GSO_UDP_TUNNEL_CSUM | |
1027 |
+ NETIF_F_SCTP_CRC | |
1028 |
+diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c |
1029 |
+index 112d24c6c9ce..4904a63b83ef 100644 |
1030 |
+--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c |
1031 |
++++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c |
1032 |
+@@ -760,8 +760,10 @@ static inline void ixgbe_vf_reset_event(struct ixgbe_adapter *adapter, u32 vf) |
1033 |
+ ixgbe_set_vmvir(adapter, vfinfo->pf_vlan, |
1034 |
+ adapter->default_up, vf); |
1035 |
+ |
1036 |
+- if (vfinfo->spoofchk_enabled) |
1037 |
++ if (vfinfo->spoofchk_enabled) { |
1038 |
+ hw->mac.ops.set_vlan_anti_spoofing(hw, true, vf); |
1039 |
++ hw->mac.ops.set_mac_anti_spoofing(hw, true, vf); |
1040 |
++ } |
1041 |
+ } |
1042 |
+ |
1043 |
+ /* reset multicast table array for vf */ |
1044 |
+diff --git a/drivers/net/ethernet/qlogic/qed/qed_sp.h b/drivers/net/ethernet/qlogic/qed/qed_sp.h |
1045 |
+index ab4ad8a1e2a5..01a213d4ee9c 100644 |
1046 |
+--- a/drivers/net/ethernet/qlogic/qed/qed_sp.h |
1047 |
++++ b/drivers/net/ethernet/qlogic/qed/qed_sp.h |
1048 |
+@@ -167,6 +167,9 @@ struct qed_spq_entry { |
1049 |
+ enum spq_mode comp_mode; |
1050 |
+ struct qed_spq_comp_cb comp_cb; |
1051 |
+ struct qed_spq_comp_done comp_done; /* SPQ_MODE_EBLOCK */ |
1052 |
++ |
1053 |
++ /* Posted entry for unlimited list entry in EBLOCK mode */ |
1054 |
++ struct qed_spq_entry *post_ent; |
1055 |
+ }; |
1056 |
+ |
1057 |
+ struct qed_eq { |
1058 |
+diff --git a/drivers/net/ethernet/qlogic/qed/qed_sp_commands.c b/drivers/net/ethernet/qlogic/qed/qed_sp_commands.c |
1059 |
+index d7c5965328be..b26578464469 100644 |
1060 |
+--- a/drivers/net/ethernet/qlogic/qed/qed_sp_commands.c |
1061 |
++++ b/drivers/net/ethernet/qlogic/qed/qed_sp_commands.c |
1062 |
+@@ -80,7 +80,7 @@ int qed_sp_init_request(struct qed_hwfn *p_hwfn, |
1063 |
+ |
1064 |
+ case QED_SPQ_MODE_BLOCK: |
1065 |
+ if (!p_data->p_comp_data) |
1066 |
+- return -EINVAL; |
1067 |
++ goto err; |
1068 |
+ |
1069 |
+ p_ent->comp_cb.cookie = p_data->p_comp_data->cookie; |
1070 |
+ break; |
1071 |
+@@ -95,7 +95,7 @@ int qed_sp_init_request(struct qed_hwfn *p_hwfn, |
1072 |
+ default: |
1073 |
+ DP_NOTICE(p_hwfn, "Unknown SPQE completion mode %d\n", |
1074 |
+ p_ent->comp_mode); |
1075 |
+- return -EINVAL; |
1076 |
++ goto err; |
1077 |
+ } |
1078 |
+ |
1079 |
+ DP_VERBOSE(p_hwfn, QED_MSG_SPQ, |
1080 |
+@@ -109,6 +109,18 @@ int qed_sp_init_request(struct qed_hwfn *p_hwfn, |
1081 |
+ memset(&p_ent->ramrod, 0, sizeof(p_ent->ramrod)); |
1082 |
+ |
1083 |
+ return 0; |
1084 |
++ |
1085 |
++err: |
1086 |
++ /* qed_spq_get_entry() can either get an entry from the free_pool, |
1087 |
++ * or, if no entries are left, allocate a new entry and add it to |
1088 |
++ * the unlimited_pending list. |
1089 |
++ */ |
1090 |
++ if (p_ent->queue == &p_hwfn->p_spq->unlimited_pending) |
1091 |
++ kfree(p_ent); |
1092 |
++ else |
1093 |
++ qed_spq_return_entry(p_hwfn, p_ent); |
1094 |
++ |
1095 |
++ return -EINVAL; |
1096 |
+ } |
1097 |
+ |
1098 |
+ static enum tunnel_clss qed_tunn_clss_to_fw_clss(u8 type) |
1099 |
+diff --git a/drivers/net/ethernet/qlogic/qed/qed_spq.c b/drivers/net/ethernet/qlogic/qed/qed_spq.c |
1100 |
+index be48d9abd001..467755b6dd0b 100644 |
1101 |
+--- a/drivers/net/ethernet/qlogic/qed/qed_spq.c |
1102 |
++++ b/drivers/net/ethernet/qlogic/qed/qed_spq.c |
1103 |
+@@ -144,6 +144,7 @@ static int qed_spq_block(struct qed_hwfn *p_hwfn, |
1104 |
+ |
1105 |
+ DP_INFO(p_hwfn, "Ramrod is stuck, requesting MCP drain\n"); |
1106 |
+ rc = qed_mcp_drain(p_hwfn, p_ptt); |
1107 |
++ qed_ptt_release(p_hwfn, p_ptt); |
1108 |
+ if (rc) { |
1109 |
+ DP_NOTICE(p_hwfn, "MCP drain failed\n"); |
1110 |
+ goto err; |
1111 |
+@@ -152,18 +153,15 @@ static int qed_spq_block(struct qed_hwfn *p_hwfn, |
1112 |
+ /* Retry after drain */ |
1113 |
+ rc = __qed_spq_block(p_hwfn, p_ent, p_fw_ret, true); |
1114 |
+ if (!rc) |
1115 |
+- goto out; |
1116 |
++ return 0; |
1117 |
+ |
1118 |
+ comp_done = (struct qed_spq_comp_done *)p_ent->comp_cb.cookie; |
1119 |
+- if (comp_done->done == 1) |
1120 |
++ if (comp_done->done == 1) { |
1121 |
+ if (p_fw_ret) |
1122 |
+ *p_fw_ret = comp_done->fw_return_code; |
1123 |
+-out: |
1124 |
+- qed_ptt_release(p_hwfn, p_ptt); |
1125 |
+- return 0; |
1126 |
+- |
1127 |
++ return 0; |
1128 |
++ } |
1129 |
+ err: |
1130 |
+- qed_ptt_release(p_hwfn, p_ptt); |
1131 |
+ DP_NOTICE(p_hwfn, |
1132 |
+ "Ramrod is stuck [CID %08x cmd %02x protocol %02x echo %04x]\n", |
1133 |
+ le32_to_cpu(p_ent->elem.hdr.cid), |
1134 |
+@@ -687,6 +685,8 @@ static int qed_spq_add_entry(struct qed_hwfn *p_hwfn, |
1135 |
+ /* EBLOCK responsible to free the allocated p_ent */ |
1136 |
+ if (p_ent->comp_mode != QED_SPQ_MODE_EBLOCK) |
1137 |
+ kfree(p_ent); |
1138 |
++ else |
1139 |
++ p_ent->post_ent = p_en2; |
1140 |
+ |
1141 |
+ p_ent = p_en2; |
1142 |
+ } |
1143 |
+@@ -770,6 +770,25 @@ static int qed_spq_pend_post(struct qed_hwfn *p_hwfn) |
1144 |
+ SPQ_HIGH_PRI_RESERVE_DEFAULT); |
1145 |
+ } |
1146 |
+ |
1147 |
++/* Avoid overriding of SPQ entries when getting out-of-order completions, by |
1148 |
++ * marking the completions in a bitmap and increasing the chain consumer only |
1149 |
++ * for the first successive completed entries. |
1150 |
++ */ |
1151 |
++static void qed_spq_comp_bmap_update(struct qed_hwfn *p_hwfn, __le16 echo) |
1152 |
++{ |
1153 |
++ u16 pos = le16_to_cpu(echo) % SPQ_RING_SIZE; |
1154 |
++ struct qed_spq *p_spq = p_hwfn->p_spq; |
1155 |
++ |
1156 |
++ __set_bit(pos, p_spq->p_comp_bitmap); |
1157 |
++ while (test_bit(p_spq->comp_bitmap_idx, |
1158 |
++ p_spq->p_comp_bitmap)) { |
1159 |
++ __clear_bit(p_spq->comp_bitmap_idx, |
1160 |
++ p_spq->p_comp_bitmap); |
1161 |
++ p_spq->comp_bitmap_idx++; |
1162 |
++ qed_chain_return_produced(&p_spq->chain); |
1163 |
++ } |
1164 |
++} |
1165 |
++ |
1166 |
+ int qed_spq_post(struct qed_hwfn *p_hwfn, |
1167 |
+ struct qed_spq_entry *p_ent, u8 *fw_return_code) |
1168 |
+ { |
1169 |
+@@ -821,11 +840,12 @@ int qed_spq_post(struct qed_hwfn *p_hwfn, |
1170 |
+ p_ent->queue == &p_spq->unlimited_pending); |
1171 |
+ |
1172 |
+ if (p_ent->queue == &p_spq->unlimited_pending) { |
1173 |
+- /* This is an allocated p_ent which does not need to |
1174 |
+- * return to pool. |
1175 |
+- */ |
1176 |
++ struct qed_spq_entry *p_post_ent = p_ent->post_ent; |
1177 |
++ |
1178 |
+ kfree(p_ent); |
1179 |
+- return rc; |
1180 |
++ |
1181 |
++ /* Return the entry which was actually posted */ |
1182 |
++ p_ent = p_post_ent; |
1183 |
+ } |
1184 |
+ |
1185 |
+ if (rc) |
1186 |
+@@ -839,7 +859,7 @@ int qed_spq_post(struct qed_hwfn *p_hwfn, |
1187 |
+ spq_post_fail2: |
1188 |
+ spin_lock_bh(&p_spq->lock); |
1189 |
+ list_del(&p_ent->list); |
1190 |
+- qed_chain_return_produced(&p_spq->chain); |
1191 |
++ qed_spq_comp_bmap_update(p_hwfn, p_ent->elem.hdr.echo); |
1192 |
+ |
1193 |
+ spq_post_fail: |
1194 |
+ /* return to the free pool */ |
1195 |
+@@ -871,25 +891,8 @@ int qed_spq_completion(struct qed_hwfn *p_hwfn, |
1196 |
+ spin_lock_bh(&p_spq->lock); |
1197 |
+ list_for_each_entry_safe(p_ent, tmp, &p_spq->completion_pending, list) { |
1198 |
+ if (p_ent->elem.hdr.echo == echo) { |
1199 |
+- u16 pos = le16_to_cpu(echo) % SPQ_RING_SIZE; |
1200 |
+- |
1201 |
+ list_del(&p_ent->list); |
1202 |
+- |
1203 |
+- /* Avoid overriding of SPQ entries when getting |
1204 |
+- * out-of-order completions, by marking the completions |
1205 |
+- * in a bitmap and increasing the chain consumer only |
1206 |
+- * for the first successive completed entries. |
1207 |
+- */ |
1208 |
+- __set_bit(pos, p_spq->p_comp_bitmap); |
1209 |
+- |
1210 |
+- while (test_bit(p_spq->comp_bitmap_idx, |
1211 |
+- p_spq->p_comp_bitmap)) { |
1212 |
+- __clear_bit(p_spq->comp_bitmap_idx, |
1213 |
+- p_spq->p_comp_bitmap); |
1214 |
+- p_spq->comp_bitmap_idx++; |
1215 |
+- qed_chain_return_produced(&p_spq->chain); |
1216 |
+- } |
1217 |
+- |
1218 |
++ qed_spq_comp_bmap_update(p_hwfn, echo); |
1219 |
+ p_spq->comp_count++; |
1220 |
+ found = p_ent; |
1221 |
+ break; |
1222 |
+@@ -928,11 +931,9 @@ int qed_spq_completion(struct qed_hwfn *p_hwfn, |
1223 |
+ QED_MSG_SPQ, |
1224 |
+ "Got a completion without a callback function\n"); |
1225 |
+ |
1226 |
+- if ((found->comp_mode != QED_SPQ_MODE_EBLOCK) || |
1227 |
+- (found->queue == &p_spq->unlimited_pending)) |
1228 |
++ if (found->comp_mode != QED_SPQ_MODE_EBLOCK) |
1229 |
+ /* EBLOCK is responsible for returning its own entry into the |
1230 |
+- * free list, unless it originally added the entry into the |
1231 |
+- * unlimited pending list. |
1232 |
++ * free list. |
1233 |
+ */ |
1234 |
+ qed_spq_return_entry(p_hwfn, found); |
1235 |
+ |
1236 |
+diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h |
1237 |
+index 627fec210e2f..8e2a19616bc9 100644 |
1238 |
+--- a/drivers/net/ethernet/stmicro/stmmac/common.h |
1239 |
++++ b/drivers/net/ethernet/stmicro/stmmac/common.h |
1240 |
+@@ -340,7 +340,8 @@ struct dma_features { |
1241 |
+ |
1242 |
+ /* GMAC TX FIFO is 8K, Rx FIFO is 16K */ |
1243 |
+ #define BUF_SIZE_16KiB 16384 |
1244 |
+-#define BUF_SIZE_8KiB 8192 |
1245 |
++/* RX Buffer size must be < 8191 and multiple of 4/8/16 bytes */ |
1246 |
++#define BUF_SIZE_8KiB 8188 |
1247 |
+ #define BUF_SIZE_4KiB 4096 |
1248 |
+ #define BUF_SIZE_2KiB 2048 |
1249 |
+ |
1250 |
+diff --git a/drivers/net/ethernet/stmicro/stmmac/descs_com.h b/drivers/net/ethernet/stmicro/stmmac/descs_com.h |
1251 |
+index ca9d7e48034c..40d6356a7e73 100644 |
1252 |
+--- a/drivers/net/ethernet/stmicro/stmmac/descs_com.h |
1253 |
++++ b/drivers/net/ethernet/stmicro/stmmac/descs_com.h |
1254 |
+@@ -31,7 +31,7 @@ |
1255 |
+ /* Enhanced descriptors */ |
1256 |
+ static inline void ehn_desc_rx_set_on_ring(struct dma_desc *p, int end) |
1257 |
+ { |
1258 |
+- p->des1 |= cpu_to_le32(((BUF_SIZE_8KiB - 1) |
1259 |
++ p->des1 |= cpu_to_le32((BUF_SIZE_8KiB |
1260 |
+ << ERDES1_BUFFER2_SIZE_SHIFT) |
1261 |
+ & ERDES1_BUFFER2_SIZE_MASK); |
1262 |
+ |
1263 |
+diff --git a/drivers/net/ethernet/stmicro/stmmac/enh_desc.c b/drivers/net/ethernet/stmicro/stmmac/enh_desc.c |
1264 |
+index 2a828a312814..acd65a4f94d4 100644 |
1265 |
+--- a/drivers/net/ethernet/stmicro/stmmac/enh_desc.c |
1266 |
++++ b/drivers/net/ethernet/stmicro/stmmac/enh_desc.c |
1267 |
+@@ -262,7 +262,7 @@ static void enh_desc_init_rx_desc(struct dma_desc *p, int disable_rx_ic, |
1268 |
+ int mode, int end) |
1269 |
+ { |
1270 |
+ p->des0 |= cpu_to_le32(RDES0_OWN); |
1271 |
+- p->des1 |= cpu_to_le32((BUF_SIZE_8KiB - 1) & ERDES1_BUFFER1_SIZE_MASK); |
1272 |
++ p->des1 |= cpu_to_le32(BUF_SIZE_8KiB & ERDES1_BUFFER1_SIZE_MASK); |
1273 |
+ |
1274 |
+ if (mode == STMMAC_CHAIN_MODE) |
1275 |
+ ehn_desc_rx_set_on_chain(p); |
1276 |
+diff --git a/drivers/net/ethernet/stmicro/stmmac/ring_mode.c b/drivers/net/ethernet/stmicro/stmmac/ring_mode.c |
1277 |
+index 28e4b5d50ce6..1af7b078b94d 100644 |
1278 |
+--- a/drivers/net/ethernet/stmicro/stmmac/ring_mode.c |
1279 |
++++ b/drivers/net/ethernet/stmicro/stmmac/ring_mode.c |
1280 |
+@@ -143,7 +143,7 @@ static void stmmac_clean_desc3(void *priv_ptr, struct dma_desc *p) |
1281 |
+ static int stmmac_set_16kib_bfsize(int mtu) |
1282 |
+ { |
1283 |
+ int ret = 0; |
1284 |
+- if (unlikely(mtu >= BUF_SIZE_8KiB)) |
1285 |
++ if (unlikely(mtu > BUF_SIZE_8KiB)) |
1286 |
+ ret = BUF_SIZE_16KiB; |
1287 |
+ return ret; |
1288 |
+ } |
1289 |
+diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c |
1290 |
+index ea22591ee66f..53dfe67807e3 100644 |
1291 |
+--- a/drivers/platform/x86/acerhdf.c |
1292 |
++++ b/drivers/platform/x86/acerhdf.c |
1293 |
+@@ -233,6 +233,7 @@ static const struct bios_settings bios_tbl[] = { |
1294 |
+ {"Gateway", "LT31", "v1.3201", 0x55, 0x58, {0x9e, 0x00}, 0}, |
1295 |
+ {"Gateway", "LT31", "v1.3302", 0x55, 0x58, {0x9e, 0x00}, 0}, |
1296 |
+ {"Gateway", "LT31", "v1.3303t", 0x55, 0x58, {0x9e, 0x00}, 0}, |
1297 |
++ {"Gateway", "LT31", "v1.3307", 0x55, 0x58, {0x9e, 0x00}, 0}, |
1298 |
+ /* Packard Bell */ |
1299 |
+ {"Packard Bell", "DOA150", "v0.3104", 0x55, 0x58, {0x21, 0x00}, 0}, |
1300 |
+ {"Packard Bell", "DOA150", "v0.3105", 0x55, 0x58, {0x20, 0x00}, 0}, |
1301 |
+diff --git a/drivers/platform/x86/intel_telemetry_debugfs.c b/drivers/platform/x86/intel_telemetry_debugfs.c |
1302 |
+index d4fc42b4cbeb..401bdc7a9d94 100644 |
1303 |
+--- a/drivers/platform/x86/intel_telemetry_debugfs.c |
1304 |
++++ b/drivers/platform/x86/intel_telemetry_debugfs.c |
1305 |
+@@ -968,12 +968,16 @@ static int __init telemetry_debugfs_init(void) |
1306 |
+ debugfs_conf = (struct telemetry_debugfs_conf *)id->driver_data; |
1307 |
+ |
1308 |
+ err = telemetry_pltconfig_valid(); |
1309 |
+- if (err < 0) |
1310 |
++ if (err < 0) { |
1311 |
++ pr_info("Invalid pltconfig, ensure IPC1 device is enabled in BIOS\n"); |
1312 |
+ return -ENODEV; |
1313 |
++ } |
1314 |
+ |
1315 |
+ err = telemetry_debugfs_check_evts(); |
1316 |
+- if (err < 0) |
1317 |
++ if (err < 0) { |
1318 |
++ pr_info("telemetry_debugfs_check_evts failed\n"); |
1319 |
+ return -EINVAL; |
1320 |
++ } |
1321 |
+ |
1322 |
+ register_pm_notifier(&pm_notifier); |
1323 |
+ |
1324 |
+diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c |
1325 |
+index cd73172bff47..a19f2dc69e8a 100644 |
1326 |
+--- a/drivers/s390/net/qeth_l3_main.c |
1327 |
++++ b/drivers/s390/net/qeth_l3_main.c |
1328 |
+@@ -358,9 +358,6 @@ static void qeth_l3_clear_ip_htable(struct qeth_card *card, int recover) |
1329 |
+ |
1330 |
+ QETH_CARD_TEXT(card, 4, "clearip"); |
1331 |
+ |
1332 |
+- if (recover && card->options.sniffer) |
1333 |
+- return; |
1334 |
+- |
1335 |
+ spin_lock_bh(&card->ip_lock); |
1336 |
+ |
1337 |
+ hash_for_each_safe(card->ip_htable, i, tmp, addr, hnode) { |
1338 |
+@@ -818,6 +815,8 @@ static int qeth_l3_register_addr_entry(struct qeth_card *card, |
1339 |
+ int rc = 0; |
1340 |
+ int cnt = 3; |
1341 |
+ |
1342 |
++ if (card->options.sniffer) |
1343 |
++ return 0; |
1344 |
+ |
1345 |
+ if (addr->proto == QETH_PROT_IPV4) { |
1346 |
+ QETH_CARD_TEXT(card, 2, "setaddr4"); |
1347 |
+@@ -853,6 +852,9 @@ static int qeth_l3_deregister_addr_entry(struct qeth_card *card, |
1348 |
+ { |
1349 |
+ int rc = 0; |
1350 |
+ |
1351 |
++ if (card->options.sniffer) |
1352 |
++ return 0; |
1353 |
++ |
1354 |
+ if (addr->proto == QETH_PROT_IPV4) { |
1355 |
+ QETH_CARD_TEXT(card, 2, "deladdr4"); |
1356 |
+ QETH_CARD_HEX(card, 3, &addr->u.a4.addr, sizeof(int)); |
1357 |
+diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c |
1358 |
+index 0a730136646d..654579bc1e54 100644 |
1359 |
+--- a/drivers/uio/uio.c |
1360 |
++++ b/drivers/uio/uio.c |
1361 |
+@@ -850,6 +850,8 @@ int __uio_register_device(struct module *owner, |
1362 |
+ if (ret) |
1363 |
+ goto err_uio_dev_add_attributes; |
1364 |
+ |
1365 |
++ info->uio_dev = idev; |
1366 |
++ |
1367 |
+ if (info->irq && (info->irq != UIO_IRQ_CUSTOM)) { |
1368 |
+ /* |
1369 |
+ * Note that we deliberately don't use devm_request_irq |
1370 |
+@@ -861,11 +863,12 @@ int __uio_register_device(struct module *owner, |
1371 |
+ */ |
1372 |
+ ret = request_irq(info->irq, uio_interrupt, |
1373 |
+ info->irq_flags, info->name, idev); |
1374 |
+- if (ret) |
1375 |
++ if (ret) { |
1376 |
++ info->uio_dev = NULL; |
1377 |
+ goto err_request_irq; |
1378 |
++ } |
1379 |
+ } |
1380 |
+ |
1381 |
+- info->uio_dev = idev; |
1382 |
+ return 0; |
1383 |
+ |
1384 |
+ err_request_irq: |
1385 |
+diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c |
1386 |
+index e41d00bc7e97..5a8ef83a5c5c 100644 |
1387 |
+--- a/drivers/usb/class/cdc-acm.c |
1388 |
++++ b/drivers/usb/class/cdc-acm.c |
1389 |
+@@ -1724,6 +1724,9 @@ static const struct usb_device_id acm_ids[] = { |
1390 |
+ { USB_DEVICE(0x0572, 0x1328), /* Shiro / Aztech USB MODEM UM-3100 */ |
1391 |
+ .driver_info = NO_UNION_NORMAL, /* has no union descriptor */ |
1392 |
+ }, |
1393 |
++ { USB_DEVICE(0x0572, 0x1349), /* Hiro (Conexant) USB MODEM H50228 */ |
1394 |
++ .driver_info = NO_UNION_NORMAL, /* has no union descriptor */ |
1395 |
++ }, |
1396 |
+ { USB_DEVICE(0x20df, 0x0001), /* Simtec Electronics Entropy Key */ |
1397 |
+ .driver_info = QUIRK_CONTROL_LINE_STATE, }, |
1398 |
+ { USB_DEVICE(0x2184, 0x001c) }, /* GW Instek AFG-2225 */ |
1399 |
+diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c |
1400 |
+index 37a5e07b3488..1e8f68960014 100644 |
1401 |
+--- a/drivers/usb/core/quirks.c |
1402 |
++++ b/drivers/usb/core/quirks.c |
1403 |
+@@ -243,6 +243,9 @@ static const struct usb_device_id usb_quirk_list[] = { |
1404 |
+ { USB_DEVICE(0x1b1c, 0x1b20), .driver_info = USB_QUIRK_DELAY_INIT | |
1405 |
+ USB_QUIRK_DELAY_CTRL_MSG }, |
1406 |
+ |
1407 |
++ /* Corsair K70 LUX RGB */ |
1408 |
++ { USB_DEVICE(0x1b1c, 0x1b33), .driver_info = USB_QUIRK_DELAY_INIT }, |
1409 |
++ |
1410 |
+ /* Corsair K70 LUX */ |
1411 |
+ { USB_DEVICE(0x1b1c, 0x1b36), .driver_info = USB_QUIRK_DELAY_INIT }, |
1412 |
+ |
1413 |
+@@ -263,6 +266,11 @@ static const struct usb_device_id usb_quirk_list[] = { |
1414 |
+ { USB_DEVICE(0x2040, 0x7200), .driver_info = |
1415 |
+ USB_QUIRK_CONFIG_INTF_STRINGS }, |
1416 |
+ |
1417 |
++ /* Raydium Touchscreen */ |
1418 |
++ { USB_DEVICE(0x2386, 0x3114), .driver_info = USB_QUIRK_NO_LPM }, |
1419 |
++ |
1420 |
++ { USB_DEVICE(0x2386, 0x3119), .driver_info = USB_QUIRK_NO_LPM }, |
1421 |
++ |
1422 |
+ /* DJI CineSSD */ |
1423 |
+ { USB_DEVICE(0x2ca3, 0x0031), .driver_info = USB_QUIRK_NO_LPM }, |
1424 |
+ |
1425 |
+diff --git a/drivers/usb/misc/appledisplay.c b/drivers/usb/misc/appledisplay.c |
1426 |
+index 8efdc500e790..288fe3e69d52 100644 |
1427 |
+--- a/drivers/usb/misc/appledisplay.c |
1428 |
++++ b/drivers/usb/misc/appledisplay.c |
1429 |
+@@ -63,6 +63,7 @@ static const struct usb_device_id appledisplay_table[] = { |
1430 |
+ { APPLEDISPLAY_DEVICE(0x9219) }, |
1431 |
+ { APPLEDISPLAY_DEVICE(0x921c) }, |
1432 |
+ { APPLEDISPLAY_DEVICE(0x921d) }, |
1433 |
++ { APPLEDISPLAY_DEVICE(0x9222) }, |
1434 |
+ { APPLEDISPLAY_DEVICE(0x9236) }, |
1435 |
+ |
1436 |
+ /* Terminating entry */ |
1437 |
+diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c |
1438 |
+index 44a7b2dea688..c5fd5abf7206 100644 |
1439 |
+--- a/fs/cifs/cifsfs.c |
1440 |
++++ b/fs/cifs/cifsfs.c |
1441 |
+@@ -933,8 +933,8 @@ static int cifs_clone_file_range(struct file *src_file, loff_t off, |
1442 |
+ struct inode *src_inode = file_inode(src_file); |
1443 |
+ struct inode *target_inode = file_inode(dst_file); |
1444 |
+ struct cifsFileInfo *smb_file_src = src_file->private_data; |
1445 |
+- struct cifsFileInfo *smb_file_target = dst_file->private_data; |
1446 |
+- struct cifs_tcon *target_tcon = tlink_tcon(smb_file_target->tlink); |
1447 |
++ struct cifsFileInfo *smb_file_target; |
1448 |
++ struct cifs_tcon *target_tcon; |
1449 |
+ unsigned int xid; |
1450 |
+ int rc; |
1451 |
+ |
1452 |
+@@ -948,6 +948,9 @@ static int cifs_clone_file_range(struct file *src_file, loff_t off, |
1453 |
+ goto out; |
1454 |
+ } |
1455 |
+ |
1456 |
++ smb_file_target = dst_file->private_data; |
1457 |
++ target_tcon = tlink_tcon(smb_file_target->tlink); |
1458 |
++ |
1459 |
+ /* |
1460 |
+ * Note: cifs case is easier than btrfs since server responsible for |
1461 |
+ * checks for proper open modes and file type and if it wants |
1462 |
+diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c |
1463 |
+index 4e5b05263e4a..3372eedaa94d 100644 |
1464 |
+--- a/fs/cifs/smb2ops.c |
1465 |
++++ b/fs/cifs/smb2ops.c |
1466 |
+@@ -441,6 +441,7 @@ move_smb2_ea_to_cifs(char *dst, size_t dst_size, |
1467 |
+ int rc = 0; |
1468 |
+ unsigned int ea_name_len = ea_name ? strlen(ea_name) : 0; |
1469 |
+ char *name, *value; |
1470 |
++ size_t buf_size = dst_size; |
1471 |
+ size_t name_len, value_len, user_name_len; |
1472 |
+ |
1473 |
+ while (src_size > 0) { |
1474 |
+@@ -476,9 +477,10 @@ move_smb2_ea_to_cifs(char *dst, size_t dst_size, |
1475 |
+ /* 'user.' plus a terminating null */ |
1476 |
+ user_name_len = 5 + 1 + name_len; |
1477 |
+ |
1478 |
+- rc += user_name_len; |
1479 |
+- |
1480 |
+- if (dst_size >= user_name_len) { |
1481 |
++ if (buf_size == 0) { |
1482 |
++ /* skip copy - calc size only */ |
1483 |
++ rc += user_name_len; |
1484 |
++ } else if (dst_size >= user_name_len) { |
1485 |
+ dst_size -= user_name_len; |
1486 |
+ memcpy(dst, "user.", 5); |
1487 |
+ dst += 5; |
1488 |
+@@ -486,8 +488,7 @@ move_smb2_ea_to_cifs(char *dst, size_t dst_size, |
1489 |
+ dst += name_len; |
1490 |
+ *dst = 0; |
1491 |
+ ++dst; |
1492 |
+- } else if (dst_size == 0) { |
1493 |
+- /* skip copy - calc size only */ |
1494 |
++ rc += user_name_len; |
1495 |
+ } else { |
1496 |
+ /* stop before overrun buffer */ |
1497 |
+ rc = -ERANGE; |
1498 |
+diff --git a/fs/exofs/super.c b/fs/exofs/super.c |
1499 |
+index 819624cfc8da..c9ec652e2fcd 100644 |
1500 |
+--- a/fs/exofs/super.c |
1501 |
++++ b/fs/exofs/super.c |
1502 |
+@@ -100,6 +100,7 @@ static int parse_options(char *options, struct exofs_mountopt *opts) |
1503 |
+ token = match_token(p, tokens, args); |
1504 |
+ switch (token) { |
1505 |
+ case Opt_name: |
1506 |
++ kfree(opts->dev_name); |
1507 |
+ opts->dev_name = match_strdup(&args[0]); |
1508 |
+ if (unlikely(!opts->dev_name)) { |
1509 |
+ EXOFS_ERR("Error allocating dev_name"); |
1510 |
+@@ -863,8 +864,10 @@ static struct dentry *exofs_mount(struct file_system_type *type, |
1511 |
+ int ret; |
1512 |
+ |
1513 |
+ ret = parse_options(data, &opts); |
1514 |
+- if (ret) |
1515 |
++ if (ret) { |
1516 |
++ kfree(opts.dev_name); |
1517 |
+ return ERR_PTR(ret); |
1518 |
++ } |
1519 |
+ |
1520 |
+ if (!opts.dev_name) |
1521 |
+ opts.dev_name = dev_name; |
1522 |
+diff --git a/fs/hfs/brec.c b/fs/hfs/brec.c |
1523 |
+index 9a8772465a90..da25c49203cc 100644 |
1524 |
+--- a/fs/hfs/brec.c |
1525 |
++++ b/fs/hfs/brec.c |
1526 |
+@@ -425,6 +425,10 @@ skip: |
1527 |
+ if (new_node) { |
1528 |
+ __be32 cnid; |
1529 |
+ |
1530 |
++ if (!new_node->parent) { |
1531 |
++ hfs_btree_inc_height(tree); |
1532 |
++ new_node->parent = tree->root; |
1533 |
++ } |
1534 |
+ fd->bnode = hfs_bnode_find(tree, new_node->parent); |
1535 |
+ /* create index key and entry */ |
1536 |
+ hfs_bnode_read_key(new_node, fd->search_key, 14); |
1537 |
+diff --git a/fs/hfsplus/brec.c b/fs/hfsplus/brec.c |
1538 |
+index 808f4d8c859c..d3f36982f685 100644 |
1539 |
+--- a/fs/hfsplus/brec.c |
1540 |
++++ b/fs/hfsplus/brec.c |
1541 |
+@@ -428,6 +428,10 @@ skip: |
1542 |
+ if (new_node) { |
1543 |
+ __be32 cnid; |
1544 |
+ |
1545 |
++ if (!new_node->parent) { |
1546 |
++ hfs_btree_inc_height(tree); |
1547 |
++ new_node->parent = tree->root; |
1548 |
++ } |
1549 |
+ fd->bnode = hfs_bnode_find(tree, new_node->parent); |
1550 |
+ /* create index key and entry */ |
1551 |
+ hfs_bnode_read_key(new_node, fd->search_key, 14); |
1552 |
+diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c |
1553 |
+index 505f87a8c724..83423192588c 100644 |
1554 |
+--- a/fs/reiserfs/xattr.c |
1555 |
++++ b/fs/reiserfs/xattr.c |
1556 |
+@@ -185,6 +185,7 @@ struct reiserfs_dentry_buf { |
1557 |
+ struct dir_context ctx; |
1558 |
+ struct dentry *xadir; |
1559 |
+ int count; |
1560 |
++ int err; |
1561 |
+ struct dentry *dentries[8]; |
1562 |
+ }; |
1563 |
+ |
1564 |
+@@ -207,6 +208,7 @@ fill_with_dentries(struct dir_context *ctx, const char *name, int namelen, |
1565 |
+ |
1566 |
+ dentry = lookup_one_len(name, dbuf->xadir, namelen); |
1567 |
+ if (IS_ERR(dentry)) { |
1568 |
++ dbuf->err = PTR_ERR(dentry); |
1569 |
+ return PTR_ERR(dentry); |
1570 |
+ } else if (d_really_is_negative(dentry)) { |
1571 |
+ /* A directory entry exists, but no file? */ |
1572 |
+@@ -215,6 +217,7 @@ fill_with_dentries(struct dir_context *ctx, const char *name, int namelen, |
1573 |
+ "not found for file %pd.\n", |
1574 |
+ dentry, dbuf->xadir); |
1575 |
+ dput(dentry); |
1576 |
++ dbuf->err = -EIO; |
1577 |
+ return -EIO; |
1578 |
+ } |
1579 |
+ |
1580 |
+@@ -262,6 +265,10 @@ static int reiserfs_for_each_xattr(struct inode *inode, |
1581 |
+ err = reiserfs_readdir_inode(d_inode(dir), &buf.ctx); |
1582 |
+ if (err) |
1583 |
+ break; |
1584 |
++ if (buf.err) { |
1585 |
++ err = buf.err; |
1586 |
++ break; |
1587 |
++ } |
1588 |
+ if (!buf.count) |
1589 |
+ break; |
1590 |
+ for (i = 0; !err && i < buf.count && buf.dentries[i]; i++) { |
1591 |
+diff --git a/include/linux/netfilter/ipset/ip_set.h b/include/linux/netfilter/ipset/ip_set.h |
1592 |
+index 8e42253e5d4d..91a533bd3eb1 100644 |
1593 |
+--- a/include/linux/netfilter/ipset/ip_set.h |
1594 |
++++ b/include/linux/netfilter/ipset/ip_set.h |
1595 |
+@@ -312,7 +312,7 @@ enum { |
1596 |
+ extern ip_set_id_t ip_set_get_byname(struct net *net, |
1597 |
+ const char *name, struct ip_set **set); |
1598 |
+ extern void ip_set_put_byindex(struct net *net, ip_set_id_t index); |
1599 |
+-extern const char *ip_set_name_byindex(struct net *net, ip_set_id_t index); |
1600 |
++extern void ip_set_name_byindex(struct net *net, ip_set_id_t index, char *name); |
1601 |
+ extern ip_set_id_t ip_set_nfnl_get_byindex(struct net *net, ip_set_id_t index); |
1602 |
+ extern void ip_set_nfnl_put(struct net *net, ip_set_id_t index); |
1603 |
+ |
1604 |
+diff --git a/include/linux/netfilter/ipset/ip_set_comment.h b/include/linux/netfilter/ipset/ip_set_comment.h |
1605 |
+index 8e2bab1e8e90..70877f8de7e9 100644 |
1606 |
+--- a/include/linux/netfilter/ipset/ip_set_comment.h |
1607 |
++++ b/include/linux/netfilter/ipset/ip_set_comment.h |
1608 |
+@@ -43,11 +43,11 @@ ip_set_init_comment(struct ip_set *set, struct ip_set_comment *comment, |
1609 |
+ rcu_assign_pointer(comment->c, c); |
1610 |
+ } |
1611 |
+ |
1612 |
+-/* Used only when dumping a set, protected by rcu_read_lock_bh() */ |
1613 |
++/* Used only when dumping a set, protected by rcu_read_lock() */ |
1614 |
+ static inline int |
1615 |
+ ip_set_put_comment(struct sk_buff *skb, const struct ip_set_comment *comment) |
1616 |
+ { |
1617 |
+- struct ip_set_comment_rcu *c = rcu_dereference_bh(comment->c); |
1618 |
++ struct ip_set_comment_rcu *c = rcu_dereference(comment->c); |
1619 |
+ |
1620 |
+ if (!c) |
1621 |
+ return 0; |
1622 |
+diff --git a/kernel/sched/core.c b/kernel/sched/core.c |
1623 |
+index 4e89ed8a0fb2..3bc664662081 100644 |
1624 |
+--- a/kernel/sched/core.c |
1625 |
++++ b/kernel/sched/core.c |
1626 |
+@@ -5733,14 +5733,17 @@ void __init sched_init_smp(void) |
1627 |
+ /* |
1628 |
+ * There's no userspace yet to cause hotplug operations; hence all the |
1629 |
+ * CPU masks are stable and all blatant races in the below code cannot |
1630 |
+- * happen. |
1631 |
++ * happen. The hotplug lock is nevertheless taken to satisfy lockdep, |
1632 |
++ * but there won't be any contention on it. |
1633 |
+ */ |
1634 |
++ cpus_read_lock(); |
1635 |
+ mutex_lock(&sched_domains_mutex); |
1636 |
+ sched_init_domains(cpu_active_mask); |
1637 |
+ cpumask_andnot(non_isolated_cpus, cpu_possible_mask, cpu_isolated_map); |
1638 |
+ if (cpumask_empty(non_isolated_cpus)) |
1639 |
+ cpumask_set_cpu(smp_processor_id(), non_isolated_cpus); |
1640 |
+ mutex_unlock(&sched_domains_mutex); |
1641 |
++ cpus_read_unlock(); |
1642 |
+ |
1643 |
+ /* Move init over to a non-isolated CPU */ |
1644 |
+ if (set_cpus_allowed_ptr(current, non_isolated_cpus) < 0) |
1645 |
+diff --git a/lib/raid6/test/Makefile b/lib/raid6/test/Makefile |
1646 |
+index be1010bdc435..565a77220fae 100644 |
1647 |
+--- a/lib/raid6/test/Makefile |
1648 |
++++ b/lib/raid6/test/Makefile |
1649 |
+@@ -27,7 +27,7 @@ ifeq ($(ARCH),arm) |
1650 |
+ CFLAGS += -I../../../arch/arm/include -mfpu=neon |
1651 |
+ HAS_NEON = yes |
1652 |
+ endif |
1653 |
+-ifeq ($(ARCH),arm64) |
1654 |
++ifeq ($(ARCH),aarch64) |
1655 |
+ CFLAGS += -I../../../arch/arm64/include |
1656 |
+ HAS_NEON = yes |
1657 |
+ endif |
1658 |
+@@ -41,7 +41,7 @@ ifeq ($(IS_X86),yes) |
1659 |
+ gcc -c -x assembler - >&/dev/null && \ |
1660 |
+ rm ./-.o && echo -DCONFIG_AS_AVX512=1) |
1661 |
+ else ifeq ($(HAS_NEON),yes) |
1662 |
+- OBJS += neon.o neon1.o neon2.o neon4.o neon8.o |
1663 |
++ OBJS += neon.o neon1.o neon2.o neon4.o neon8.o recov_neon.o recov_neon_inner.o |
1664 |
+ CFLAGS += -DCONFIG_KERNEL_MODE_NEON=1 |
1665 |
+ else |
1666 |
+ HAS_ALTIVEC := $(shell printf '\#include <altivec.h>\nvector int a;\n' |\ |
1667 |
+diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c |
1668 |
+index 5c4e85296cf6..5281da82371a 100644 |
1669 |
+--- a/net/ceph/messenger.c |
1670 |
++++ b/net/ceph/messenger.c |
1671 |
+@@ -594,9 +594,15 @@ static int ceph_tcp_sendpage(struct socket *sock, struct page *page, |
1672 |
+ struct bio_vec bvec; |
1673 |
+ int ret; |
1674 |
+ |
1675 |
+- /* sendpage cannot properly handle pages with page_count == 0, |
1676 |
+- * we need to fallback to sendmsg if that's the case */ |
1677 |
+- if (page_count(page) >= 1) |
1678 |
++ /* |
1679 |
++ * sendpage cannot properly handle pages with page_count == 0, |
1680 |
++ * we need to fall back to sendmsg if that's the case. |
1681 |
++ * |
1682 |
++ * Same goes for slab pages: skb_can_coalesce() allows |
1683 |
++ * coalescing neighboring slab objects into a single frag which |
1684 |
++ * triggers one of hardened usercopy checks. |
1685 |
++ */ |
1686 |
++ if (page_count(page) >= 1 && !PageSlab(page)) |
1687 |
+ return __ceph_tcp_sendpage(sock, page, offset, size, more); |
1688 |
+ |
1689 |
+ bvec.bv_page = page; |
1690 |
+diff --git a/net/netfilter/ipset/ip_set_core.c b/net/netfilter/ipset/ip_set_core.c |
1691 |
+index 9d2ce1459cec..a3f1dc7cf538 100644 |
1692 |
+--- a/net/netfilter/ipset/ip_set_core.c |
1693 |
++++ b/net/netfilter/ipset/ip_set_core.c |
1694 |
+@@ -668,21 +668,20 @@ ip_set_put_byindex(struct net *net, ip_set_id_t index) |
1695 |
+ EXPORT_SYMBOL_GPL(ip_set_put_byindex); |
1696 |
+ |
1697 |
+ /* Get the name of a set behind a set index. |
1698 |
+- * We assume the set is referenced, so it does exist and |
1699 |
+- * can't be destroyed. The set cannot be renamed due to |
1700 |
+- * the referencing either. |
1701 |
+- * |
1702 |
++ * Set itself is protected by RCU, but its name isn't: to protect against |
1703 |
++ * renaming, grab ip_set_ref_lock as reader (see ip_set_rename()) and copy the |
1704 |
++ * name. |
1705 |
+ */ |
1706 |
+-const char * |
1707 |
+-ip_set_name_byindex(struct net *net, ip_set_id_t index) |
1708 |
++void |
1709 |
++ip_set_name_byindex(struct net *net, ip_set_id_t index, char *name) |
1710 |
+ { |
1711 |
+- const struct ip_set *set = ip_set_rcu_get(net, index); |
1712 |
++ struct ip_set *set = ip_set_rcu_get(net, index); |
1713 |
+ |
1714 |
+ BUG_ON(!set); |
1715 |
+- BUG_ON(set->ref == 0); |
1716 |
+ |
1717 |
+- /* Referenced, so it's safe */ |
1718 |
+- return set->name; |
1719 |
++ read_lock_bh(&ip_set_ref_lock); |
1720 |
++ strncpy(name, set->name, IPSET_MAXNAMELEN); |
1721 |
++ read_unlock_bh(&ip_set_ref_lock); |
1722 |
+ } |
1723 |
+ EXPORT_SYMBOL_GPL(ip_set_name_byindex); |
1724 |
+ |
1725 |
+@@ -1128,7 +1127,7 @@ static int ip_set_rename(struct net *net, struct sock *ctnl, |
1726 |
+ if (!set) |
1727 |
+ return -ENOENT; |
1728 |
+ |
1729 |
+- read_lock_bh(&ip_set_ref_lock); |
1730 |
++ write_lock_bh(&ip_set_ref_lock); |
1731 |
+ if (set->ref != 0) { |
1732 |
+ ret = -IPSET_ERR_REFERENCED; |
1733 |
+ goto out; |
1734 |
+@@ -1145,7 +1144,7 @@ static int ip_set_rename(struct net *net, struct sock *ctnl, |
1735 |
+ strncpy(set->name, name2, IPSET_MAXNAMELEN); |
1736 |
+ |
1737 |
+ out: |
1738 |
+- read_unlock_bh(&ip_set_ref_lock); |
1739 |
++ write_unlock_bh(&ip_set_ref_lock); |
1740 |
+ return ret; |
1741 |
+ } |
1742 |
+ |
1743 |
+diff --git a/net/netfilter/ipset/ip_set_hash_netportnet.c b/net/netfilter/ipset/ip_set_hash_netportnet.c |
1744 |
+index 8602f2595a1a..0e6e40c6f652 100644 |
1745 |
+--- a/net/netfilter/ipset/ip_set_hash_netportnet.c |
1746 |
++++ b/net/netfilter/ipset/ip_set_hash_netportnet.c |
1747 |
+@@ -213,13 +213,13 @@ hash_netportnet4_uadt(struct ip_set *set, struct nlattr *tb[], |
1748 |
+ |
1749 |
+ if (tb[IPSET_ATTR_CIDR]) { |
1750 |
+ e.cidr[0] = nla_get_u8(tb[IPSET_ATTR_CIDR]); |
1751 |
+- if (!e.cidr[0] || e.cidr[0] > HOST_MASK) |
1752 |
++ if (e.cidr[0] > HOST_MASK) |
1753 |
+ return -IPSET_ERR_INVALID_CIDR; |
1754 |
+ } |
1755 |
+ |
1756 |
+ if (tb[IPSET_ATTR_CIDR2]) { |
1757 |
+ e.cidr[1] = nla_get_u8(tb[IPSET_ATTR_CIDR2]); |
1758 |
+- if (!e.cidr[1] || e.cidr[1] > HOST_MASK) |
1759 |
++ if (e.cidr[1] > HOST_MASK) |
1760 |
+ return -IPSET_ERR_INVALID_CIDR; |
1761 |
+ } |
1762 |
+ |
1763 |
+@@ -492,13 +492,13 @@ hash_netportnet6_uadt(struct ip_set *set, struct nlattr *tb[], |
1764 |
+ |
1765 |
+ if (tb[IPSET_ATTR_CIDR]) { |
1766 |
+ e.cidr[0] = nla_get_u8(tb[IPSET_ATTR_CIDR]); |
1767 |
+- if (!e.cidr[0] || e.cidr[0] > HOST_MASK) |
1768 |
++ if (e.cidr[0] > HOST_MASK) |
1769 |
+ return -IPSET_ERR_INVALID_CIDR; |
1770 |
+ } |
1771 |
+ |
1772 |
+ if (tb[IPSET_ATTR_CIDR2]) { |
1773 |
+ e.cidr[1] = nla_get_u8(tb[IPSET_ATTR_CIDR2]); |
1774 |
+- if (!e.cidr[1] || e.cidr[1] > HOST_MASK) |
1775 |
++ if (e.cidr[1] > HOST_MASK) |
1776 |
+ return -IPSET_ERR_INVALID_CIDR; |
1777 |
+ } |
1778 |
+ |
1779 |
+diff --git a/net/netfilter/ipset/ip_set_list_set.c b/net/netfilter/ipset/ip_set_list_set.c |
1780 |
+index 178d4eba013b..75d52aed6fdb 100644 |
1781 |
+--- a/net/netfilter/ipset/ip_set_list_set.c |
1782 |
++++ b/net/netfilter/ipset/ip_set_list_set.c |
1783 |
+@@ -156,9 +156,7 @@ __list_set_del_rcu(struct rcu_head * rcu) |
1784 |
+ { |
1785 |
+ struct set_elem *e = container_of(rcu, struct set_elem, rcu); |
1786 |
+ struct ip_set *set = e->set; |
1787 |
+- struct list_set *map = set->data; |
1788 |
+ |
1789 |
+- ip_set_put_byindex(map->net, e->id); |
1790 |
+ ip_set_ext_destroy(set, e); |
1791 |
+ kfree(e); |
1792 |
+ } |
1793 |
+@@ -166,15 +164,21 @@ __list_set_del_rcu(struct rcu_head * rcu) |
1794 |
+ static inline void |
1795 |
+ list_set_del(struct ip_set *set, struct set_elem *e) |
1796 |
+ { |
1797 |
++ struct list_set *map = set->data; |
1798 |
++ |
1799 |
+ set->elements--; |
1800 |
+ list_del_rcu(&e->list); |
1801 |
++ ip_set_put_byindex(map->net, e->id); |
1802 |
+ call_rcu(&e->rcu, __list_set_del_rcu); |
1803 |
+ } |
1804 |
+ |
1805 |
+ static inline void |
1806 |
+-list_set_replace(struct set_elem *e, struct set_elem *old) |
1807 |
++list_set_replace(struct ip_set *set, struct set_elem *e, struct set_elem *old) |
1808 |
+ { |
1809 |
++ struct list_set *map = set->data; |
1810 |
++ |
1811 |
+ list_replace_rcu(&old->list, &e->list); |
1812 |
++ ip_set_put_byindex(map->net, old->id); |
1813 |
+ call_rcu(&old->rcu, __list_set_del_rcu); |
1814 |
+ } |
1815 |
+ |
1816 |
+@@ -306,7 +310,7 @@ list_set_uadd(struct ip_set *set, void *value, const struct ip_set_ext *ext, |
1817 |
+ INIT_LIST_HEAD(&e->list); |
1818 |
+ list_set_init_extensions(set, ext, e); |
1819 |
+ if (n) |
1820 |
+- list_set_replace(e, n); |
1821 |
++ list_set_replace(set, e, n); |
1822 |
+ else if (next) |
1823 |
+ list_add_tail_rcu(&e->list, &next->list); |
1824 |
+ else if (prev) |
1825 |
+@@ -497,6 +501,7 @@ list_set_list(const struct ip_set *set, |
1826 |
+ const struct list_set *map = set->data; |
1827 |
+ struct nlattr *atd, *nested; |
1828 |
+ u32 i = 0, first = cb->args[IPSET_CB_ARG0]; |
1829 |
++ char name[IPSET_MAXNAMELEN]; |
1830 |
+ struct set_elem *e; |
1831 |
+ int ret = 0; |
1832 |
+ |
1833 |
+@@ -515,8 +520,8 @@ list_set_list(const struct ip_set *set, |
1834 |
+ nested = ipset_nest_start(skb, IPSET_ATTR_DATA); |
1835 |
+ if (!nested) |
1836 |
+ goto nla_put_failure; |
1837 |
+- if (nla_put_string(skb, IPSET_ATTR_NAME, |
1838 |
+- ip_set_name_byindex(map->net, e->id))) |
1839 |
++ ip_set_name_byindex(map->net, e->id, name); |
1840 |
++ if (nla_put_string(skb, IPSET_ATTR_NAME, name)) |
1841 |
+ goto nla_put_failure; |
1842 |
+ if (ip_set_put_extensions(skb, set, e, true)) |
1843 |
+ goto nla_put_failure; |
1844 |
+diff --git a/net/netfilter/xt_IDLETIMER.c b/net/netfilter/xt_IDLETIMER.c |
1845 |
+index 1141f08810b6..3fef8c2e545d 100644 |
1846 |
+--- a/net/netfilter/xt_IDLETIMER.c |
1847 |
++++ b/net/netfilter/xt_IDLETIMER.c |
1848 |
+@@ -116,6 +116,22 @@ static void idletimer_tg_expired(unsigned long data) |
1849 |
+ schedule_work(&timer->work); |
1850 |
+ } |
1851 |
+ |
1852 |
++static int idletimer_check_sysfs_name(const char *name, unsigned int size) |
1853 |
++{ |
1854 |
++ int ret; |
1855 |
++ |
1856 |
++ ret = xt_check_proc_name(name, size); |
1857 |
++ if (ret < 0) |
1858 |
++ return ret; |
1859 |
++ |
1860 |
++ if (!strcmp(name, "power") || |
1861 |
++ !strcmp(name, "subsystem") || |
1862 |
++ !strcmp(name, "uevent")) |
1863 |
++ return -EINVAL; |
1864 |
++ |
1865 |
++ return 0; |
1866 |
++} |
1867 |
++ |
1868 |
+ static int idletimer_tg_create(struct idletimer_tg_info *info) |
1869 |
+ { |
1870 |
+ int ret; |
1871 |
+@@ -126,6 +142,10 @@ static int idletimer_tg_create(struct idletimer_tg_info *info) |
1872 |
+ goto out; |
1873 |
+ } |
1874 |
+ |
1875 |
++ ret = idletimer_check_sysfs_name(info->label, sizeof(info->label)); |
1876 |
++ if (ret < 0) |
1877 |
++ goto out_free_timer; |
1878 |
++ |
1879 |
+ sysfs_attr_init(&info->timer->attr.attr); |
1880 |
+ info->timer->attr.attr.name = kstrdup(info->label, GFP_KERNEL); |
1881 |
+ if (!info->timer->attr.attr.name) { |
1882 |
+diff --git a/net/sunrpc/xdr.c b/net/sunrpc/xdr.c |
1883 |
+index 13695ba8fc54..4f382805eb9c 100644 |
1884 |
+--- a/net/sunrpc/xdr.c |
1885 |
++++ b/net/sunrpc/xdr.c |
1886 |
+@@ -512,7 +512,7 @@ EXPORT_SYMBOL_GPL(xdr_commit_encode); |
1887 |
+ static __be32 *xdr_get_next_encode_buffer(struct xdr_stream *xdr, |
1888 |
+ size_t nbytes) |
1889 |
+ { |
1890 |
+- static __be32 *p; |
1891 |
++ __be32 *p; |
1892 |
+ int space_left; |
1893 |
+ int frag1bytes, frag2bytes; |
1894 |
+ |
1895 |
+diff --git a/security/apparmor/lib.c b/security/apparmor/lib.c |
1896 |
+index 08ca26bcca77..451654372a76 100644 |
1897 |
+--- a/security/apparmor/lib.c |
1898 |
++++ b/security/apparmor/lib.c |
1899 |
+@@ -90,10 +90,12 @@ const char *aa_splitn_fqname(const char *fqname, size_t n, const char **ns_name, |
1900 |
+ const char *end = fqname + n; |
1901 |
+ const char *name = skipn_spaces(fqname, n); |
1902 |
+ |
1903 |
+- if (!name) |
1904 |
+- return NULL; |
1905 |
+ *ns_name = NULL; |
1906 |
+ *ns_len = 0; |
1907 |
++ |
1908 |
++ if (!name) |
1909 |
++ return NULL; |
1910 |
++ |
1911 |
+ if (name[0] == ':') { |
1912 |
+ char *split = strnchr(&name[1], end - &name[1], ':'); |
1913 |
+ *ns_name = skipn_spaces(&name[1], end - &name[1]); |
1914 |
+diff --git a/tools/perf/jvmti/jvmti_agent.c b/tools/perf/jvmti/jvmti_agent.c |
1915 |
+index c1d20d951434..4ad9948fe594 100644 |
1916 |
+--- a/tools/perf/jvmti/jvmti_agent.c |
1917 |
++++ b/tools/perf/jvmti/jvmti_agent.c |
1918 |
+@@ -125,7 +125,7 @@ perf_get_timestamp(void) |
1919 |
+ } |
1920 |
+ |
1921 |
+ static int |
1922 |
+-debug_cache_init(void) |
1923 |
++create_jit_cache_dir(void) |
1924 |
+ { |
1925 |
+ char str[32]; |
1926 |
+ char *base, *p; |
1927 |
+@@ -144,8 +144,13 @@ debug_cache_init(void) |
1928 |
+ |
1929 |
+ strftime(str, sizeof(str), JIT_LANG"-jit-%Y%m%d", &tm); |
1930 |
+ |
1931 |
+- snprintf(jit_path, PATH_MAX - 1, "%s/.debug/", base); |
1932 |
+- |
1933 |
++ ret = snprintf(jit_path, PATH_MAX, "%s/.debug/", base); |
1934 |
++ if (ret >= PATH_MAX) { |
1935 |
++ warnx("jvmti: cannot generate jit cache dir because %s/.debug/" |
1936 |
++ " is too long, please check the cwd, JITDUMPDIR, and" |
1937 |
++ " HOME variables", base); |
1938 |
++ return -1; |
1939 |
++ } |
1940 |
+ ret = mkdir(jit_path, 0755); |
1941 |
+ if (ret == -1) { |
1942 |
+ if (errno != EEXIST) { |
1943 |
+@@ -154,20 +159,32 @@ debug_cache_init(void) |
1944 |
+ } |
1945 |
+ } |
1946 |
+ |
1947 |
+- snprintf(jit_path, PATH_MAX - 1, "%s/.debug/jit", base); |
1948 |
++ ret = snprintf(jit_path, PATH_MAX, "%s/.debug/jit", base); |
1949 |
++ if (ret >= PATH_MAX) { |
1950 |
++ warnx("jvmti: cannot generate jit cache dir because" |
1951 |
++ " %s/.debug/jit is too long, please check the cwd," |
1952 |
++ " JITDUMPDIR, and HOME variables", base); |
1953 |
++ return -1; |
1954 |
++ } |
1955 |
+ ret = mkdir(jit_path, 0755); |
1956 |
+ if (ret == -1) { |
1957 |
+ if (errno != EEXIST) { |
1958 |
+- warn("cannot create jit cache dir %s", jit_path); |
1959 |
++ warn("jvmti: cannot create jit cache dir %s", jit_path); |
1960 |
+ return -1; |
1961 |
+ } |
1962 |
+ } |
1963 |
+ |
1964 |
+- snprintf(jit_path, PATH_MAX - 1, "%s/.debug/jit/%s.XXXXXXXX", base, str); |
1965 |
+- |
1966 |
++ ret = snprintf(jit_path, PATH_MAX, "%s/.debug/jit/%s.XXXXXXXX", base, str); |
1967 |
++ if (ret >= PATH_MAX) { |
1968 |
++ warnx("jvmti: cannot generate jit cache dir because" |
1969 |
++ " %s/.debug/jit/%s.XXXXXXXX is too long, please check" |
1970 |
++ " the cwd, JITDUMPDIR, and HOME variables", |
1971 |
++ base, str); |
1972 |
++ return -1; |
1973 |
++ } |
1974 |
+ p = mkdtemp(jit_path); |
1975 |
+ if (p != jit_path) { |
1976 |
+- warn("cannot create jit cache dir %s", jit_path); |
1977 |
++ warn("jvmti: cannot create jit cache dir %s", jit_path); |
1978 |
+ return -1; |
1979 |
+ } |
1980 |
+ |
1981 |
+@@ -228,7 +245,7 @@ void *jvmti_open(void) |
1982 |
+ { |
1983 |
+ char dump_path[PATH_MAX]; |
1984 |
+ struct jitheader header; |
1985 |
+- int fd; |
1986 |
++ int fd, ret; |
1987 |
+ FILE *fp; |
1988 |
+ |
1989 |
+ init_arch_timestamp(); |
1990 |
+@@ -245,12 +262,22 @@ void *jvmti_open(void) |
1991 |
+ |
1992 |
+ memset(&header, 0, sizeof(header)); |
1993 |
+ |
1994 |
+- debug_cache_init(); |
1995 |
++ /* |
1996 |
++ * jitdump file dir |
1997 |
++ */ |
1998 |
++ if (create_jit_cache_dir() < 0) |
1999 |
++ return NULL; |
2000 |
+ |
2001 |
+ /* |
2002 |
+ * jitdump file name |
2003 |
+ */ |
2004 |
+- scnprintf(dump_path, PATH_MAX, "%s/jit-%i.dump", jit_path, getpid()); |
2005 |
++ ret = snprintf(dump_path, PATH_MAX, "%s/jit-%i.dump", jit_path, getpid()); |
2006 |
++ if (ret >= PATH_MAX) { |
2007 |
++ warnx("jvmti: cannot generate jitdump file full path because" |
2008 |
++ " %s/jit-%i.dump is too long, please check the cwd," |
2009 |
++ " JITDUMPDIR, and HOME variables", jit_path, getpid()); |
2010 |
++ return NULL; |
2011 |
++ } |
2012 |
+ |
2013 |
+ fd = open(dump_path, O_CREAT|O_TRUNC|O_RDWR, 0666); |
2014 |
+ if (fd == -1) |
2015 |
+diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c |
2016 |
+index fcc8984bc329..acad8ba06d77 100644 |
2017 |
+--- a/tools/perf/tests/code-reading.c |
2018 |
++++ b/tools/perf/tests/code-reading.c |
2019 |
+@@ -527,6 +527,7 @@ static int do_test_code_reading(bool try_kcore) |
2020 |
+ pid = getpid(); |
2021 |
+ |
2022 |
+ machine = machine__new_host(); |
2023 |
++ machine->env = &perf_env; |
2024 |
+ |
2025 |
+ ret = machine__create_kernel_maps(machine); |
2026 |
+ if (ret < 0) { |
2027 |
+diff --git a/tools/perf/util/env.c b/tools/perf/util/env.c |
2028 |
+index 6276b340f893..b492cb974aa0 100644 |
2029 |
+--- a/tools/perf/util/env.c |
2030 |
++++ b/tools/perf/util/env.c |
2031 |
+@@ -3,6 +3,7 @@ |
2032 |
+ #include "env.h" |
2033 |
+ #include "util.h" |
2034 |
+ #include <errno.h> |
2035 |
++#include <sys/utsname.h> |
2036 |
+ |
2037 |
+ struct perf_env perf_env; |
2038 |
+ |
2039 |
+@@ -87,6 +88,37 @@ int perf_env__read_cpu_topology_map(struct perf_env *env) |
2040 |
+ return 0; |
2041 |
+ } |
2042 |
+ |
2043 |
++static int perf_env__read_arch(struct perf_env *env) |
2044 |
++{ |
2045 |
++ struct utsname uts; |
2046 |
++ |
2047 |
++ if (env->arch) |
2048 |
++ return 0; |
2049 |
++ |
2050 |
++ if (!uname(&uts)) |
2051 |
++ env->arch = strdup(uts.machine); |
2052 |
++ |
2053 |
++ return env->arch ? 0 : -ENOMEM; |
2054 |
++} |
2055 |
++ |
2056 |
++static int perf_env__read_nr_cpus_avail(struct perf_env *env) |
2057 |
++{ |
2058 |
++ if (env->nr_cpus_avail == 0) |
2059 |
++ env->nr_cpus_avail = cpu__max_present_cpu(); |
2060 |
++ |
2061 |
++ return env->nr_cpus_avail ? 0 : -ENOENT; |
2062 |
++} |
2063 |
++ |
2064 |
++const char *perf_env__raw_arch(struct perf_env *env) |
2065 |
++{ |
2066 |
++ return env && !perf_env__read_arch(env) ? env->arch : "unknown"; |
2067 |
++} |
2068 |
++ |
2069 |
++int perf_env__nr_cpus_avail(struct perf_env *env) |
2070 |
++{ |
2071 |
++ return env && !perf_env__read_nr_cpus_avail(env) ? env->nr_cpus_avail : 0; |
2072 |
++} |
2073 |
++ |
2074 |
+ void cpu_cache_level__free(struct cpu_cache_level *cache) |
2075 |
+ { |
2076 |
+ free(cache->type); |
2077 |
+diff --git a/tools/perf/util/env.h b/tools/perf/util/env.h |
2078 |
+index 1eb35b190b34..9aace8452751 100644 |
2079 |
+--- a/tools/perf/util/env.h |
2080 |
++++ b/tools/perf/util/env.h |
2081 |
+@@ -65,4 +65,8 @@ int perf_env__set_cmdline(struct perf_env *env, int argc, const char *argv[]); |
2082 |
+ int perf_env__read_cpu_topology_map(struct perf_env *env); |
2083 |
+ |
2084 |
+ void cpu_cache_level__free(struct cpu_cache_level *cache); |
2085 |
++ |
2086 |
++const char *perf_env__raw_arch(struct perf_env *env); |
2087 |
++int perf_env__nr_cpus_avail(struct perf_env *env); |
2088 |
++ |
2089 |
+ #endif /* __PERF_ENV_H */ |
2090 |
+diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c |
2091 |
+index bd5d5b5e2218..968fd0454e6b 100644 |
2092 |
+--- a/tools/perf/util/machine.c |
2093 |
++++ b/tools/perf/util/machine.c |
2094 |
+@@ -818,6 +818,102 @@ static int machine__get_running_kernel_start(struct machine *machine, |
2095 |
+ return 0; |
2096 |
+ } |
2097 |
+ |
2098 |
++/* Kernel-space maps for symbols that are outside the main kernel map and module maps */ |
2099 |
++struct extra_kernel_map { |
2100 |
++ u64 start; |
2101 |
++ u64 end; |
2102 |
++ u64 pgoff; |
2103 |
++}; |
2104 |
++ |
2105 |
++static int machine__create_extra_kernel_map(struct machine *machine, |
2106 |
++ struct dso *kernel, |
2107 |
++ struct extra_kernel_map *xm) |
2108 |
++{ |
2109 |
++ struct kmap *kmap; |
2110 |
++ struct map *map; |
2111 |
++ |
2112 |
++ map = map__new2(xm->start, kernel, MAP__FUNCTION); |
2113 |
++ if (!map) |
2114 |
++ return -1; |
2115 |
++ |
2116 |
++ map->end = xm->end; |
2117 |
++ map->pgoff = xm->pgoff; |
2118 |
++ |
2119 |
++ kmap = map__kmap(map); |
2120 |
++ |
2121 |
++ kmap->kmaps = &machine->kmaps; |
2122 |
++ |
2123 |
++ map_groups__insert(&machine->kmaps, map); |
2124 |
++ |
2125 |
++ pr_debug2("Added extra kernel map %" PRIx64 "-%" PRIx64 "\n", |
2126 |
++ map->start, map->end); |
2127 |
++ |
2128 |
++ map__put(map); |
2129 |
++ |
2130 |
++ return 0; |
2131 |
++} |
2132 |
++ |
2133 |
++static u64 find_entry_trampoline(struct dso *dso) |
2134 |
++{ |
2135 |
++ /* Duplicates are removed so lookup all aliases */ |
2136 |
++ const char *syms[] = { |
2137 |
++ "_entry_trampoline", |
2138 |
++ "__entry_trampoline_start", |
2139 |
++ "entry_SYSCALL_64_trampoline", |
2140 |
++ }; |
2141 |
++ struct symbol *sym = dso__first_symbol(dso, MAP__FUNCTION); |
2142 |
++ unsigned int i; |
2143 |
++ |
2144 |
++ for (; sym; sym = dso__next_symbol(sym)) { |
2145 |
++ if (sym->binding != STB_GLOBAL) |
2146 |
++ continue; |
2147 |
++ for (i = 0; i < ARRAY_SIZE(syms); i++) { |
2148 |
++ if (!strcmp(sym->name, syms[i])) |
2149 |
++ return sym->start; |
2150 |
++ } |
2151 |
++ } |
2152 |
++ |
2153 |
++ return 0; |
2154 |
++} |
2155 |
++ |
2156 |
++/* |
2157 |
++ * These values can be used for kernels that do not have symbols for the entry |
2158 |
++ * trampolines in kallsyms. |
2159 |
++ */ |
2160 |
++#define X86_64_CPU_ENTRY_AREA_PER_CPU 0xfffffe0000000000ULL |
2161 |
++#define X86_64_CPU_ENTRY_AREA_SIZE 0x2c000 |
2162 |
++#define X86_64_ENTRY_TRAMPOLINE 0x6000 |
2163 |
++ |
2164 |
++/* Map x86_64 PTI entry trampolines */ |
2165 |
++int machine__map_x86_64_entry_trampolines(struct machine *machine, |
2166 |
++ struct dso *kernel) |
2167 |
++{ |
2168 |
++ u64 pgoff = find_entry_trampoline(kernel); |
2169 |
++ int nr_cpus_avail, cpu; |
2170 |
++ |
2171 |
++ if (!pgoff) |
2172 |
++ return 0; |
2173 |
++ |
2174 |
++ nr_cpus_avail = machine__nr_cpus_avail(machine); |
2175 |
++ |
2176 |
++ /* Add a 1 page map for each CPU's entry trampoline */ |
2177 |
++ for (cpu = 0; cpu < nr_cpus_avail; cpu++) { |
2178 |
++ u64 va = X86_64_CPU_ENTRY_AREA_PER_CPU + |
2179 |
++ cpu * X86_64_CPU_ENTRY_AREA_SIZE + |
2180 |
++ X86_64_ENTRY_TRAMPOLINE; |
2181 |
++ struct extra_kernel_map xm = { |
2182 |
++ .start = va, |
2183 |
++ .end = va + page_size, |
2184 |
++ .pgoff = pgoff, |
2185 |
++ }; |
2186 |
++ |
2187 |
++ if (machine__create_extra_kernel_map(machine, kernel, &xm) < 0) |
2188 |
++ return -1; |
2189 |
++ } |
2190 |
++ |
2191 |
++ return 0; |
2192 |
++} |
2193 |
++ |
2194 |
+ int __machine__create_kernel_maps(struct machine *machine, struct dso *kernel) |
2195 |
+ { |
2196 |
+ int type; |
2197 |
+@@ -2238,6 +2334,20 @@ int machine__set_current_tid(struct machine *machine, int cpu, pid_t pid, |
2198 |
+ return 0; |
2199 |
+ } |
2200 |
+ |
2201 |
++/* |
2202 |
++ * Compares the raw arch string. N.B. see instead perf_env__arch() if a |
2203 |
++ * normalized arch is needed. |
2204 |
++ */ |
2205 |
++bool machine__is(struct machine *machine, const char *arch) |
2206 |
++{ |
2207 |
++ return machine && !strcmp(perf_env__raw_arch(machine->env), arch); |
2208 |
++} |
2209 |
++ |
2210 |
++int machine__nr_cpus_avail(struct machine *machine) |
2211 |
++{ |
2212 |
++ return machine ? perf_env__nr_cpus_avail(machine->env) : 0; |
2213 |
++} |
2214 |
++ |
2215 |
+ int machine__get_kernel_start(struct machine *machine) |
2216 |
+ { |
2217 |
+ struct map *map = machine__kernel_map(machine); |
2218 |
+@@ -2254,7 +2364,12 @@ int machine__get_kernel_start(struct machine *machine) |
2219 |
+ machine->kernel_start = 1ULL << 63; |
2220 |
+ if (map) { |
2221 |
+ err = map__load(map); |
2222 |
+- if (!err) |
2223 |
++ /* |
2224 |
++ * On x86_64, PTI entry trampolines are less than the |
2225 |
++ * start of kernel text, but still above 2^63. So leave |
2226 |
++ * kernel_start = 1ULL << 63 for x86_64. |
2227 |
++ */ |
2228 |
++ if (!err && !machine__is(machine, "x86_64")) |
2229 |
+ machine->kernel_start = map->start; |
2230 |
+ } |
2231 |
+ return err; |
2232 |
+diff --git a/tools/perf/util/machine.h b/tools/perf/util/machine.h |
2233 |
+index d551aa80a59b..13041b036a5b 100644 |
2234 |
+--- a/tools/perf/util/machine.h |
2235 |
++++ b/tools/perf/util/machine.h |
2236 |
+@@ -169,6 +169,9 @@ static inline bool machine__is_host(struct machine *machine) |
2237 |
+ return machine ? machine->pid == HOST_KERNEL_ID : false; |
2238 |
+ } |
2239 |
+ |
2240 |
++bool machine__is(struct machine *machine, const char *arch); |
2241 |
++int machine__nr_cpus_avail(struct machine *machine); |
2242 |
++ |
2243 |
+ struct thread *__machine__findnew_thread(struct machine *machine, pid_t pid, pid_t tid); |
2244 |
+ struct thread *machine__findnew_thread(struct machine *machine, pid_t pid, pid_t tid); |
2245 |
+ |
2246 |
+@@ -263,4 +266,7 @@ int machine__set_current_tid(struct machine *machine, int cpu, pid_t pid, |
2247 |
+ */ |
2248 |
+ char *machine__resolve_kernel_addr(void *vmachine, unsigned long long *addrp, char **modp); |
2249 |
+ |
2250 |
++int machine__map_x86_64_entry_trampolines(struct machine *machine, |
2251 |
++ struct dso *kernel); |
2252 |
++ |
2253 |
+ #endif /* __PERF_MACHINE_H */ |
2254 |
+diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c |
2255 |
+index 2de770511e70..8ad4296de98b 100644 |
2256 |
+--- a/tools/perf/util/symbol-elf.c |
2257 |
++++ b/tools/perf/util/symbol-elf.c |
2258 |
+@@ -338,7 +338,17 @@ int dso__synthesize_plt_symbols(struct dso *dso, struct symsrc *ss, struct map * |
2259 |
+ plt_entry_size = 16; |
2260 |
+ break; |
2261 |
+ |
2262 |
+- default: /* FIXME: s390/alpha/mips/parisc/poperpc/sh/sparc/xtensa need to be checked */ |
2263 |
++ case EM_SPARC: |
2264 |
++ plt_header_size = 48; |
2265 |
++ plt_entry_size = 12; |
2266 |
++ break; |
2267 |
++ |
2268 |
++ case EM_SPARCV9: |
2269 |
++ plt_header_size = 128; |
2270 |
++ plt_entry_size = 32; |
2271 |
++ break; |
2272 |
++ |
2273 |
++ default: /* FIXME: s390/alpha/mips/parisc/poperpc/sh/xtensa need to be checked */ |
2274 |
+ plt_header_size = shdr_plt.sh_entsize; |
2275 |
+ plt_entry_size = shdr_plt.sh_entsize; |
2276 |
+ break; |
2277 |
+diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c |
2278 |
+index ec40e47aa198..3936f69f385c 100644 |
2279 |
+--- a/tools/perf/util/symbol.c |
2280 |
++++ b/tools/perf/util/symbol.c |
2281 |
+@@ -1513,20 +1513,22 @@ int dso__load(struct dso *dso, struct map *map) |
2282 |
+ goto out; |
2283 |
+ } |
2284 |
+ |
2285 |
++ if (map->groups && map->groups->machine) |
2286 |
++ machine = map->groups->machine; |
2287 |
++ else |
2288 |
++ machine = NULL; |
2289 |
++ |
2290 |
+ if (dso->kernel) { |
2291 |
+ if (dso->kernel == DSO_TYPE_KERNEL) |
2292 |
+ ret = dso__load_kernel_sym(dso, map); |
2293 |
+ else if (dso->kernel == DSO_TYPE_GUEST_KERNEL) |
2294 |
+ ret = dso__load_guest_kernel_sym(dso, map); |
2295 |
+ |
2296 |
++ if (machine__is(machine, "x86_64")) |
2297 |
++ machine__map_x86_64_entry_trampolines(machine, dso); |
2298 |
+ goto out; |
2299 |
+ } |
2300 |
+ |
2301 |
+- if (map->groups && map->groups->machine) |
2302 |
+- machine = map->groups->machine; |
2303 |
+- else |
2304 |
+- machine = NULL; |
2305 |
+- |
2306 |
+ dso->adjust_symbols = 0; |
2307 |
+ |
2308 |
+ if (perfmap) { |