Gentoo Archives: gentoo-commits

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