1 |
commit: db2e8ae94cabc877b43000900c80c31552838371 |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Aug 7 19:15:49 2020 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Aug 7 19:15:49 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=db2e8ae9 |
7 |
|
8 |
Linux patch 4.19.138 |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1137_linux-4.19.138.patch | 258 ++++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 262 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index d6fa27c..c72d2c2 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -587,6 +587,10 @@ Patch: 1136_linux-4.19.137.patch |
21 |
From: https://www.kernel.org |
22 |
Desc: Linux 4.19.137 |
23 |
|
24 |
+Patch: 1137_linux-4.19.138.patch |
25 |
+From: https://www.kernel.org |
26 |
+Desc: Linux 4.19.138 |
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/1137_linux-4.19.138.patch b/1137_linux-4.19.138.patch |
33 |
new file mode 100644 |
34 |
index 0000000..cad026c |
35 |
--- /dev/null |
36 |
+++ b/1137_linux-4.19.138.patch |
37 |
@@ -0,0 +1,258 @@ |
38 |
+diff --git a/Makefile b/Makefile |
39 |
+index edf1799c08d2..daaa8ab2f550 100644 |
40 |
+--- a/Makefile |
41 |
++++ b/Makefile |
42 |
+@@ -1,7 +1,7 @@ |
43 |
+ # SPDX-License-Identifier: GPL-2.0 |
44 |
+ VERSION = 4 |
45 |
+ PATCHLEVEL = 19 |
46 |
+-SUBLEVEL = 137 |
47 |
++SUBLEVEL = 138 |
48 |
+ EXTRAVERSION = |
49 |
+ NAME = "People's Front" |
50 |
+ |
51 |
+diff --git a/arch/arm/include/asm/percpu.h b/arch/arm/include/asm/percpu.h |
52 |
+index a89b4076cde4..72821b4721ad 100644 |
53 |
+--- a/arch/arm/include/asm/percpu.h |
54 |
++++ b/arch/arm/include/asm/percpu.h |
55 |
+@@ -16,6 +16,8 @@ |
56 |
+ #ifndef _ASM_ARM_PERCPU_H_ |
57 |
+ #define _ASM_ARM_PERCPU_H_ |
58 |
+ |
59 |
++#include <asm/thread_info.h> |
60 |
++ |
61 |
+ /* |
62 |
+ * Same as asm-generic/percpu.h, except that we store the per cpu offset |
63 |
+ * in the TPIDRPRW. TPIDRPRW only exists on V6K and V7 |
64 |
+diff --git a/drivers/char/random.c b/drivers/char/random.c |
65 |
+index d5f970d039bb..6a5d4dfafc47 100644 |
66 |
+--- a/drivers/char/random.c |
67 |
++++ b/drivers/char/random.c |
68 |
+@@ -1257,6 +1257,7 @@ void add_interrupt_randomness(int irq, int irq_flags) |
69 |
+ |
70 |
+ fast_mix(fast_pool); |
71 |
+ add_interrupt_bench(cycles); |
72 |
++ this_cpu_add(net_rand_state.s1, fast_pool->pool[cycles & 3]); |
73 |
+ |
74 |
+ if (unlikely(crng_init == 0)) { |
75 |
+ if ((fast_pool->count >= 64) && |
76 |
+diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c |
77 |
+index 3b1a7597af15..cd833f4e64ef 100644 |
78 |
+--- a/fs/ext4/inode.c |
79 |
++++ b/fs/ext4/inode.c |
80 |
+@@ -3848,6 +3848,11 @@ static ssize_t ext4_direct_IO_read(struct kiocb *iocb, struct iov_iter *iter) |
81 |
+ struct inode *inode = mapping->host; |
82 |
+ size_t count = iov_iter_count(iter); |
83 |
+ ssize_t ret; |
84 |
++ loff_t offset = iocb->ki_pos; |
85 |
++ loff_t size = i_size_read(inode); |
86 |
++ |
87 |
++ if (offset >= size) |
88 |
++ return 0; |
89 |
+ |
90 |
+ /* |
91 |
+ * Shared inode_lock is enough for us - it protects against concurrent |
92 |
+diff --git a/include/linux/prandom.h b/include/linux/prandom.h |
93 |
+new file mode 100644 |
94 |
+index 000000000000..aa16e6468f91 |
95 |
+--- /dev/null |
96 |
++++ b/include/linux/prandom.h |
97 |
+@@ -0,0 +1,78 @@ |
98 |
++/* SPDX-License-Identifier: GPL-2.0 */ |
99 |
++/* |
100 |
++ * include/linux/prandom.h |
101 |
++ * |
102 |
++ * Include file for the fast pseudo-random 32-bit |
103 |
++ * generation. |
104 |
++ */ |
105 |
++#ifndef _LINUX_PRANDOM_H |
106 |
++#define _LINUX_PRANDOM_H |
107 |
++ |
108 |
++#include <linux/types.h> |
109 |
++#include <linux/percpu.h> |
110 |
++ |
111 |
++u32 prandom_u32(void); |
112 |
++void prandom_bytes(void *buf, size_t nbytes); |
113 |
++void prandom_seed(u32 seed); |
114 |
++void prandom_reseed_late(void); |
115 |
++ |
116 |
++struct rnd_state { |
117 |
++ __u32 s1, s2, s3, s4; |
118 |
++}; |
119 |
++ |
120 |
++DECLARE_PER_CPU(struct rnd_state, net_rand_state); |
121 |
++ |
122 |
++u32 prandom_u32_state(struct rnd_state *state); |
123 |
++void prandom_bytes_state(struct rnd_state *state, void *buf, size_t nbytes); |
124 |
++void prandom_seed_full_state(struct rnd_state __percpu *pcpu_state); |
125 |
++ |
126 |
++#define prandom_init_once(pcpu_state) \ |
127 |
++ DO_ONCE(prandom_seed_full_state, (pcpu_state)) |
128 |
++ |
129 |
++/** |
130 |
++ * prandom_u32_max - returns a pseudo-random number in interval [0, ep_ro) |
131 |
++ * @ep_ro: right open interval endpoint |
132 |
++ * |
133 |
++ * Returns a pseudo-random number that is in interval [0, ep_ro). Note |
134 |
++ * that the result depends on PRNG being well distributed in [0, ~0U] |
135 |
++ * u32 space. Here we use maximally equidistributed combined Tausworthe |
136 |
++ * generator, that is, prandom_u32(). This is useful when requesting a |
137 |
++ * random index of an array containing ep_ro elements, for example. |
138 |
++ * |
139 |
++ * Returns: pseudo-random number in interval [0, ep_ro) |
140 |
++ */ |
141 |
++static inline u32 prandom_u32_max(u32 ep_ro) |
142 |
++{ |
143 |
++ return (u32)(((u64) prandom_u32() * ep_ro) >> 32); |
144 |
++} |
145 |
++ |
146 |
++/* |
147 |
++ * Handle minimum values for seeds |
148 |
++ */ |
149 |
++static inline u32 __seed(u32 x, u32 m) |
150 |
++{ |
151 |
++ return (x < m) ? x + m : x; |
152 |
++} |
153 |
++ |
154 |
++/** |
155 |
++ * prandom_seed_state - set seed for prandom_u32_state(). |
156 |
++ * @state: pointer to state structure to receive the seed. |
157 |
++ * @seed: arbitrary 64-bit value to use as a seed. |
158 |
++ */ |
159 |
++static inline void prandom_seed_state(struct rnd_state *state, u64 seed) |
160 |
++{ |
161 |
++ u32 i = (seed >> 32) ^ (seed << 10) ^ seed; |
162 |
++ |
163 |
++ state->s1 = __seed(i, 2U); |
164 |
++ state->s2 = __seed(i, 8U); |
165 |
++ state->s3 = __seed(i, 16U); |
166 |
++ state->s4 = __seed(i, 128U); |
167 |
++} |
168 |
++ |
169 |
++/* Pseudo random number generator from numerical recipes. */ |
170 |
++static inline u32 next_pseudo_random32(u32 seed) |
171 |
++{ |
172 |
++ return seed * 1664525 + 1013904223; |
173 |
++} |
174 |
++ |
175 |
++#endif |
176 |
+diff --git a/include/linux/random.h b/include/linux/random.h |
177 |
+index 445a0ea4ff49..37209b3b22ae 100644 |
178 |
+--- a/include/linux/random.h |
179 |
++++ b/include/linux/random.h |
180 |
+@@ -106,61 +106,12 @@ declare_get_random_var_wait(long) |
181 |
+ |
182 |
+ unsigned long randomize_page(unsigned long start, unsigned long range); |
183 |
+ |
184 |
+-u32 prandom_u32(void); |
185 |
+-void prandom_bytes(void *buf, size_t nbytes); |
186 |
+-void prandom_seed(u32 seed); |
187 |
+-void prandom_reseed_late(void); |
188 |
+- |
189 |
+-struct rnd_state { |
190 |
+- __u32 s1, s2, s3, s4; |
191 |
+-}; |
192 |
+- |
193 |
+-u32 prandom_u32_state(struct rnd_state *state); |
194 |
+-void prandom_bytes_state(struct rnd_state *state, void *buf, size_t nbytes); |
195 |
+-void prandom_seed_full_state(struct rnd_state __percpu *pcpu_state); |
196 |
+- |
197 |
+-#define prandom_init_once(pcpu_state) \ |
198 |
+- DO_ONCE(prandom_seed_full_state, (pcpu_state)) |
199 |
+- |
200 |
+-/** |
201 |
+- * prandom_u32_max - returns a pseudo-random number in interval [0, ep_ro) |
202 |
+- * @ep_ro: right open interval endpoint |
203 |
+- * |
204 |
+- * Returns a pseudo-random number that is in interval [0, ep_ro). Note |
205 |
+- * that the result depends on PRNG being well distributed in [0, ~0U] |
206 |
+- * u32 space. Here we use maximally equidistributed combined Tausworthe |
207 |
+- * generator, that is, prandom_u32(). This is useful when requesting a |
208 |
+- * random index of an array containing ep_ro elements, for example. |
209 |
+- * |
210 |
+- * Returns: pseudo-random number in interval [0, ep_ro) |
211 |
+- */ |
212 |
+-static inline u32 prandom_u32_max(u32 ep_ro) |
213 |
+-{ |
214 |
+- return (u32)(((u64) prandom_u32() * ep_ro) >> 32); |
215 |
+-} |
216 |
+- |
217 |
+ /* |
218 |
+- * Handle minimum values for seeds |
219 |
++ * This is designed to be standalone for just prandom |
220 |
++ * users, but for now we include it from <linux/random.h> |
221 |
++ * for legacy reasons. |
222 |
+ */ |
223 |
+-static inline u32 __seed(u32 x, u32 m) |
224 |
+-{ |
225 |
+- return (x < m) ? x + m : x; |
226 |
+-} |
227 |
+- |
228 |
+-/** |
229 |
+- * prandom_seed_state - set seed for prandom_u32_state(). |
230 |
+- * @state: pointer to state structure to receive the seed. |
231 |
+- * @seed: arbitrary 64-bit value to use as a seed. |
232 |
+- */ |
233 |
+-static inline void prandom_seed_state(struct rnd_state *state, u64 seed) |
234 |
+-{ |
235 |
+- u32 i = (seed >> 32) ^ (seed << 10) ^ seed; |
236 |
+- |
237 |
+- state->s1 = __seed(i, 2U); |
238 |
+- state->s2 = __seed(i, 8U); |
239 |
+- state->s3 = __seed(i, 16U); |
240 |
+- state->s4 = __seed(i, 128U); |
241 |
+-} |
242 |
++#include <linux/prandom.h> |
243 |
+ |
244 |
+ #ifdef CONFIG_ARCH_RANDOM |
245 |
+ # include <asm/archrandom.h> |
246 |
+@@ -191,10 +142,4 @@ static inline bool arch_has_random_seed(void) |
247 |
+ } |
248 |
+ #endif |
249 |
+ |
250 |
+-/* Pseudo random number generator from numerical recipes. */ |
251 |
+-static inline u32 next_pseudo_random32(u32 seed) |
252 |
+-{ |
253 |
+- return seed * 1664525 + 1013904223; |
254 |
+-} |
255 |
+- |
256 |
+ #endif /* _LINUX_RANDOM_H */ |
257 |
+diff --git a/kernel/time/timer.c b/kernel/time/timer.c |
258 |
+index 6c54cf481fde..61e41ea3a96e 100644 |
259 |
+--- a/kernel/time/timer.c |
260 |
++++ b/kernel/time/timer.c |
261 |
+@@ -44,6 +44,7 @@ |
262 |
+ #include <linux/sched/debug.h> |
263 |
+ #include <linux/slab.h> |
264 |
+ #include <linux/compat.h> |
265 |
++#include <linux/random.h> |
266 |
+ |
267 |
+ #include <linux/uaccess.h> |
268 |
+ #include <asm/unistd.h> |
269 |
+@@ -1654,6 +1655,13 @@ void update_process_times(int user_tick) |
270 |
+ scheduler_tick(); |
271 |
+ if (IS_ENABLED(CONFIG_POSIX_TIMERS)) |
272 |
+ run_posix_cpu_timers(p); |
273 |
++ |
274 |
++ /* The current CPU might make use of net randoms without receiving IRQs |
275 |
++ * to renew them often enough. Let's update the net_rand_state from a |
276 |
++ * non-constant value that's not affine to the number of calls to make |
277 |
++ * sure it's updated when there's some activity (we don't care in idle). |
278 |
++ */ |
279 |
++ this_cpu_add(net_rand_state.s1, rol32(jiffies, 24) + user_tick); |
280 |
+ } |
281 |
+ |
282 |
+ /** |
283 |
+diff --git a/lib/random32.c b/lib/random32.c |
284 |
+index 4aaa76404d56..036de0c93e22 100644 |
285 |
+--- a/lib/random32.c |
286 |
++++ b/lib/random32.c |
287 |
+@@ -48,7 +48,7 @@ static inline void prandom_state_selftest(void) |
288 |
+ } |
289 |
+ #endif |
290 |
+ |
291 |
+-static DEFINE_PER_CPU(struct rnd_state, net_rand_state) __latent_entropy; |
292 |
++DEFINE_PER_CPU(struct rnd_state, net_rand_state); |
293 |
+ |
294 |
+ /** |
295 |
+ * prandom_u32_state - seeded pseudo-random number generator. |