1 |
commit: b612c879fa7d8e238592cbc5bd99131f08a06254 |
2 |
Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Oct 12 22:19:26 2020 +0000 |
4 |
Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Oct 12 22:19:26 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/toolchain/linux-headers-patches.git/commit/?id=b612c879 |
7 |
|
8 |
5.9: new patchset, a copy of 5.8 with one patch dropped |
9 |
|
10 |
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org> |
11 |
|
12 |
...0001-linux-stat.h-remove-__GLIBC__-checks.patch | 28 +++++++++++ |
13 |
5.9/00_all_0003-convert-PAGE_SIZE-usage.patch | 54 ++++++++++++++++++++++ |
14 |
...ric-fcntl.h-namespace-kernel-file-structs.patch | 54 ++++++++++++++++++++++ |
15 |
..._0005-unifdef-drop-unused-errno.h-include.patch | 32 +++++++++++++ |
16 |
...build-relocs-tool-when-installing-headers.patch | 33 +++++++++++++ |
17 |
...k-drop-int-cast-on-length-arg-in-NLMSG_OK.patch | 43 +++++++++++++++++ |
18 |
...008-uapi-fix-System-V-buf-header-includes.patch | 28 +++++++++++ |
19 |
...ecific-inclusion-of-sysinfo.h-in-kernel.h.patch | 46 ++++++++++++++++++ |
20 |
8 files changed, 318 insertions(+) |
21 |
|
22 |
diff --git a/5.9/00_all_0001-linux-stat.h-remove-__GLIBC__-checks.patch b/5.9/00_all_0001-linux-stat.h-remove-__GLIBC__-checks.patch |
23 |
new file mode 100644 |
24 |
index 0000000..24a4199 |
25 |
--- /dev/null |
26 |
+++ b/5.9/00_all_0001-linux-stat.h-remove-__GLIBC__-checks.patch |
27 |
@@ -0,0 +1,28 @@ |
28 |
+From 1f4498530090a5fe7f6b2c46f2beb8818d7cb27b Mon Sep 17 00:00:00 2001 |
29 |
+From: Mike Frysinger <vapier@g.o> |
30 |
+Date: Mon, 29 Dec 2008 06:52:59 -0500 |
31 |
+Subject: [PATCH] linux/stat.h: remove __GLIBC__ checks |
32 |
+ |
33 |
+Only check __KERNEL__ so we don't assume the C library is glibc. |
34 |
+ |
35 |
+Signed-off-by: Mike Frysinger <vapier@g.o> |
36 |
+--- |
37 |
+ include/uapi/linux/stat.h | 2 +- |
38 |
+ 1 file changed, 1 insertion(+), 1 deletion(-) |
39 |
+ |
40 |
+diff --git a/include/uapi/linux/stat.h b/include/uapi/linux/stat.h |
41 |
+index 7b35e98d3c58..eb7474652d27 100644 |
42 |
+--- a/include/uapi/linux/stat.h |
43 |
++++ b/include/uapi/linux/stat.h |
44 |
+@@ -4,7 +4,7 @@ |
45 |
+ |
46 |
+ #include <linux/types.h> |
47 |
+ |
48 |
+-#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) |
49 |
++#if defined(__KERNEL__) |
50 |
+ |
51 |
+ #define S_IFMT 00170000 |
52 |
+ #define S_IFSOCK 0140000 |
53 |
+-- |
54 |
+2.16.1 |
55 |
+ |
56 |
|
57 |
diff --git a/5.9/00_all_0003-convert-PAGE_SIZE-usage.patch b/5.9/00_all_0003-convert-PAGE_SIZE-usage.patch |
58 |
new file mode 100644 |
59 |
index 0000000..fbc2c45 |
60 |
--- /dev/null |
61 |
+++ b/5.9/00_all_0003-convert-PAGE_SIZE-usage.patch |
62 |
@@ -0,0 +1,54 @@ |
63 |
+From 25f2bcfa6c8a9e7cee2b92a823495479fe0ccc92 Mon Sep 17 00:00:00 2001 |
64 |
+From: Mike Frysinger <vapier@g.o> |
65 |
+Date: Sat, 13 Feb 2010 03:09:23 -0500 |
66 |
+Subject: [PATCH] convert PAGE_SIZE usage |
67 |
+ |
68 |
+The size of a page may change at runtime or based on kernel settings, so |
69 |
+a static value at compile time doesn't work. More importantly, no one |
70 |
+exports PAGE_SIZE to user space anymore. |
71 |
+ |
72 |
+URL: http://bugs.gentoo.org/301431 |
73 |
+Signed-off-by: Mike Frysinger <vapier@g.o> |
74 |
+--- |
75 |
+ include/uapi/linux/binfmts.h | 3 ++- |
76 |
+ include/uapi/linux/resource.h | 3 ++- |
77 |
+ 2 files changed, 4 insertions(+), 2 deletions(-) |
78 |
+ |
79 |
+diff --git a/include/uapi/linux/binfmts.h b/include/uapi/linux/binfmts.h |
80 |
+index 4abad03a8853..3e98cfc84d1c 100644 |
81 |
+--- a/include/uapi/linux/binfmts.h |
82 |
++++ b/include/uapi/linux/binfmts.h |
83 |
+@@ -2,6 +2,7 @@ |
84 |
+ #ifndef _UAPI_LINUX_BINFMTS_H |
85 |
+ #define _UAPI_LINUX_BINFMTS_H |
86 |
+ |
87 |
++#include <unistd.h> |
88 |
+ #include <linux/capability.h> |
89 |
+ |
90 |
+ struct pt_regs; |
91 |
+@@ -12,7 +13,7 @@ struct pt_regs; |
92 |
+ * prevent the kernel from being unduly impacted by misaddressed pointers. |
93 |
+ * MAX_ARG_STRINGS is chosen to fit in a signed 32-bit integer. |
94 |
+ */ |
95 |
+-#define MAX_ARG_STRLEN (PAGE_SIZE * 32) |
96 |
++#define MAX_ARG_STRLEN (sysconf(_SC_PAGESIZE) * 32) |
97 |
+ #define MAX_ARG_STRINGS 0x7FFFFFFF |
98 |
+ |
99 |
+ /* sizeof(linux_binprm->buf) */ |
100 |
+diff --git a/include/uapi/linux/resource.h b/include/uapi/linux/resource.h |
101 |
+index cc00fd079631..6f9e76f513b5 100644 |
102 |
+--- a/include/uapi/linux/resource.h |
103 |
++++ b/include/uapi/linux/resource.h |
104 |
+@@ -69,7 +69,8 @@ struct rlimit64 { |
105 |
+ * GPG2 wants 64kB of mlocked memory, to make sure pass phrases |
106 |
+ * and other sensitive information are never written to disk. |
107 |
+ */ |
108 |
+-#define MLOCK_LIMIT ((PAGE_SIZE > 64*1024) ? PAGE_SIZE : 64*1024) |
109 |
++/* No one currently defines PAGE_SIZE bigger than 64kB */ |
110 |
++#define MLOCK_LIMIT (64 * 1024) |
111 |
+ |
112 |
+ /* |
113 |
+ * Due to binary compatibility, the actual resource numbers |
114 |
+-- |
115 |
+2.16.1 |
116 |
+ |
117 |
|
118 |
diff --git a/5.9/00_all_0004-asm-generic-fcntl.h-namespace-kernel-file-structs.patch b/5.9/00_all_0004-asm-generic-fcntl.h-namespace-kernel-file-structs.patch |
119 |
new file mode 100644 |
120 |
index 0000000..625fb6e |
121 |
--- /dev/null |
122 |
+++ b/5.9/00_all_0004-asm-generic-fcntl.h-namespace-kernel-file-structs.patch |
123 |
@@ -0,0 +1,54 @@ |
124 |
+From 091dfce6aed898f4bc4eaca0edab942dd03b8016 Mon Sep 17 00:00:00 2001 |
125 |
+From: Mike Frysinger <vapier@g.o> |
126 |
+Date: Mon, 29 Dec 2008 07:39:14 -0500 |
127 |
+Subject: [PATCH] asm-generic/fcntl.h: namespace kernel file structs |
128 |
+ |
129 |
+No one should be using these structs, but just in case they are, |
130 |
+keep them available in the __kernel_ namespace. |
131 |
+ |
132 |
+Otherwise, trying to include something like: |
133 |
+ #include <fcntl.h> |
134 |
+ #include <linux/inotify.h> |
135 |
+leads to horrible failure. |
136 |
+ |
137 |
+URL: http://bugs.gentoo.org/244470 |
138 |
+URL: http://bugs.gentoo.org/388633 |
139 |
+Signed-off-by: Mike Frysinger <vapier@g.o> |
140 |
+--- |
141 |
+ include/uapi/asm-generic/fcntl.h | 6 +++--- |
142 |
+ 1 file changed, 3 insertions(+), 3 deletions(-) |
143 |
+ |
144 |
+diff --git a/include/uapi/asm-generic/fcntl.h b/include/uapi/asm-generic/fcntl.h |
145 |
+index 9dc0bf0c5a6e..dc9b2e467ad9 100644 |
146 |
+--- a/include/uapi/asm-generic/fcntl.h |
147 |
++++ b/include/uapi/asm-generic/fcntl.h |
148 |
+@@ -153,7 +153,7 @@ |
149 |
+ #define F_OWNER_PID 1 |
150 |
+ #define F_OWNER_PGRP 2 |
151 |
+ |
152 |
+-struct f_owner_ex { |
153 |
++struct __kernel_f_owner_ex { |
154 |
+ int type; |
155 |
+ __kernel_pid_t pid; |
156 |
+ }; |
157 |
+@@ -193,7 +193,7 @@ struct f_owner_ex { |
158 |
+ #define __ARCH_FLOCK_PAD |
159 |
+ #endif |
160 |
+ |
161 |
+-struct flock { |
162 |
++struct __kernel_flock { |
163 |
+ short l_type; |
164 |
+ short l_whence; |
165 |
+ __kernel_off_t l_start; |
166 |
+@@ -208,7 +208,7 @@ struct flock { |
167 |
+ #define __ARCH_FLOCK64_PAD |
168 |
+ #endif |
169 |
+ |
170 |
+-struct flock64 { |
171 |
++struct __kernel_flock64 { |
172 |
+ short l_type; |
173 |
+ short l_whence; |
174 |
+ __kernel_loff_t l_start; |
175 |
+-- |
176 |
+2.16.1 |
177 |
+ |
178 |
|
179 |
diff --git a/5.9/00_all_0005-unifdef-drop-unused-errno.h-include.patch b/5.9/00_all_0005-unifdef-drop-unused-errno.h-include.patch |
180 |
new file mode 100644 |
181 |
index 0000000..617eb9a |
182 |
--- /dev/null |
183 |
+++ b/5.9/00_all_0005-unifdef-drop-unused-errno.h-include.patch |
184 |
@@ -0,0 +1,32 @@ |
185 |
+From c4d1a109c5c0b1bd27d2b5448a1306a2f6005339 Mon Sep 17 00:00:00 2001 |
186 |
+From: Mike Frysinger <vapier@g.o> |
187 |
+Date: Tue, 6 Dec 2011 17:22:42 -0500 |
188 |
+Subject: [PATCH] unifdef: drop unused errno.h include |
189 |
+ |
190 |
+This is the only header on my system that ends up requiring kernel |
191 |
+headers, so if the kernel headers aren't available, we end up being |
192 |
+unable to install kernel headers :). |
193 |
+ |
194 |
+Since this file doesn't actually use anything from errno.h, drop |
195 |
+the include so it at least makes us a bit more robust on glibc. |
196 |
+ |
197 |
+Signed-off-by: Mike Frysinger <vapier@g.o> |
198 |
+--- |
199 |
+ scripts/unifdef.c | 1 - |
200 |
+ 1 file changed, 1 deletion(-) |
201 |
+ |
202 |
+diff --git a/scripts/unifdef.c b/scripts/unifdef.c |
203 |
+index 7493c0ee51cc..c5dfae538b08 100644 |
204 |
+--- a/scripts/unifdef.c |
205 |
++++ b/scripts/unifdef.c |
206 |
+@@ -48,7 +48,6 @@ |
207 |
+ |
208 |
+ #include <ctype.h> |
209 |
+ #include <err.h> |
210 |
+-#include <errno.h> |
211 |
+ #include <stdarg.h> |
212 |
+ #include <stdbool.h> |
213 |
+ #include <stdio.h> |
214 |
+-- |
215 |
+2.16.1 |
216 |
+ |
217 |
|
218 |
diff --git a/5.9/00_all_0006-x86-do-not-build-relocs-tool-when-installing-headers.patch b/5.9/00_all_0006-x86-do-not-build-relocs-tool-when-installing-headers.patch |
219 |
new file mode 100644 |
220 |
index 0000000..c4af343 |
221 |
--- /dev/null |
222 |
+++ b/5.9/00_all_0006-x86-do-not-build-relocs-tool-when-installing-headers.patch |
223 |
@@ -0,0 +1,33 @@ |
224 |
+From 57875de37c5375ea95e1e949ec7c741d0038d3a1 Mon Sep 17 00:00:00 2001 |
225 |
+From: Mike Frysinger <vapier@g.o> |
226 |
+Date: Sat, 15 Nov 2014 03:37:38 -0500 |
227 |
+Subject: [PATCH] x86: do not build relocs tool when installing headers |
228 |
+ |
229 |
+This isn't needed to install headers, so don't bother building it. |
230 |
+Otherwise we run into a chicken/egg issue where we need the kernel |
231 |
+headers in order to install the kernel headers. It's also a waste |
232 |
+of time. |
233 |
+ |
234 |
+Signed-off-by: Mike Frysinger <vapier@g.o> |
235 |
+--- |
236 |
+ arch/x86/Makefile | 2 ++ |
237 |
+ 1 file changed, 2 insertions(+) |
238 |
+ |
239 |
+diff --git a/arch/x86/Makefile b/arch/x86/Makefile |
240 |
+index 60135cbd905c..9b15b2daa77f 100644 |
241 |
+--- a/arch/x86/Makefile |
242 |
++++ b/arch/x86/Makefile |
243 |
+@@ -249,8 +249,10 @@ ifneq ($(RETPOLINE_CFLAGS),) |
244 |
+ endif |
245 |
+ endif |
246 |
+ |
247 |
++ifneq ($(filter-out headers_install,$(MAKECMDGOALS)),) |
248 |
+ archscripts: scripts_basic |
249 |
+ $(Q)$(MAKE) $(build)=arch/x86/tools relocs |
250 |
++endif |
251 |
+ |
252 |
+ ### |
253 |
+ # Syscall table generation |
254 |
+-- |
255 |
+2.16.1 |
256 |
+ |
257 |
|
258 |
diff --git a/5.9/00_all_0007-netlink-drop-int-cast-on-length-arg-in-NLMSG_OK.patch b/5.9/00_all_0007-netlink-drop-int-cast-on-length-arg-in-NLMSG_OK.patch |
259 |
new file mode 100644 |
260 |
index 0000000..1fed99d |
261 |
--- /dev/null |
262 |
+++ b/5.9/00_all_0007-netlink-drop-int-cast-on-length-arg-in-NLMSG_OK.patch |
263 |
@@ -0,0 +1,43 @@ |
264 |
+From cb87a9562cca933c97a482f09a36542b876608e8 Mon Sep 17 00:00:00 2001 |
265 |
+From: Mike Frysinger <vapier@g.o> |
266 |
+Date: Thu, 5 Mar 2015 00:26:58 -0500 |
267 |
+Subject: [PATCH] netlink: drop (int) cast on length arg in NLMSG_OK |
268 |
+ |
269 |
+The NLMSG_OK macro compares three things: |
270 |
+ - the len arg from the user |
271 |
+ - a size_t: sizeof(struct nlmsghdr) |
272 |
+ - an int: sizeof(struct nlmsghdr) casted |
273 |
+ - an u32: the nlmsghdr->nlmsg_len member |
274 |
+ |
275 |
+When building with -Wsign-compare, this macro triggers a signed compare |
276 |
+warning. This is because it compares len to an int, and then compares |
277 |
+it to a u32. If len is signed, we get a warning due to the last test. |
278 |
+If len is unsigned, we get a warning due to the first test. Like in |
279 |
+strace: |
280 |
+socketutils.c:145:8: warning: comparison between signed and unsigned |
281 |
+ integer expressions [-Wsign-compare] |
282 |
+ |
283 |
+Lets drop the int cast on the first sizeof. This way, once the user |
284 |
+casts len to an unsigned value, everything shakes out correctly. |
285 |
+ |
286 |
+Signed-off-by: Mike Frysinger <vapier@g.o> |
287 |
+--- |
288 |
+ include/uapi/linux/netlink.h | 2 +- |
289 |
+ 1 file changed, 1 insertion(+), 1 deletion(-) |
290 |
+ |
291 |
+diff --git a/include/uapi/linux/netlink.h b/include/uapi/linux/netlink.h |
292 |
+index 776bc92e9118..d0c4df5fa670 100644 |
293 |
+--- a/include/uapi/linux/netlink.h |
294 |
++++ b/include/uapi/linux/netlink.h |
295 |
+@@ -94,7 +94,7 @@ struct nlmsghdr { |
296 |
+ #define NLMSG_DATA(nlh) ((void*)(((char*)nlh) + NLMSG_LENGTH(0))) |
297 |
+ #define NLMSG_NEXT(nlh,len) ((len) -= NLMSG_ALIGN((nlh)->nlmsg_len), \ |
298 |
+ (struct nlmsghdr*)(((char*)(nlh)) + NLMSG_ALIGN((nlh)->nlmsg_len))) |
299 |
+-#define NLMSG_OK(nlh,len) ((len) >= (int)sizeof(struct nlmsghdr) && \ |
300 |
++#define NLMSG_OK(nlh,len) ((len) >= sizeof(struct nlmsghdr) && \ |
301 |
+ (nlh)->nlmsg_len >= sizeof(struct nlmsghdr) && \ |
302 |
+ (nlh)->nlmsg_len <= (len)) |
303 |
+ #define NLMSG_PAYLOAD(nlh,len) ((nlh)->nlmsg_len - NLMSG_SPACE((len))) |
304 |
+-- |
305 |
+2.16.1 |
306 |
+ |
307 |
|
308 |
diff --git a/5.9/00_all_0008-uapi-fix-System-V-buf-header-includes.patch b/5.9/00_all_0008-uapi-fix-System-V-buf-header-includes.patch |
309 |
new file mode 100644 |
310 |
index 0000000..987a98d |
311 |
--- /dev/null |
312 |
+++ b/5.9/00_all_0008-uapi-fix-System-V-buf-header-includes.patch |
313 |
@@ -0,0 +1,28 @@ |
314 |
+From beac664726b0b5b5c833aaf6576ca583534406ba Mon Sep 17 00:00:00 2001 |
315 |
+From: Mike Frysinger <vapier@g.o> |
316 |
+Date: Mon, 2 Nov 2015 13:30:12 -0500 |
317 |
+Subject: [PATCH] uapi: fix System V buf header includes |
318 |
+ |
319 |
+These headers rely on kernel types but don't include the other headers |
320 |
+that define them. So when you try to include them directly, you often |
321 |
+hit build failures due to unknown types. |
322 |
+ |
323 |
+Signed-off-by: Mike Frysinger <vapier@g.o> |
324 |
+ |
325 |
+diff --git a/include/uapi/asm-generic/shmbuf.h b/include/uapi/asm-generic/shmbuf.h |
326 |
+index 2b6c3bb97f97..a0171147d796 100644 |
327 |
+--- a/include/uapi/asm-generic/shmbuf.h |
328 |
++++ b/include/uapi/asm-generic/shmbuf.h |
329 |
+@@ -2,7 +2,9 @@ |
330 |
+ #ifndef __ASM_GENERIC_SHMBUF_H |
331 |
+ #define __ASM_GENERIC_SHMBUF_H |
332 |
+ |
333 |
++ |
334 |
+ #include <asm/bitsperlong.h> |
335 |
++#include <asm/ipcbuf.h> |
336 |
+ |
337 |
+ /* |
338 |
+ * The shmid64_ds structure for x86 architecture. |
339 |
+-- |
340 |
+2.16.1 |
341 |
+ |
342 |
|
343 |
diff --git a/5.9/00_all_0009_glibc-specific-inclusion-of-sysinfo.h-in-kernel.h.patch b/5.9/00_all_0009_glibc-specific-inclusion-of-sysinfo.h-in-kernel.h.patch |
344 |
new file mode 100644 |
345 |
index 0000000..df075dc |
346 |
--- /dev/null |
347 |
+++ b/5.9/00_all_0009_glibc-specific-inclusion-of-sysinfo.h-in-kernel.h.patch |
348 |
@@ -0,0 +1,46 @@ |
349 |
+https://lore.kernel.org/patchwork/patch/449607/ |
350 |
+https://gitweb.gentoo.org/proj/musl.git/tree/sys-kernel/linux-headers/files/libc-5.1-remove-sysinfo_h-from-kernel_h.patch |
351 |
+ |
352 |
+Date: Fri, 14 Mar 2014 17:14:10 +0100 |
353 |
+From: David Heidelberger <david.heidelberger@××××.cz> |
354 |
+To: linux-kernel@×××××××××××.org |
355 |
+Cc: maillist-linux@××××××××.de, torvalds@××××××××××××××××.org |
356 |
+Subject: [PATCH 1/4] glibc specific inclusion of sysinfo.h in kernel.h |
357 |
+Message-ID: <130a9e0c237bae10e631a5ae52c5e2c8@××××.cz> |
358 |
+User-Agent: Roundcube Webmail/0.9.5 |
359 |
+Sender: linux-kernel-owner@×××××××××××.org |
360 |
+List-ID: <linux-kernel.vger.kernel.org> |
361 |
+X-Mailing-List: linux-kernel@×××××××××××.org |
362 |
+ |
363 |
+including sysinfo.h from kernel.h makes no sense whatsoever, |
364 |
+but removing it breaks glibc's userspace header, |
365 |
+which includes kernel.h instead of sysinfo.h from their sys/sysinfo.h. |
366 |
+this seems to be a historical mistake. |
367 |
+on musl, including any header that uses kernel.h directly or indirectly |
368 |
+plus sys/sysinfo.h will produce a compile error due to redefinition of |
369 |
+struct sysinfo.h. |
370 |
+so for now, only include it on glibc in order not to break their |
371 |
+headers. |
372 |
+ |
373 |
+Signed-off-by: John Spencer <maillist-linux@××××××××.de> |
374 |
+Signed-off-by: David Heidelberger <david.heidelberger@××××.cz> |
375 |
+--- |
376 |
+ include/uapi/linux/kernel.h | 2 ++ |
377 |
+ 1 file changed, 2 insertion(+) |
378 |
+ |
379 |
+ */ |
380 |
+ |
381 |
+diff --git a/include/uapi/linux/kernel.h b/include/uapi/linux/kernel.h |
382 |
+index 321e399..8c45eeb 100644 |
383 |
+--- a/include/uapi/linux/kernel.h |
384 |
++++ b/include/uapi/linux/kernel.h |
385 |
+@@ -1,7 +1,9 @@ |
386 |
+ #ifndef _UAPI_LINUX_KERNEL_H |
387 |
+ #define _UAPI_LINUX_KERNEL_H |
388 |
+ |
389 |
++#ifdef __GLIBC__ |
390 |
+ #include <linux/sysinfo.h> |
391 |
++#endif |
392 |
+ |
393 |
+ /* |
394 |
+ * 'kernel.h' contains some often-used function prototypes etc |