1 |
commit: 55ef83e2a885dbd23a560074a45d02342fd46d80 |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Nov 21 20:44:03 2021 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Nov 21 20:44:03 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=55ef83e2 |
7 |
|
8 |
Linux patch 5.4.161 |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1160_linux-5.4.161.patch | 309 +++++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 313 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index 22e6b259..c4cd1ed0 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -683,6 +683,10 @@ Patch: 1159_linux-5.4.160.patch |
21 |
From: http://www.kernel.org |
22 |
Desc: Linux 5.4.160 |
23 |
|
24 |
+Patch: 1160_linux-5.4.161.patch |
25 |
+From: http://www.kernel.org |
26 |
+Desc: Linux 5.4.161 |
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/1160_linux-5.4.161.patch b/1160_linux-5.4.161.patch |
33 |
new file mode 100644 |
34 |
index 00000000..9c2004cc |
35 |
--- /dev/null |
36 |
+++ b/1160_linux-5.4.161.patch |
37 |
@@ -0,0 +1,309 @@ |
38 |
+diff --git a/Makefile b/Makefile |
39 |
+index e938662dab289..f552556966f1d 100644 |
40 |
+--- a/Makefile |
41 |
++++ b/Makefile |
42 |
+@@ -1,7 +1,7 @@ |
43 |
+ # SPDX-License-Identifier: GPL-2.0 |
44 |
+ VERSION = 5 |
45 |
+ PATCHLEVEL = 4 |
46 |
+-SUBLEVEL = 160 |
47 |
++SUBLEVEL = 161 |
48 |
+ EXTRAVERSION = |
49 |
+ NAME = Kleptomaniac Octopus |
50 |
+ |
51 |
+diff --git a/arch/mips/include/asm/cmpxchg.h b/arch/mips/include/asm/cmpxchg.h |
52 |
+index f6136871561dc..9182ce828f540 100644 |
53 |
+--- a/arch/mips/include/asm/cmpxchg.h |
54 |
++++ b/arch/mips/include/asm/cmpxchg.h |
55 |
+@@ -239,6 +239,7 @@ static inline unsigned long __cmpxchg64(volatile void *ptr, |
56 |
+ " .set " MIPS_ISA_ARCH_LEVEL " \n" |
57 |
+ /* Load 64 bits from ptr */ |
58 |
+ "1: lld %L0, %3 # __cmpxchg64 \n" |
59 |
++ " .set pop \n" |
60 |
+ /* |
61 |
+ * Split the 64 bit value we loaded into the 2 registers that hold the |
62 |
+ * ret variable. |
63 |
+@@ -266,6 +267,8 @@ static inline unsigned long __cmpxchg64(volatile void *ptr, |
64 |
+ " or %L1, %L1, $at \n" |
65 |
+ " .set at \n" |
66 |
+ # endif |
67 |
++ " .set push \n" |
68 |
++ " .set " MIPS_ISA_ARCH_LEVEL " \n" |
69 |
+ /* Attempt to store new at ptr */ |
70 |
+ " scd %L1, %2 \n" |
71 |
+ /* If we failed, loop! */ |
72 |
+diff --git a/arch/parisc/kernel/entry.S b/arch/parisc/kernel/entry.S |
73 |
+index 7d14e9ae18fb1..2f64f112934b6 100644 |
74 |
+--- a/arch/parisc/kernel/entry.S |
75 |
++++ b/arch/parisc/kernel/entry.S |
76 |
+@@ -1842,7 +1842,7 @@ syscall_restore: |
77 |
+ |
78 |
+ /* Are we being ptraced? */ |
79 |
+ LDREG TI_FLAGS-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r19 |
80 |
+- ldi _TIF_SYSCALL_TRACE_MASK,%r2 |
81 |
++ ldi _TIF_SINGLESTEP|_TIF_BLOCKSTEP,%r2 |
82 |
+ and,COND(=) %r19,%r2,%r0 |
83 |
+ b,n syscall_restore_rfi |
84 |
+ |
85 |
+diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c |
86 |
+index c8bd243717b7b..d0cc6c0d74d6b 100644 |
87 |
+--- a/drivers/pci/msi.c |
88 |
++++ b/drivers/pci/msi.c |
89 |
+@@ -395,18 +395,6 @@ static void free_msi_irqs(struct pci_dev *dev) |
90 |
+ for (i = 0; i < entry->nvec_used; i++) |
91 |
+ BUG_ON(irq_has_action(entry->irq + i)); |
92 |
+ |
93 |
+- pci_msi_teardown_msi_irqs(dev); |
94 |
+- |
95 |
+- list_for_each_entry_safe(entry, tmp, msi_list, list) { |
96 |
+- if (entry->msi_attrib.is_msix) { |
97 |
+- if (list_is_last(&entry->list, msi_list)) |
98 |
+- iounmap(entry->mask_base); |
99 |
+- } |
100 |
+- |
101 |
+- list_del(&entry->list); |
102 |
+- free_msi_entry(entry); |
103 |
+- } |
104 |
+- |
105 |
+ if (dev->msi_irq_groups) { |
106 |
+ sysfs_remove_groups(&dev->dev.kobj, dev->msi_irq_groups); |
107 |
+ msi_attrs = dev->msi_irq_groups[0]->attrs; |
108 |
+@@ -422,6 +410,18 @@ static void free_msi_irqs(struct pci_dev *dev) |
109 |
+ kfree(dev->msi_irq_groups); |
110 |
+ dev->msi_irq_groups = NULL; |
111 |
+ } |
112 |
++ |
113 |
++ pci_msi_teardown_msi_irqs(dev); |
114 |
++ |
115 |
++ list_for_each_entry_safe(entry, tmp, msi_list, list) { |
116 |
++ if (entry->msi_attrib.is_msix) { |
117 |
++ if (list_is_last(&entry->list, msi_list)) |
118 |
++ iounmap(entry->mask_base); |
119 |
++ } |
120 |
++ |
121 |
++ list_del(&entry->list); |
122 |
++ free_msi_entry(entry); |
123 |
++ } |
124 |
+ } |
125 |
+ |
126 |
+ static void pci_intx_for_msi(struct pci_dev *dev, int enable) |
127 |
+@@ -591,6 +591,9 @@ msi_setup_entry(struct pci_dev *dev, int nvec, struct irq_affinity *affd) |
128 |
+ goto out; |
129 |
+ |
130 |
+ pci_read_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, &control); |
131 |
++ /* Lies, damned lies, and MSIs */ |
132 |
++ if (dev->dev_flags & PCI_DEV_FLAGS_HAS_MSI_MASKING) |
133 |
++ control |= PCI_MSI_FLAGS_MASKBIT; |
134 |
+ |
135 |
+ entry->msi_attrib.is_msix = 0; |
136 |
+ entry->msi_attrib.is_64 = !!(control & PCI_MSI_FLAGS_64BIT); |
137 |
+diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c |
138 |
+index fb7c5518447da..cf3986d4413f7 100644 |
139 |
+--- a/drivers/pci/quirks.c |
140 |
++++ b/drivers/pci/quirks.c |
141 |
+@@ -5777,3 +5777,9 @@ static void apex_pci_fixup_class(struct pci_dev *pdev) |
142 |
+ } |
143 |
+ DECLARE_PCI_FIXUP_CLASS_HEADER(0x1ac1, 0x089a, |
144 |
+ PCI_CLASS_NOT_DEFINED, 8, apex_pci_fixup_class); |
145 |
++ |
146 |
++static void nvidia_ion_ahci_fixup(struct pci_dev *pdev) |
147 |
++{ |
148 |
++ pdev->dev_flags |= PCI_DEV_FLAGS_HAS_MSI_MASKING; |
149 |
++} |
150 |
++DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NVIDIA, 0x0ab8, nvidia_ion_ahci_fixup); |
151 |
+diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c |
152 |
+index 24396f4d5f2d3..29c7a76d2c658 100644 |
153 |
+--- a/drivers/scsi/ufs/ufshcd.c |
154 |
++++ b/drivers/scsi/ufs/ufshcd.c |
155 |
+@@ -4748,7 +4748,8 @@ ufshcd_transfer_rsp_status(struct ufs_hba *hba, struct ufshcd_lrb *lrbp) |
156 |
+ break; |
157 |
+ } /* end of switch */ |
158 |
+ |
159 |
+- if ((host_byte(result) != DID_OK) && !hba->silence_err_logs) |
160 |
++ if ((host_byte(result) != DID_OK) && |
161 |
++ (host_byte(result) != DID_REQUEUE) && !hba->silence_err_logs) |
162 |
+ ufshcd_print_trs(hba, 1 << lrbp->task_tag, true); |
163 |
+ return result; |
164 |
+ } |
165 |
+@@ -5661,9 +5662,12 @@ static irqreturn_t ufshcd_intr(int irq, void *__hba) |
166 |
+ intr_status = ufshcd_readl(hba, REG_INTERRUPT_STATUS); |
167 |
+ } |
168 |
+ |
169 |
+- if (retval == IRQ_NONE) { |
170 |
+- dev_err(hba->dev, "%s: Unhandled interrupt 0x%08x\n", |
171 |
+- __func__, intr_status); |
172 |
++ if (enabled_intr_status && retval == IRQ_NONE && |
173 |
++ !ufshcd_eh_in_progress(hba)) { |
174 |
++ dev_err(hba->dev, "%s: Unhandled interrupt 0x%08x (-, 0x%08x)\n", |
175 |
++ __func__, |
176 |
++ intr_status, |
177 |
++ enabled_intr_status); |
178 |
+ ufshcd_dump_regs(hba, 0, UFSHCI_REG_SPACE_SIZE, "host_regs: "); |
179 |
+ } |
180 |
+ |
181 |
+@@ -5705,7 +5709,10 @@ static int __ufshcd_issue_tm_cmd(struct ufs_hba *hba, |
182 |
+ /* |
183 |
+ * blk_get_request() is used here only to get a free tag. |
184 |
+ */ |
185 |
+- req = blk_get_request(q, REQ_OP_DRV_OUT, BLK_MQ_REQ_RESERVED); |
186 |
++ req = blk_get_request(q, REQ_OP_DRV_OUT, 0); |
187 |
++ if (IS_ERR(req)) |
188 |
++ return PTR_ERR(req); |
189 |
++ |
190 |
+ req->end_io_data = &wait; |
191 |
+ ufshcd_hold(hba, false); |
192 |
+ |
193 |
+diff --git a/drivers/soc/tegra/pmc.c b/drivers/soc/tegra/pmc.c |
194 |
+index ab75f41e9c0c9..d11320a4dfcf9 100644 |
195 |
+--- a/drivers/soc/tegra/pmc.c |
196 |
++++ b/drivers/soc/tegra/pmc.c |
197 |
+@@ -579,7 +579,7 @@ static int tegra_powergate_power_up(struct tegra_powergate *pg, |
198 |
+ |
199 |
+ err = tegra_powergate_enable_clocks(pg); |
200 |
+ if (err) |
201 |
+- goto disable_clks; |
202 |
++ goto powergate_off; |
203 |
+ |
204 |
+ usleep_range(10, 20); |
205 |
+ |
206 |
+diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c |
207 |
+index fad80c97d2476..fdd18c2508115 100644 |
208 |
+--- a/fs/erofs/zdata.c |
209 |
++++ b/fs/erofs/zdata.c |
210 |
+@@ -288,11 +288,10 @@ static inline bool z_erofs_try_inplace_io(struct z_erofs_collector *clt, |
211 |
+ |
212 |
+ /* callers must be with collection lock held */ |
213 |
+ static int z_erofs_attach_page(struct z_erofs_collector *clt, |
214 |
+- struct page *page, |
215 |
+- enum z_erofs_page_type type) |
216 |
++ struct page *page, enum z_erofs_page_type type, |
217 |
++ bool pvec_safereuse) |
218 |
+ { |
219 |
+ int ret; |
220 |
+- bool occupied; |
221 |
+ |
222 |
+ /* give priority for inplaceio */ |
223 |
+ if (clt->mode >= COLLECT_PRIMARY && |
224 |
+@@ -300,10 +299,9 @@ static int z_erofs_attach_page(struct z_erofs_collector *clt, |
225 |
+ z_erofs_try_inplace_io(clt, page)) |
226 |
+ return 0; |
227 |
+ |
228 |
+- ret = z_erofs_pagevec_enqueue(&clt->vector, |
229 |
+- page, type, &occupied); |
230 |
++ ret = z_erofs_pagevec_enqueue(&clt->vector, page, type, |
231 |
++ pvec_safereuse); |
232 |
+ clt->cl->vcnt += (unsigned int)ret; |
233 |
+- |
234 |
+ return ret ? 0 : -EAGAIN; |
235 |
+ } |
236 |
+ |
237 |
+@@ -654,14 +652,15 @@ hitted: |
238 |
+ tight &= (clt->mode >= COLLECT_PRIMARY_FOLLOWED); |
239 |
+ |
240 |
+ retry: |
241 |
+- err = z_erofs_attach_page(clt, page, page_type); |
242 |
++ err = z_erofs_attach_page(clt, page, page_type, |
243 |
++ clt->mode >= COLLECT_PRIMARY_FOLLOWED); |
244 |
+ /* should allocate an additional staging page for pagevec */ |
245 |
+ if (err == -EAGAIN) { |
246 |
+ struct page *const newpage = |
247 |
+ __stagingpage_alloc(pagepool, GFP_NOFS); |
248 |
+ |
249 |
+ err = z_erofs_attach_page(clt, newpage, |
250 |
+- Z_EROFS_PAGE_TYPE_EXCLUSIVE); |
251 |
++ Z_EROFS_PAGE_TYPE_EXCLUSIVE, true); |
252 |
+ if (!err) |
253 |
+ goto retry; |
254 |
+ } |
255 |
+diff --git a/fs/erofs/zpvec.h b/fs/erofs/zpvec.h |
256 |
+index 58556903aa945..6a20b2c3a24cd 100644 |
257 |
+--- a/fs/erofs/zpvec.h |
258 |
++++ b/fs/erofs/zpvec.h |
259 |
+@@ -108,12 +108,17 @@ static inline void z_erofs_pagevec_ctor_init(struct z_erofs_pagevec_ctor *ctor, |
260 |
+ static inline bool z_erofs_pagevec_enqueue(struct z_erofs_pagevec_ctor *ctor, |
261 |
+ struct page *page, |
262 |
+ enum z_erofs_page_type type, |
263 |
+- bool *occupied) |
264 |
++ bool pvec_safereuse) |
265 |
+ { |
266 |
+- *occupied = false; |
267 |
+- if (!ctor->next && type) |
268 |
+- if (ctor->index + 1 == ctor->nr) |
269 |
++ if (!ctor->next) { |
270 |
++ /* some pages cannot be reused as pvec safely without I/O */ |
271 |
++ if (type == Z_EROFS_PAGE_TYPE_EXCLUSIVE && !pvec_safereuse) |
272 |
++ type = Z_EROFS_VLE_PAGE_TYPE_TAIL_SHARED; |
273 |
++ |
274 |
++ if (type != Z_EROFS_PAGE_TYPE_EXCLUSIVE && |
275 |
++ ctor->index + 1 == ctor->nr) |
276 |
+ return false; |
277 |
++ } |
278 |
+ |
279 |
+ if (ctor->index >= ctor->nr) |
280 |
+ z_erofs_pagevec_ctor_pagedown(ctor, false); |
281 |
+@@ -125,7 +130,6 @@ static inline bool z_erofs_pagevec_enqueue(struct z_erofs_pagevec_ctor *ctor, |
282 |
+ /* should remind that collector->next never equal to 1, 2 */ |
283 |
+ if (type == (uintptr_t)ctor->next) { |
284 |
+ ctor->next = page; |
285 |
+- *occupied = true; |
286 |
+ } |
287 |
+ ctor->pages[ctor->index++] = tagptr_fold(erofs_vtptr_t, page, type); |
288 |
+ return true; |
289 |
+diff --git a/fs/ext4/super.c b/fs/ext4/super.c |
290 |
+index 1211ae203face..f68dfef5939f4 100644 |
291 |
+--- a/fs/ext4/super.c |
292 |
++++ b/fs/ext4/super.c |
293 |
+@@ -3071,8 +3071,8 @@ static int ext4_run_li_request(struct ext4_li_request *elr) |
294 |
+ struct ext4_group_desc *gdp = NULL; |
295 |
+ ext4_group_t group, ngroups; |
296 |
+ struct super_block *sb; |
297 |
+- unsigned long timeout = 0; |
298 |
+ int ret = 0; |
299 |
++ u64 start_time; |
300 |
+ |
301 |
+ sb = elr->lr_super; |
302 |
+ ngroups = EXT4_SB(sb)->s_groups_count; |
303 |
+@@ -3092,13 +3092,12 @@ static int ext4_run_li_request(struct ext4_li_request *elr) |
304 |
+ ret = 1; |
305 |
+ |
306 |
+ if (!ret) { |
307 |
+- timeout = jiffies; |
308 |
++ start_time = ktime_get_real_ns(); |
309 |
+ ret = ext4_init_inode_table(sb, group, |
310 |
+ elr->lr_timeout ? 0 : 1); |
311 |
+ if (elr->lr_timeout == 0) { |
312 |
+- timeout = (jiffies - timeout) * |
313 |
+- elr->lr_sbi->s_li_wait_mult; |
314 |
+- elr->lr_timeout = timeout; |
315 |
++ elr->lr_timeout = nsecs_to_jiffies((ktime_get_real_ns() - start_time) * |
316 |
++ elr->lr_sbi->s_li_wait_mult); |
317 |
+ } |
318 |
+ elr->lr_next_sched = jiffies + elr->lr_timeout; |
319 |
+ elr->lr_next_group = group + 1; |
320 |
+diff --git a/include/linux/pci.h b/include/linux/pci.h |
321 |
+index 9a937f8b27838..bc35b15efadd0 100644 |
322 |
+--- a/include/linux/pci.h |
323 |
++++ b/include/linux/pci.h |
324 |
+@@ -208,6 +208,8 @@ enum pci_dev_flags { |
325 |
+ PCI_DEV_FLAGS_NO_FLR_RESET = (__force pci_dev_flags_t) (1 << 10), |
326 |
+ /* Don't use Relaxed Ordering for TLPs directed at this device */ |
327 |
+ PCI_DEV_FLAGS_NO_RELAXED_ORDERING = (__force pci_dev_flags_t) (1 << 11), |
328 |
++ /* Device does honor MSI masking despite saying otherwise */ |
329 |
++ PCI_DEV_FLAGS_HAS_MSI_MASKING = (__force pci_dev_flags_t) (1 << 12), |
330 |
+ }; |
331 |
+ |
332 |
+ enum pci_irq_reroute_variant { |
333 |
+diff --git a/security/Kconfig b/security/Kconfig |
334 |
+index 2a1a2d3962281..52e5109f2c1b6 100644 |
335 |
+--- a/security/Kconfig |
336 |
++++ b/security/Kconfig |
337 |
+@@ -191,6 +191,9 @@ config HARDENED_USERCOPY_PAGESPAN |
338 |
+ config FORTIFY_SOURCE |
339 |
+ bool "Harden common str/mem functions against buffer overflows" |
340 |
+ depends on ARCH_HAS_FORTIFY_SOURCE |
341 |
++ # https://bugs.llvm.org/show_bug.cgi?id=50322 |
342 |
++ # https://bugs.llvm.org/show_bug.cgi?id=41459 |
343 |
++ depends on !CC_IS_CLANG |
344 |
+ help |
345 |
+ Detect overflows of buffers in common string and memory functions |
346 |
+ where the compiler can determine and validate the buffer sizes. |