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