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