Gentoo Archives: gentoo-commits

From: Alice Ferrazzi <alicef@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:5.11 commit in: /
Date: Fri, 26 Feb 2021 09:59:15
Message-Id: 1614333509.71563ba6983e3b7de7d3e2b19c7e390769dc9fc1.alicef@gentoo
1 commit: 71563ba6983e3b7de7d3e2b19c7e390769dc9fc1
2 Author: Alice Ferrazzi <alicef <AT> gentoo <DOT> org>
3 AuthorDate: Fri Feb 26 09:58:22 2021 +0000
4 Commit: Alice Ferrazzi <alicef <AT> gentoo <DOT> org>
5 CommitDate: Fri Feb 26 09:58:29 2021 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=71563ba6
7
8 Linux patch 5.11.2
9
10 Signed-off-by: Alice Ferrazzi <alicef <AT> gentoo.org>
11
12 0000_README | 4 +
13 1001_linux-5.11.2.patch | 380 ++++++++++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 384 insertions(+)
15
16 diff --git a/0000_README b/0000_README
17 index 530e7ef..7792101 100644
18 --- a/0000_README
19 +++ b/0000_README
20 @@ -47,6 +47,10 @@ Patch: 1000_linux-5.11.1.patch
21 From: http://www.kernel.org
22 Desc: Linux 5.11.1
23
24 +Patch: 1001_linux-5.11.2.patch
25 +From: http://www.kernel.org
26 +Desc: Linux 5.11.2
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/1001_linux-5.11.2.patch b/1001_linux-5.11.2.patch
33 new file mode 100644
34 index 0000000..8ba7d24
35 --- /dev/null
36 +++ b/1001_linux-5.11.2.patch
37 @@ -0,0 +1,380 @@
38 +diff --git a/Makefile b/Makefile
39 +index 0b9ae470a7145..617be9fd59ce5 100644
40 +--- a/Makefile
41 ++++ b/Makefile
42 +@@ -1,7 +1,7 @@
43 + # SPDX-License-Identifier: GPL-2.0
44 + VERSION = 5
45 + PATCHLEVEL = 11
46 +-SUBLEVEL = 1
47 ++SUBLEVEL = 2
48 + EXTRAVERSION =
49 + NAME = 💕 Valentine's Day Edition 💕
50 +
51 +diff --git a/arch/arm64/boot/dts/nvidia/tegra210.dtsi b/arch/arm64/boot/dts/nvidia/tegra210.dtsi
52 +index 4fbf8c15b0a13..fd33b4d28ef3c 100644
53 +--- a/arch/arm64/boot/dts/nvidia/tegra210.dtsi
54 ++++ b/arch/arm64/boot/dts/nvidia/tegra210.dtsi
55 +@@ -997,6 +997,7 @@
56 + <&tegra_car 128>, /* hda2hdmi */
57 + <&tegra_car 111>; /* hda2codec_2x */
58 + reset-names = "hda", "hda2hdmi", "hda2codec_2x";
59 ++ power-domains = <&pd_sor>;
60 + status = "disabled";
61 + };
62 +
63 +diff --git a/arch/s390/pci/pci_mmio.c b/arch/s390/pci/pci_mmio.c
64 +index 18f2d10c31764..474617b886487 100644
65 +--- a/arch/s390/pci/pci_mmio.c
66 ++++ b/arch/s390/pci/pci_mmio.c
67 +@@ -170,7 +170,7 @@ SYSCALL_DEFINE3(s390_pci_mmio_write, unsigned long, mmio_addr,
68 + if (!(vma->vm_flags & VM_WRITE))
69 + goto out_unlock_mmap;
70 +
71 +- ret = follow_pte(vma->vm_mm, mmio_addr, NULL, &ptep, NULL, &ptl);
72 ++ ret = follow_pte(vma->vm_mm, mmio_addr, &ptep, &ptl);
73 + if (ret)
74 + goto out_unlock_mmap;
75 +
76 +@@ -311,7 +311,7 @@ SYSCALL_DEFINE3(s390_pci_mmio_read, unsigned long, mmio_addr,
77 + if (!(vma->vm_flags & VM_WRITE))
78 + goto out_unlock_mmap;
79 +
80 +- ret = follow_pte(vma->vm_mm, mmio_addr, NULL, &ptep, NULL, &ptl);
81 ++ ret = follow_pte(vma->vm_mm, mmio_addr, &ptep, &ptl);
82 + if (ret)
83 + goto out_unlock_mmap;
84 +
85 +diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
86 +index 6d16481aa29de..ed861245ecf04 100644
87 +--- a/arch/x86/kvm/mmu/mmu.c
88 ++++ b/arch/x86/kvm/mmu/mmu.c
89 +@@ -2417,7 +2417,7 @@ static unsigned long kvm_mmu_zap_oldest_mmu_pages(struct kvm *kvm,
90 + return 0;
91 +
92 + restart:
93 +- list_for_each_entry_safe(sp, tmp, &kvm->arch.active_mmu_pages, link) {
94 ++ list_for_each_entry_safe_reverse(sp, tmp, &kvm->arch.active_mmu_pages, link) {
95 + /*
96 + * Don't zap active root pages, the page itself can't be freed
97 + * and zapping it will just force vCPUs to realloc and reload.
98 +diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
99 +index 1b690164ab5b9..da57c561642c4 100644
100 +--- a/drivers/bluetooth/btusb.c
101 ++++ b/drivers/bluetooth/btusb.c
102 +@@ -4065,6 +4065,13 @@ static int btusb_setup_qca(struct hci_dev *hdev)
103 + info = &qca_devices_table[i];
104 + }
105 + if (!info) {
106 ++ /* If the rom_version is not matched in the qca_devices_table
107 ++ * and the high ROM version is not zero, we assume this chip no
108 ++ * need to load the rampatch and nvm.
109 ++ */
110 ++ if (ver_rom & ~0xffffU)
111 ++ return 0;
112 ++
113 + bt_dev_err(hdev, "don't support firmware rome 0x%x", ver_rom);
114 + return -ENODEV;
115 + }
116 +diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
117 +index 56172fe6995cd..8a8b2b982f83c 100644
118 +--- a/drivers/hid/hid-core.c
119 ++++ b/drivers/hid/hid-core.c
120 +@@ -90,7 +90,7 @@ EXPORT_SYMBOL_GPL(hid_register_report);
121 + * Register a new field for this report.
122 + */
123 +
124 +-static struct hid_field *hid_register_field(struct hid_report *report, unsigned usages, unsigned values)
125 ++static struct hid_field *hid_register_field(struct hid_report *report, unsigned usages)
126 + {
127 + struct hid_field *field;
128 +
129 +@@ -101,7 +101,7 @@ static struct hid_field *hid_register_field(struct hid_report *report, unsigned
130 +
131 + field = kzalloc((sizeof(struct hid_field) +
132 + usages * sizeof(struct hid_usage) +
133 +- values * sizeof(unsigned)), GFP_KERNEL);
134 ++ usages * sizeof(unsigned)), GFP_KERNEL);
135 + if (!field)
136 + return NULL;
137 +
138 +@@ -300,7 +300,7 @@ static int hid_add_field(struct hid_parser *parser, unsigned report_type, unsign
139 + usages = max_t(unsigned, parser->local.usage_index,
140 + parser->global.report_count);
141 +
142 +- field = hid_register_field(report, usages, parser->global.report_count);
143 ++ field = hid_register_field(report, usages);
144 + if (!field)
145 + return 0;
146 +
147 +diff --git a/drivers/hwmon/dell-smm-hwmon.c b/drivers/hwmon/dell-smm-hwmon.c
148 +index ec448f5f2dc33..73b9db9e3aab6 100644
149 +--- a/drivers/hwmon/dell-smm-hwmon.c
150 ++++ b/drivers/hwmon/dell-smm-hwmon.c
151 +@@ -1159,6 +1159,13 @@ static struct dmi_system_id i8k_blacklist_fan_support_dmi_table[] __initdata = {
152 + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "XPS13 9333"),
153 + },
154 + },
155 ++ {
156 ++ .ident = "Dell XPS 15 L502X",
157 ++ .matches = {
158 ++ DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
159 ++ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Dell System XPS L502X"),
160 ++ },
161 ++ },
162 + { }
163 + };
164 +
165 +diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
166 +index 1b4eb7046b078..6ade3daf78584 100644
167 +--- a/drivers/usb/core/quirks.c
168 ++++ b/drivers/usb/core/quirks.c
169 +@@ -391,6 +391,9 @@ static const struct usb_device_id usb_quirk_list[] = {
170 + /* X-Rite/Gretag-Macbeth Eye-One Pro display colorimeter */
171 + { USB_DEVICE(0x0971, 0x2000), .driver_info = USB_QUIRK_NO_SET_INTF },
172 +
173 ++ /* ELMO L-12F document camera */
174 ++ { USB_DEVICE(0x09a1, 0x0028), .driver_info = USB_QUIRK_DELAY_CTRL_MSG },
175 ++
176 + /* Broadcom BCM92035DGROM BT dongle */
177 + { USB_DEVICE(0x0a5c, 0x2021), .driver_info = USB_QUIRK_RESET_RESUME },
178 +
179 +@@ -415,6 +418,9 @@ static const struct usb_device_id usb_quirk_list[] = {
180 + { USB_DEVICE(0x10d6, 0x2200), .driver_info =
181 + USB_QUIRK_STRING_FETCH_255 },
182 +
183 ++ /* novation SoundControl XL */
184 ++ { USB_DEVICE(0x1235, 0x0061), .driver_info = USB_QUIRK_RESET_RESUME },
185 ++
186 + /* Huawei 4G LTE module */
187 + { USB_DEVICE(0x12d1, 0x15bb), .driver_info =
188 + USB_QUIRK_DISCONNECT_SUSPEND },
189 +@@ -495,9 +501,6 @@ static const struct usb_device_id usb_quirk_list[] = {
190 + /* INTEL VALUE SSD */
191 + { USB_DEVICE(0x8086, 0xf1a5), .driver_info = USB_QUIRK_RESET_RESUME },
192 +
193 +- /* novation SoundControl XL */
194 +- { USB_DEVICE(0x1235, 0x0061), .driver_info = USB_QUIRK_RESET_RESUME },
195 +-
196 + { } /* terminating entry must be last */
197 + };
198 +
199 +diff --git a/fs/dax.c b/fs/dax.c
200 +index 26d5dcd2d69e5..b3d27fdc67752 100644
201 +--- a/fs/dax.c
202 ++++ b/fs/dax.c
203 +@@ -810,11 +810,12 @@ static void dax_entry_mkclean(struct address_space *mapping, pgoff_t index,
204 + address = pgoff_address(index, vma);
205 +
206 + /*
207 +- * Note because we provide range to follow_pte it will call
208 ++ * follow_invalidate_pte() will use the range to call
209 + * mmu_notifier_invalidate_range_start() on our behalf before
210 + * taking any lock.
211 + */
212 +- if (follow_pte(vma->vm_mm, address, &range, &ptep, &pmdp, &ptl))
213 ++ if (follow_invalidate_pte(vma->vm_mm, address, &range, &ptep,
214 ++ &pmdp, &ptl))
215 + continue;
216 +
217 + /*
218 +diff --git a/fs/ntfs/inode.c b/fs/ntfs/inode.c
219 +index f7e4cbc26eaf9..be4ff9386ec05 100644
220 +--- a/fs/ntfs/inode.c
221 ++++ b/fs/ntfs/inode.c
222 +@@ -629,6 +629,12 @@ static int ntfs_read_locked_inode(struct inode *vi)
223 + }
224 + a = ctx->attr;
225 + /* Get the standard information attribute value. */
226 ++ if ((u8 *)a + le16_to_cpu(a->data.resident.value_offset)
227 ++ + le32_to_cpu(a->data.resident.value_length) >
228 ++ (u8 *)ctx->mrec + vol->mft_record_size) {
229 ++ ntfs_error(vi->i_sb, "Corrupt standard information attribute in inode.");
230 ++ goto unm_err_out;
231 ++ }
232 + si = (STANDARD_INFORMATION*)((u8*)a +
233 + le16_to_cpu(a->data.resident.value_offset));
234 +
235 +diff --git a/include/linux/mm.h b/include/linux/mm.h
236 +index ecdf8a8cd6aeb..24b292fce8e59 100644
237 +--- a/include/linux/mm.h
238 ++++ b/include/linux/mm.h
239 +@@ -1658,9 +1658,11 @@ void free_pgd_range(struct mmu_gather *tlb, unsigned long addr,
240 + unsigned long end, unsigned long floor, unsigned long ceiling);
241 + int
242 + copy_page_range(struct vm_area_struct *dst_vma, struct vm_area_struct *src_vma);
243 ++int follow_invalidate_pte(struct mm_struct *mm, unsigned long address,
244 ++ struct mmu_notifier_range *range, pte_t **ptepp,
245 ++ pmd_t **pmdpp, spinlock_t **ptlp);
246 + int follow_pte(struct mm_struct *mm, unsigned long address,
247 +- struct mmu_notifier_range *range, pte_t **ptepp, pmd_t **pmdpp,
248 +- spinlock_t **ptlp);
249 ++ pte_t **ptepp, spinlock_t **ptlp);
250 + int follow_pfn(struct vm_area_struct *vma, unsigned long address,
251 + unsigned long *pfn);
252 + int follow_phys(struct vm_area_struct *vma, unsigned long address,
253 +diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
254 +index 37581919e050c..20babdd06278f 100644
255 +--- a/kernel/bpf/verifier.c
256 ++++ b/kernel/bpf/verifier.c
257 +@@ -11006,7 +11006,7 @@ static int fixup_bpf_calls(struct bpf_verifier_env *env)
258 + bool isdiv = BPF_OP(insn->code) == BPF_DIV;
259 + struct bpf_insn *patchlet;
260 + struct bpf_insn chk_and_div[] = {
261 +- /* Rx div 0 -> 0 */
262 ++ /* [R,W]x div 0 -> 0 */
263 + BPF_RAW_INSN((is64 ? BPF_JMP : BPF_JMP32) |
264 + BPF_JNE | BPF_K, insn->src_reg,
265 + 0, 2, 0),
266 +@@ -11015,16 +11015,18 @@ static int fixup_bpf_calls(struct bpf_verifier_env *env)
267 + *insn,
268 + };
269 + struct bpf_insn chk_and_mod[] = {
270 +- /* Rx mod 0 -> Rx */
271 ++ /* [R,W]x mod 0 -> [R,W]x */
272 + BPF_RAW_INSN((is64 ? BPF_JMP : BPF_JMP32) |
273 + BPF_JEQ | BPF_K, insn->src_reg,
274 +- 0, 1, 0),
275 ++ 0, 1 + (is64 ? 0 : 1), 0),
276 + *insn,
277 ++ BPF_JMP_IMM(BPF_JA, 0, 0, 1),
278 ++ BPF_MOV32_REG(insn->dst_reg, insn->dst_reg),
279 + };
280 +
281 + patchlet = isdiv ? chk_and_div : chk_and_mod;
282 + cnt = isdiv ? ARRAY_SIZE(chk_and_div) :
283 +- ARRAY_SIZE(chk_and_mod);
284 ++ ARRAY_SIZE(chk_and_mod) - (is64 ? 2 : 0);
285 +
286 + new_prog = bpf_patch_insn_data(env, i + delta, patchlet, cnt);
287 + if (!new_prog)
288 +diff --git a/mm/memory.c b/mm/memory.c
289 +index feff48e1465a6..985dac0958dcf 100644
290 +--- a/mm/memory.c
291 ++++ b/mm/memory.c
292 +@@ -4709,9 +4709,9 @@ int __pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long address)
293 + }
294 + #endif /* __PAGETABLE_PMD_FOLDED */
295 +
296 +-int follow_pte(struct mm_struct *mm, unsigned long address,
297 +- struct mmu_notifier_range *range, pte_t **ptepp, pmd_t **pmdpp,
298 +- spinlock_t **ptlp)
299 ++int follow_invalidate_pte(struct mm_struct *mm, unsigned long address,
300 ++ struct mmu_notifier_range *range, pte_t **ptepp,
301 ++ pmd_t **pmdpp, spinlock_t **ptlp)
302 + {
303 + pgd_t *pgd;
304 + p4d_t *p4d;
305 +@@ -4776,6 +4776,34 @@ out:
306 + return -EINVAL;
307 + }
308 +
309 ++/**
310 ++ * follow_pte - look up PTE at a user virtual address
311 ++ * @mm: the mm_struct of the target address space
312 ++ * @address: user virtual address
313 ++ * @ptepp: location to store found PTE
314 ++ * @ptlp: location to store the lock for the PTE
315 ++ *
316 ++ * On a successful return, the pointer to the PTE is stored in @ptepp;
317 ++ * the corresponding lock is taken and its location is stored in @ptlp.
318 ++ * The contents of the PTE are only stable until @ptlp is released;
319 ++ * any further use, if any, must be protected against invalidation
320 ++ * with MMU notifiers.
321 ++ *
322 ++ * Only IO mappings and raw PFN mappings are allowed. The mmap semaphore
323 ++ * should be taken for read.
324 ++ *
325 ++ * KVM uses this function. While it is arguably less bad than ``follow_pfn``,
326 ++ * it is not a good general-purpose API.
327 ++ *
328 ++ * Return: zero on success, -ve otherwise.
329 ++ */
330 ++int follow_pte(struct mm_struct *mm, unsigned long address,
331 ++ pte_t **ptepp, spinlock_t **ptlp)
332 ++{
333 ++ return follow_invalidate_pte(mm, address, NULL, ptepp, NULL, ptlp);
334 ++}
335 ++EXPORT_SYMBOL_GPL(follow_pte);
336 ++
337 + /**
338 + * follow_pfn - look up PFN at a user virtual address
339 + * @vma: memory mapping
340 +@@ -4784,6 +4812,9 @@ out:
341 + *
342 + * Only IO mappings and raw PFN mappings are allowed.
343 + *
344 ++ * This function does not allow the caller to read the permissions
345 ++ * of the PTE. Do not use it.
346 ++ *
347 + * Return: zero and the pfn at @pfn on success, -ve otherwise.
348 + */
349 + int follow_pfn(struct vm_area_struct *vma, unsigned long address,
350 +@@ -4796,7 +4827,7 @@ int follow_pfn(struct vm_area_struct *vma, unsigned long address,
351 + if (!(vma->vm_flags & (VM_IO | VM_PFNMAP)))
352 + return ret;
353 +
354 +- ret = follow_pte(vma->vm_mm, address, NULL, &ptep, NULL, &ptl);
355 ++ ret = follow_pte(vma->vm_mm, address, &ptep, &ptl);
356 + if (ret)
357 + return ret;
358 + *pfn = pte_pfn(*ptep);
359 +@@ -4817,7 +4848,7 @@ int follow_phys(struct vm_area_struct *vma,
360 + if (!(vma->vm_flags & (VM_IO | VM_PFNMAP)))
361 + goto out;
362 +
363 +- if (follow_pte(vma->vm_mm, address, NULL, &ptep, NULL, &ptl))
364 ++ if (follow_pte(vma->vm_mm, address, &ptep, &ptl))
365 + goto out;
366 + pte = *ptep;
367 +
368 +diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
369 +index 8367d88ce39bf..2caba28289827 100644
370 +--- a/virt/kvm/kvm_main.c
371 ++++ b/virt/kvm/kvm_main.c
372 +@@ -1903,10 +1903,12 @@ static int hva_to_pfn_remapped(struct vm_area_struct *vma,
373 + bool write_fault, bool *writable,
374 + kvm_pfn_t *p_pfn)
375 + {
376 +- unsigned long pfn;
377 ++ kvm_pfn_t pfn;
378 ++ pte_t *ptep;
379 ++ spinlock_t *ptl;
380 + int r;
381 +
382 +- r = follow_pfn(vma, addr, &pfn);
383 ++ r = follow_pte(vma->vm_mm, addr, &ptep, &ptl);
384 + if (r) {
385 + /*
386 + * get_user_pages fails for VM_IO and VM_PFNMAP vmas and does
387 +@@ -1921,14 +1923,19 @@ static int hva_to_pfn_remapped(struct vm_area_struct *vma,
388 + if (r)
389 + return r;
390 +
391 +- r = follow_pfn(vma, addr, &pfn);
392 ++ r = follow_pte(vma->vm_mm, addr, &ptep, &ptl);
393 + if (r)
394 + return r;
395 ++ }
396 +
397 ++ if (write_fault && !pte_write(*ptep)) {
398 ++ pfn = KVM_PFN_ERR_RO_FAULT;
399 ++ goto out;
400 + }
401 +
402 + if (writable)
403 +- *writable = true;
404 ++ *writable = pte_write(*ptep);
405 ++ pfn = pte_pfn(*ptep);
406 +
407 + /*
408 + * Get a reference here because callers of *hva_to_pfn* and
409 +@@ -1943,6 +1950,8 @@ static int hva_to_pfn_remapped(struct vm_area_struct *vma,
410 + */
411 + kvm_get_pfn(pfn);
412 +
413 ++out:
414 ++ pte_unmap_unlock(ptep, ptl);
415 + *p_pfn = pfn;
416 + return 0;
417 + }