1 |
commit: 582727a23f4f5b78c6ac19772e3dde0425b13bc5 |
2 |
Author: Alice Ferrazzi <alicef <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri May 28 12:14:39 2021 +0000 |
4 |
Commit: Alice Ferrazzi <alicef <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri May 28 12:14:52 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=582727a2 |
7 |
|
8 |
Linux patch 5.10.41 |
9 |
|
10 |
Signed-off-by: Alice Ferrazzi <alicef <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1040_linux-5.10.41.patch | 344 +++++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 348 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index 27b8de0..6130f63 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -203,6 +203,10 @@ Patch: 1039_linux-5.10.40.patch |
21 |
From: http://www.kernel.org |
22 |
Desc: Linux 5.10.40 |
23 |
|
24 |
+Patch: 1040_linux-5.10.41.patch |
25 |
+From: http://www.kernel.org |
26 |
+Desc: Linux 5.10.41 |
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/1040_linux-5.10.41.patch b/1040_linux-5.10.41.patch |
33 |
new file mode 100644 |
34 |
index 0000000..9699d6e |
35 |
--- /dev/null |
36 |
+++ b/1040_linux-5.10.41.patch |
37 |
@@ -0,0 +1,344 @@ |
38 |
+diff --git a/Makefile b/Makefile |
39 |
+index 42c915ccc5b80..81011c92dd46f 100644 |
40 |
+--- a/Makefile |
41 |
++++ b/Makefile |
42 |
+@@ -1,7 +1,7 @@ |
43 |
+ # SPDX-License-Identifier: GPL-2.0 |
44 |
+ VERSION = 5 |
45 |
+ PATCHLEVEL = 10 |
46 |
+-SUBLEVEL = 40 |
47 |
++SUBLEVEL = 41 |
48 |
+ EXTRAVERSION = |
49 |
+ NAME = Dare mighty things |
50 |
+ |
51 |
+diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c |
52 |
+index ca7a717477e70..9d4eb114613c2 100644 |
53 |
+--- a/arch/x86/kvm/svm/svm.c |
54 |
++++ b/arch/x86/kvm/svm/svm.c |
55 |
+@@ -3532,15 +3532,15 @@ static noinstr void svm_vcpu_enter_exit(struct kvm_vcpu *vcpu, |
56 |
+ * have them in state 'on' as recorded before entering guest mode. |
57 |
+ * Same as enter_from_user_mode(). |
58 |
+ * |
59 |
+- * guest_exit_irqoff() restores host context and reinstates RCU if |
60 |
+- * enabled and required. |
61 |
++ * context_tracking_guest_exit() restores host context and reinstates |
62 |
++ * RCU if enabled and required. |
63 |
+ * |
64 |
+ * This needs to be done before the below as native_read_msr() |
65 |
+ * contains a tracepoint and x86_spec_ctrl_restore_host() calls |
66 |
+ * into world and some more. |
67 |
+ */ |
68 |
+ lockdep_hardirqs_off(CALLER_ADDR0); |
69 |
+- guest_exit_irqoff(); |
70 |
++ context_tracking_guest_exit(); |
71 |
+ |
72 |
+ instrumentation_begin(); |
73 |
+ trace_hardirqs_off_finish(); |
74 |
+diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c |
75 |
+index d7f8d2167fda0..45877364e6829 100644 |
76 |
+--- a/arch/x86/kvm/vmx/vmx.c |
77 |
++++ b/arch/x86/kvm/vmx/vmx.c |
78 |
+@@ -6640,15 +6640,15 @@ static noinstr void vmx_vcpu_enter_exit(struct kvm_vcpu *vcpu, |
79 |
+ * have them in state 'on' as recorded before entering guest mode. |
80 |
+ * Same as enter_from_user_mode(). |
81 |
+ * |
82 |
+- * guest_exit_irqoff() restores host context and reinstates RCU if |
83 |
+- * enabled and required. |
84 |
++ * context_tracking_guest_exit() restores host context and reinstates |
85 |
++ * RCU if enabled and required. |
86 |
+ * |
87 |
+ * This needs to be done before the below as native_read_msr() |
88 |
+ * contains a tracepoint and x86_spec_ctrl_restore_host() calls |
89 |
+ * into world and some more. |
90 |
+ */ |
91 |
+ lockdep_hardirqs_off(CALLER_ADDR0); |
92 |
+- guest_exit_irqoff(); |
93 |
++ context_tracking_guest_exit(); |
94 |
+ |
95 |
+ instrumentation_begin(); |
96 |
+ trace_hardirqs_off_finish(); |
97 |
+diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c |
98 |
+index c071a83d543ae..7f767d59b09d3 100644 |
99 |
+--- a/arch/x86/kvm/x86.c |
100 |
++++ b/arch/x86/kvm/x86.c |
101 |
+@@ -9063,6 +9063,15 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu) |
102 |
+ local_irq_disable(); |
103 |
+ kvm_after_interrupt(vcpu); |
104 |
+ |
105 |
++ /* |
106 |
++ * Wait until after servicing IRQs to account guest time so that any |
107 |
++ * ticks that occurred while running the guest are properly accounted |
108 |
++ * to the guest. Waiting until IRQs are enabled degrades the accuracy |
109 |
++ * of accounting via context tracking, but the loss of accuracy is |
110 |
++ * acceptable for all known use cases. |
111 |
++ */ |
112 |
++ vtime_account_guest_exit(); |
113 |
++ |
114 |
+ if (lapic_in_kernel(vcpu)) { |
115 |
+ s64 delta = vcpu->arch.apic->lapic_timer.advance_expire_delta; |
116 |
+ if (delta != S64_MIN) { |
117 |
+diff --git a/include/linux/context_tracking.h b/include/linux/context_tracking.h |
118 |
+index d53cd331c4dd3..f5d127a5d819b 100644 |
119 |
+--- a/include/linux/context_tracking.h |
120 |
++++ b/include/linux/context_tracking.h |
121 |
+@@ -129,16 +129,26 @@ static __always_inline void guest_enter_irqoff(void) |
122 |
+ } |
123 |
+ } |
124 |
+ |
125 |
+-static __always_inline void guest_exit_irqoff(void) |
126 |
++static __always_inline void context_tracking_guest_exit(void) |
127 |
+ { |
128 |
+ if (context_tracking_enabled()) |
129 |
+ __context_tracking_exit(CONTEXT_GUEST); |
130 |
++} |
131 |
+ |
132 |
+- instrumentation_begin(); |
133 |
++static __always_inline void vtime_account_guest_exit(void) |
134 |
++{ |
135 |
+ if (vtime_accounting_enabled_this_cpu()) |
136 |
+ vtime_guest_exit(current); |
137 |
+ else |
138 |
+ current->flags &= ~PF_VCPU; |
139 |
++} |
140 |
++ |
141 |
++static __always_inline void guest_exit_irqoff(void) |
142 |
++{ |
143 |
++ context_tracking_guest_exit(); |
144 |
++ |
145 |
++ instrumentation_begin(); |
146 |
++ vtime_account_guest_exit(); |
147 |
+ instrumentation_end(); |
148 |
+ } |
149 |
+ |
150 |
+@@ -157,12 +167,19 @@ static __always_inline void guest_enter_irqoff(void) |
151 |
+ instrumentation_end(); |
152 |
+ } |
153 |
+ |
154 |
++static __always_inline void context_tracking_guest_exit(void) { } |
155 |
++ |
156 |
++static __always_inline void vtime_account_guest_exit(void) |
157 |
++{ |
158 |
++ vtime_account_kernel(current); |
159 |
++ current->flags &= ~PF_VCPU; |
160 |
++} |
161 |
++ |
162 |
+ static __always_inline void guest_exit_irqoff(void) |
163 |
+ { |
164 |
+ instrumentation_begin(); |
165 |
+ /* Flush the guest cputime we spent on the guest */ |
166 |
+- vtime_account_kernel(current); |
167 |
+- current->flags &= ~PF_VCPU; |
168 |
++ vtime_account_guest_exit(); |
169 |
+ instrumentation_end(); |
170 |
+ } |
171 |
+ #endif /* CONFIG_VIRT_CPU_ACCOUNTING_GEN */ |
172 |
+diff --git a/include/net/nfc/nci_core.h b/include/net/nfc/nci_core.h |
173 |
+index 43c9c5d2bedbd..33979017b7824 100644 |
174 |
+--- a/include/net/nfc/nci_core.h |
175 |
++++ b/include/net/nfc/nci_core.h |
176 |
+@@ -298,6 +298,7 @@ int nci_nfcc_loopback(struct nci_dev *ndev, void *data, size_t data_len, |
177 |
+ struct sk_buff **resp); |
178 |
+ |
179 |
+ struct nci_hci_dev *nci_hci_allocate(struct nci_dev *ndev); |
180 |
++void nci_hci_deallocate(struct nci_dev *ndev); |
181 |
+ int nci_hci_send_event(struct nci_dev *ndev, u8 gate, u8 event, |
182 |
+ const u8 *param, size_t param_len); |
183 |
+ int nci_hci_send_cmd(struct nci_dev *ndev, u8 gate, |
184 |
+diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c |
185 |
+index 69730943eaf80..364b9760d1a73 100644 |
186 |
+--- a/kernel/bpf/verifier.c |
187 |
++++ b/kernel/bpf/verifier.c |
188 |
+@@ -5666,18 +5666,10 @@ enum { |
189 |
+ }; |
190 |
+ |
191 |
+ static int retrieve_ptr_limit(const struct bpf_reg_state *ptr_reg, |
192 |
+- const struct bpf_reg_state *off_reg, |
193 |
+- u32 *alu_limit, u8 opcode) |
194 |
++ u32 *alu_limit, bool mask_to_left) |
195 |
+ { |
196 |
+- bool off_is_neg = off_reg->smin_value < 0; |
197 |
+- bool mask_to_left = (opcode == BPF_ADD && off_is_neg) || |
198 |
+- (opcode == BPF_SUB && !off_is_neg); |
199 |
+ u32 max = 0, ptr_limit = 0; |
200 |
+ |
201 |
+- if (!tnum_is_const(off_reg->var_off) && |
202 |
+- (off_reg->smin_value < 0) != (off_reg->smax_value < 0)) |
203 |
+- return REASON_BOUNDS; |
204 |
+- |
205 |
+ switch (ptr_reg->type) { |
206 |
+ case PTR_TO_STACK: |
207 |
+ /* Offset 0 is out-of-bounds, but acceptable start for the |
208 |
+@@ -5743,15 +5735,20 @@ static bool sanitize_needed(u8 opcode) |
209 |
+ return opcode == BPF_ADD || opcode == BPF_SUB; |
210 |
+ } |
211 |
+ |
212 |
++struct bpf_sanitize_info { |
213 |
++ struct bpf_insn_aux_data aux; |
214 |
++ bool mask_to_left; |
215 |
++}; |
216 |
++ |
217 |
+ static int sanitize_ptr_alu(struct bpf_verifier_env *env, |
218 |
+ struct bpf_insn *insn, |
219 |
+ const struct bpf_reg_state *ptr_reg, |
220 |
+ const struct bpf_reg_state *off_reg, |
221 |
+ struct bpf_reg_state *dst_reg, |
222 |
+- struct bpf_insn_aux_data *tmp_aux, |
223 |
++ struct bpf_sanitize_info *info, |
224 |
+ const bool commit_window) |
225 |
+ { |
226 |
+- struct bpf_insn_aux_data *aux = commit_window ? cur_aux(env) : tmp_aux; |
227 |
++ struct bpf_insn_aux_data *aux = commit_window ? cur_aux(env) : &info->aux; |
228 |
+ struct bpf_verifier_state *vstate = env->cur_state; |
229 |
+ bool off_is_imm = tnum_is_const(off_reg->var_off); |
230 |
+ bool off_is_neg = off_reg->smin_value < 0; |
231 |
+@@ -5772,7 +5769,16 @@ static int sanitize_ptr_alu(struct bpf_verifier_env *env, |
232 |
+ if (vstate->speculative) |
233 |
+ goto do_sim; |
234 |
+ |
235 |
+- err = retrieve_ptr_limit(ptr_reg, off_reg, &alu_limit, opcode); |
236 |
++ if (!commit_window) { |
237 |
++ if (!tnum_is_const(off_reg->var_off) && |
238 |
++ (off_reg->smin_value < 0) != (off_reg->smax_value < 0)) |
239 |
++ return REASON_BOUNDS; |
240 |
++ |
241 |
++ info->mask_to_left = (opcode == BPF_ADD && off_is_neg) || |
242 |
++ (opcode == BPF_SUB && !off_is_neg); |
243 |
++ } |
244 |
++ |
245 |
++ err = retrieve_ptr_limit(ptr_reg, &alu_limit, info->mask_to_left); |
246 |
+ if (err < 0) |
247 |
+ return err; |
248 |
+ |
249 |
+@@ -5780,8 +5786,8 @@ static int sanitize_ptr_alu(struct bpf_verifier_env *env, |
250 |
+ /* In commit phase we narrow the masking window based on |
251 |
+ * the observed pointer move after the simulated operation. |
252 |
+ */ |
253 |
+- alu_state = tmp_aux->alu_state; |
254 |
+- alu_limit = abs(tmp_aux->alu_limit - alu_limit); |
255 |
++ alu_state = info->aux.alu_state; |
256 |
++ alu_limit = abs(info->aux.alu_limit - alu_limit); |
257 |
+ } else { |
258 |
+ alu_state = off_is_neg ? BPF_ALU_NEG_VALUE : 0; |
259 |
+ alu_state |= off_is_imm ? BPF_ALU_IMMEDIATE : 0; |
260 |
+@@ -5796,8 +5802,12 @@ do_sim: |
261 |
+ /* If we're in commit phase, we're done here given we already |
262 |
+ * pushed the truncated dst_reg into the speculative verification |
263 |
+ * stack. |
264 |
++ * |
265 |
++ * Also, when register is a known constant, we rewrite register-based |
266 |
++ * operation to immediate-based, and thus do not need masking (and as |
267 |
++ * a consequence, do not need to simulate the zero-truncation either). |
268 |
+ */ |
269 |
+- if (commit_window) |
270 |
++ if (commit_window || off_is_imm) |
271 |
+ return 0; |
272 |
+ |
273 |
+ /* Simulate and find potential out-of-bounds access under |
274 |
+@@ -5942,7 +5952,7 @@ static int adjust_ptr_min_max_vals(struct bpf_verifier_env *env, |
275 |
+ smin_ptr = ptr_reg->smin_value, smax_ptr = ptr_reg->smax_value; |
276 |
+ u64 umin_val = off_reg->umin_value, umax_val = off_reg->umax_value, |
277 |
+ umin_ptr = ptr_reg->umin_value, umax_ptr = ptr_reg->umax_value; |
278 |
+- struct bpf_insn_aux_data tmp_aux = {}; |
279 |
++ struct bpf_sanitize_info info = {}; |
280 |
+ u8 opcode = BPF_OP(insn->code); |
281 |
+ u32 dst = insn->dst_reg; |
282 |
+ int ret; |
283 |
+@@ -6011,7 +6021,7 @@ static int adjust_ptr_min_max_vals(struct bpf_verifier_env *env, |
284 |
+ |
285 |
+ if (sanitize_needed(opcode)) { |
286 |
+ ret = sanitize_ptr_alu(env, insn, ptr_reg, off_reg, dst_reg, |
287 |
+- &tmp_aux, false); |
288 |
++ &info, false); |
289 |
+ if (ret < 0) |
290 |
+ return sanitize_err(env, insn, ret, off_reg, dst_reg); |
291 |
+ } |
292 |
+@@ -6152,7 +6162,7 @@ static int adjust_ptr_min_max_vals(struct bpf_verifier_env *env, |
293 |
+ return -EACCES; |
294 |
+ if (sanitize_needed(opcode)) { |
295 |
+ ret = sanitize_ptr_alu(env, insn, dst_reg, off_reg, dst_reg, |
296 |
+- &tmp_aux, true); |
297 |
++ &info, true); |
298 |
+ if (ret < 0) |
299 |
+ return sanitize_err(env, insn, ret, off_reg, dst_reg); |
300 |
+ } |
301 |
+diff --git a/net/nfc/nci/core.c b/net/nfc/nci/core.c |
302 |
+index 741da8f81c2b8..32e8154363cab 100644 |
303 |
+--- a/net/nfc/nci/core.c |
304 |
++++ b/net/nfc/nci/core.c |
305 |
+@@ -1175,6 +1175,7 @@ EXPORT_SYMBOL(nci_allocate_device); |
306 |
+ void nci_free_device(struct nci_dev *ndev) |
307 |
+ { |
308 |
+ nfc_free_device(ndev->nfc_dev); |
309 |
++ nci_hci_deallocate(ndev); |
310 |
+ kfree(ndev); |
311 |
+ } |
312 |
+ EXPORT_SYMBOL(nci_free_device); |
313 |
+diff --git a/net/nfc/nci/hci.c b/net/nfc/nci/hci.c |
314 |
+index c18e76d6d8ba0..04e55ccb33836 100644 |
315 |
+--- a/net/nfc/nci/hci.c |
316 |
++++ b/net/nfc/nci/hci.c |
317 |
+@@ -795,3 +795,8 @@ struct nci_hci_dev *nci_hci_allocate(struct nci_dev *ndev) |
318 |
+ |
319 |
+ return hdev; |
320 |
+ } |
321 |
++ |
322 |
++void nci_hci_deallocate(struct nci_dev *ndev) |
323 |
++{ |
324 |
++ kfree(ndev->hci_dev); |
325 |
++} |
326 |
+diff --git a/tools/perf/util/unwind-libdw.c b/tools/perf/util/unwind-libdw.c |
327 |
+index 7a3dbc259cecc..a74b517f74974 100644 |
328 |
+--- a/tools/perf/util/unwind-libdw.c |
329 |
++++ b/tools/perf/util/unwind-libdw.c |
330 |
+@@ -20,10 +20,24 @@ |
331 |
+ |
332 |
+ static char *debuginfo_path; |
333 |
+ |
334 |
++static int __find_debuginfo(Dwfl_Module *mod __maybe_unused, void **userdata, |
335 |
++ const char *modname __maybe_unused, Dwarf_Addr base __maybe_unused, |
336 |
++ const char *file_name, const char *debuglink_file __maybe_unused, |
337 |
++ GElf_Word debuglink_crc __maybe_unused, char **debuginfo_file_name) |
338 |
++{ |
339 |
++ const struct dso *dso = *userdata; |
340 |
++ |
341 |
++ assert(dso); |
342 |
++ if (dso->symsrc_filename && strcmp (file_name, dso->symsrc_filename)) |
343 |
++ *debuginfo_file_name = strdup(dso->symsrc_filename); |
344 |
++ return -1; |
345 |
++} |
346 |
++ |
347 |
+ static const Dwfl_Callbacks offline_callbacks = { |
348 |
+- .find_debuginfo = dwfl_standard_find_debuginfo, |
349 |
++ .find_debuginfo = __find_debuginfo, |
350 |
+ .debuginfo_path = &debuginfo_path, |
351 |
+ .section_address = dwfl_offline_section_address, |
352 |
++ // .find_elf is not set as we use dwfl_report_elf() instead. |
353 |
+ }; |
354 |
+ |
355 |
+ static int __report_module(struct addr_location *al, u64 ip, |
356 |
+@@ -53,9 +67,22 @@ static int __report_module(struct addr_location *al, u64 ip, |
357 |
+ } |
358 |
+ |
359 |
+ if (!mod) |
360 |
+- mod = dwfl_report_elf(ui->dwfl, dso->short_name, |
361 |
+- (dso->symsrc_filename ? dso->symsrc_filename : dso->long_name), -1, al->map->start - al->map->pgoff, |
362 |
+- false); |
363 |
++ mod = dwfl_report_elf(ui->dwfl, dso->short_name, dso->long_name, -1, |
364 |
++ al->map->start - al->map->pgoff, false); |
365 |
++ if (!mod) { |
366 |
++ char filename[PATH_MAX]; |
367 |
++ |
368 |
++ if (dso__build_id_filename(dso, filename, sizeof(filename), false)) |
369 |
++ mod = dwfl_report_elf(ui->dwfl, dso->short_name, filename, -1, |
370 |
++ al->map->start - al->map->pgoff, false); |
371 |
++ } |
372 |
++ |
373 |
++ if (mod) { |
374 |
++ void **userdatap; |
375 |
++ |
376 |
++ dwfl_module_info(mod, &userdatap, NULL, NULL, NULL, NULL, NULL, NULL); |
377 |
++ *userdatap = dso; |
378 |
++ } |
379 |
+ |
380 |
+ return mod && dwfl_addrmodule(ui->dwfl, ip) == mod ? 0 : -1; |
381 |
+ } |