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