Gentoo Archives: gentoo-commits

From: Alice Ferrazzi <alicef@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:5.4 commit in: /
Date: Fri, 28 May 2021 12:03:28
Message-Id: 1622203381.08864c164cb7f1592b2eefa37d2e47196360b594.alicef@gentoo
1 commit: 08864c164cb7f1592b2eefa37d2e47196360b594
2 Author: Alice Ferrazzi <alicef <AT> gentoo <DOT> org>
3 AuthorDate: Fri May 28 12:02:07 2021 +0000
4 Commit: Alice Ferrazzi <alicef <AT> gentoo <DOT> org>
5 CommitDate: Fri May 28 12:03:01 2021 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=08864c16
7
8 Linux patch 5.4.123
9
10 Signed-off-by: Alice Ferrazzi <alicef <AT> gentoo.org>
11
12 0000_README | 4 +
13 1122_linux-5.4.123.patch | 238 +++++++++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 242 insertions(+)
15
16 diff --git a/0000_README b/0000_README
17 index 35230a5..873f773 100644
18 --- a/0000_README
19 +++ b/0000_README
20 @@ -531,6 +531,10 @@ Patch: 1121_linux-5.4.122.patch
21 From: http://www.kernel.org
22 Desc: Linux 5.4.122
23
24 +Patch: 1122_linux-5.4.123.patch
25 +From: http://www.kernel.org
26 +Desc: Linux 5.4.123
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/1122_linux-5.4.123.patch b/1122_linux-5.4.123.patch
33 new file mode 100644
34 index 0000000..c62699e
35 --- /dev/null
36 +++ b/1122_linux-5.4.123.patch
37 @@ -0,0 +1,238 @@
38 +diff --git a/Makefile b/Makefile
39 +index 9b64ebcf45312..d3f7a032f080b 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 = 122
47 ++SUBLEVEL = 123
48 + EXTRAVERSION =
49 + NAME = Kleptomaniac Octopus
50 +
51 +diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
52 +index 40fe856184efa..6145311a3855f 100644
53 +--- a/drivers/usb/dwc3/gadget.c
54 ++++ b/drivers/usb/dwc3/gadget.c
55 +@@ -2022,6 +2022,10 @@ static void dwc3_gadget_enable_irq(struct dwc3 *dwc)
56 + if (dwc->revision < DWC3_REVISION_250A)
57 + reg |= DWC3_DEVTEN_ULSTCNGEN;
58 +
59 ++ /* On 2.30a and above this bit enables U3/L2-L1 Suspend Events */
60 ++ if (dwc->revision >= DWC3_REVISION_230A)
61 ++ reg |= DWC3_DEVTEN_EOPFEN;
62 ++
63 + dwc3_writel(dwc->regs, DWC3_DEVTEN, reg);
64 + }
65 +
66 +diff --git a/include/net/nfc/nci_core.h b/include/net/nfc/nci_core.h
67 +index 43c9c5d2bedbd..33979017b7824 100644
68 +--- a/include/net/nfc/nci_core.h
69 ++++ b/include/net/nfc/nci_core.h
70 +@@ -298,6 +298,7 @@ int nci_nfcc_loopback(struct nci_dev *ndev, void *data, size_t data_len,
71 + struct sk_buff **resp);
72 +
73 + struct nci_hci_dev *nci_hci_allocate(struct nci_dev *ndev);
74 ++void nci_hci_deallocate(struct nci_dev *ndev);
75 + int nci_hci_send_event(struct nci_dev *ndev, u8 gate, u8 event,
76 + const u8 *param, size_t param_len);
77 + int nci_hci_send_cmd(struct nci_dev *ndev, u8 gate,
78 +diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
79 +index 11b217b0f4541..aefd947947968 100644
80 +--- a/kernel/bpf/verifier.c
81 ++++ b/kernel/bpf/verifier.c
82 +@@ -4272,18 +4272,10 @@ enum {
83 + };
84 +
85 + static int retrieve_ptr_limit(const struct bpf_reg_state *ptr_reg,
86 +- const struct bpf_reg_state *off_reg,
87 +- u32 *alu_limit, u8 opcode)
88 ++ u32 *alu_limit, bool mask_to_left)
89 + {
90 +- bool off_is_neg = off_reg->smin_value < 0;
91 +- bool mask_to_left = (opcode == BPF_ADD && off_is_neg) ||
92 +- (opcode == BPF_SUB && !off_is_neg);
93 + u32 max = 0, ptr_limit = 0;
94 +
95 +- if (!tnum_is_const(off_reg->var_off) &&
96 +- (off_reg->smin_value < 0) != (off_reg->smax_value < 0))
97 +- return REASON_BOUNDS;
98 +-
99 + switch (ptr_reg->type) {
100 + case PTR_TO_STACK:
101 + /* Offset 0 is out-of-bounds, but acceptable start for the
102 +@@ -4349,15 +4341,20 @@ static bool sanitize_needed(u8 opcode)
103 + return opcode == BPF_ADD || opcode == BPF_SUB;
104 + }
105 +
106 ++struct bpf_sanitize_info {
107 ++ struct bpf_insn_aux_data aux;
108 ++ bool mask_to_left;
109 ++};
110 ++
111 + static int sanitize_ptr_alu(struct bpf_verifier_env *env,
112 + struct bpf_insn *insn,
113 + const struct bpf_reg_state *ptr_reg,
114 + const struct bpf_reg_state *off_reg,
115 + struct bpf_reg_state *dst_reg,
116 +- struct bpf_insn_aux_data *tmp_aux,
117 ++ struct bpf_sanitize_info *info,
118 + const bool commit_window)
119 + {
120 +- struct bpf_insn_aux_data *aux = commit_window ? cur_aux(env) : tmp_aux;
121 ++ struct bpf_insn_aux_data *aux = commit_window ? cur_aux(env) : &info->aux;
122 + struct bpf_verifier_state *vstate = env->cur_state;
123 + bool off_is_imm = tnum_is_const(off_reg->var_off);
124 + bool off_is_neg = off_reg->smin_value < 0;
125 +@@ -4378,7 +4375,16 @@ static int sanitize_ptr_alu(struct bpf_verifier_env *env,
126 + if (vstate->speculative)
127 + goto do_sim;
128 +
129 +- err = retrieve_ptr_limit(ptr_reg, off_reg, &alu_limit, opcode);
130 ++ if (!commit_window) {
131 ++ if (!tnum_is_const(off_reg->var_off) &&
132 ++ (off_reg->smin_value < 0) != (off_reg->smax_value < 0))
133 ++ return REASON_BOUNDS;
134 ++
135 ++ info->mask_to_left = (opcode == BPF_ADD && off_is_neg) ||
136 ++ (opcode == BPF_SUB && !off_is_neg);
137 ++ }
138 ++
139 ++ err = retrieve_ptr_limit(ptr_reg, &alu_limit, info->mask_to_left);
140 + if (err < 0)
141 + return err;
142 +
143 +@@ -4386,8 +4392,8 @@ static int sanitize_ptr_alu(struct bpf_verifier_env *env,
144 + /* In commit phase we narrow the masking window based on
145 + * the observed pointer move after the simulated operation.
146 + */
147 +- alu_state = tmp_aux->alu_state;
148 +- alu_limit = abs(tmp_aux->alu_limit - alu_limit);
149 ++ alu_state = info->aux.alu_state;
150 ++ alu_limit = abs(info->aux.alu_limit - alu_limit);
151 + } else {
152 + alu_state = off_is_neg ? BPF_ALU_NEG_VALUE : 0;
153 + alu_state |= off_is_imm ? BPF_ALU_IMMEDIATE : 0;
154 +@@ -4402,8 +4408,12 @@ do_sim:
155 + /* If we're in commit phase, we're done here given we already
156 + * pushed the truncated dst_reg into the speculative verification
157 + * stack.
158 ++ *
159 ++ * Also, when register is a known constant, we rewrite register-based
160 ++ * operation to immediate-based, and thus do not need masking (and as
161 ++ * a consequence, do not need to simulate the zero-truncation either).
162 + */
163 +- if (commit_window)
164 ++ if (commit_window || off_is_imm)
165 + return 0;
166 +
167 + /* Simulate and find potential out-of-bounds access under
168 +@@ -4517,7 +4527,7 @@ static int adjust_ptr_min_max_vals(struct bpf_verifier_env *env,
169 + smin_ptr = ptr_reg->smin_value, smax_ptr = ptr_reg->smax_value;
170 + u64 umin_val = off_reg->umin_value, umax_val = off_reg->umax_value,
171 + umin_ptr = ptr_reg->umin_value, umax_ptr = ptr_reg->umax_value;
172 +- struct bpf_insn_aux_data tmp_aux = {};
173 ++ struct bpf_sanitize_info info = {};
174 + u8 opcode = BPF_OP(insn->code);
175 + u32 dst = insn->dst_reg;
176 + int ret;
177 +@@ -4578,7 +4588,7 @@ static int adjust_ptr_min_max_vals(struct bpf_verifier_env *env,
178 +
179 + if (sanitize_needed(opcode)) {
180 + ret = sanitize_ptr_alu(env, insn, ptr_reg, off_reg, dst_reg,
181 +- &tmp_aux, false);
182 ++ &info, false);
183 + if (ret < 0)
184 + return sanitize_err(env, insn, ret, off_reg, dst_reg);
185 + }
186 +@@ -4719,7 +4729,7 @@ static int adjust_ptr_min_max_vals(struct bpf_verifier_env *env,
187 + return -EACCES;
188 + if (sanitize_needed(opcode)) {
189 + ret = sanitize_ptr_alu(env, insn, dst_reg, off_reg, dst_reg,
190 +- &tmp_aux, true);
191 ++ &info, true);
192 + if (ret < 0)
193 + return sanitize_err(env, insn, ret, off_reg, dst_reg);
194 + }
195 +diff --git a/net/nfc/nci/core.c b/net/nfc/nci/core.c
196 +index 7cd5248843041..6a34a0a786eaa 100644
197 +--- a/net/nfc/nci/core.c
198 ++++ b/net/nfc/nci/core.c
199 +@@ -1175,6 +1175,7 @@ EXPORT_SYMBOL(nci_allocate_device);
200 + void nci_free_device(struct nci_dev *ndev)
201 + {
202 + nfc_free_device(ndev->nfc_dev);
203 ++ nci_hci_deallocate(ndev);
204 + kfree(ndev);
205 + }
206 + EXPORT_SYMBOL(nci_free_device);
207 +diff --git a/net/nfc/nci/hci.c b/net/nfc/nci/hci.c
208 +index c18e76d6d8ba0..04e55ccb33836 100644
209 +--- a/net/nfc/nci/hci.c
210 ++++ b/net/nfc/nci/hci.c
211 +@@ -795,3 +795,8 @@ struct nci_hci_dev *nci_hci_allocate(struct nci_dev *ndev)
212 +
213 + return hdev;
214 + }
215 ++
216 ++void nci_hci_deallocate(struct nci_dev *ndev)
217 ++{
218 ++ kfree(ndev->hci_dev);
219 ++}
220 +diff --git a/tools/perf/util/unwind-libdw.c b/tools/perf/util/unwind-libdw.c
221 +index 15f6e46d71243..32b440631c29d 100644
222 +--- a/tools/perf/util/unwind-libdw.c
223 ++++ b/tools/perf/util/unwind-libdw.c
224 +@@ -20,10 +20,24 @@
225 +
226 + static char *debuginfo_path;
227 +
228 ++static int __find_debuginfo(Dwfl_Module *mod __maybe_unused, void **userdata,
229 ++ const char *modname __maybe_unused, Dwarf_Addr base __maybe_unused,
230 ++ const char *file_name, const char *debuglink_file __maybe_unused,
231 ++ GElf_Word debuglink_crc __maybe_unused, char **debuginfo_file_name)
232 ++{
233 ++ const struct dso *dso = *userdata;
234 ++
235 ++ assert(dso);
236 ++ if (dso->symsrc_filename && strcmp (file_name, dso->symsrc_filename))
237 ++ *debuginfo_file_name = strdup(dso->symsrc_filename);
238 ++ return -1;
239 ++}
240 ++
241 + static const Dwfl_Callbacks offline_callbacks = {
242 +- .find_debuginfo = dwfl_standard_find_debuginfo,
243 ++ .find_debuginfo = __find_debuginfo,
244 + .debuginfo_path = &debuginfo_path,
245 + .section_address = dwfl_offline_section_address,
246 ++ // .find_elf is not set as we use dwfl_report_elf() instead.
247 + };
248 +
249 + static int __report_module(struct addr_location *al, u64 ip,
250 +@@ -53,9 +67,22 @@ static int __report_module(struct addr_location *al, u64 ip,
251 + }
252 +
253 + if (!mod)
254 +- mod = dwfl_report_elf(ui->dwfl, dso->short_name,
255 +- (dso->symsrc_filename ? dso->symsrc_filename : dso->long_name), -1, al->map->start - al->map->pgoff,
256 +- false);
257 ++ mod = dwfl_report_elf(ui->dwfl, dso->short_name, dso->long_name, -1,
258 ++ al->map->start - al->map->pgoff, false);
259 ++ if (!mod) {
260 ++ char filename[PATH_MAX];
261 ++
262 ++ if (dso__build_id_filename(dso, filename, sizeof(filename), false))
263 ++ mod = dwfl_report_elf(ui->dwfl, dso->short_name, filename, -1,
264 ++ al->map->start - al->map->pgoff, false);
265 ++ }
266 ++
267 ++ if (mod) {
268 ++ void **userdatap;
269 ++
270 ++ dwfl_module_info(mod, &userdatap, NULL, NULL, NULL, NULL, NULL, NULL);
271 ++ *userdatap = dso;
272 ++ }
273 +
274 + return mod && dwfl_addrmodule(ui->dwfl, ip) == mod ? 0 : -1;
275 + }