Gentoo Archives: gentoo-commits

From: Pacho Ramos <pacho@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-util/trinity/files/, dev-util/trinity/
Date: Sat, 20 Oct 2018 12:17:20
Message-Id: 1540037809.13fb235948d859e2c248f68bc92644412a7f8a1b.pacho@gentoo
1 commit: 13fb235948d859e2c248f68bc92644412a7f8a1b
2 Author: Pacho Ramos <pacho <AT> gentoo <DOT> org>
3 AuthorDate: Sat Oct 20 11:57:59 2018 +0000
4 Commit: Pacho Ramos <pacho <AT> gentoo <DOT> org>
5 CommitDate: Sat Oct 20 12:16:49 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=13fb2359
7
8 dev-util/trinity: Apply Fedora/Debian fixes
9
10 Closes: https://bugs.gentoo.org/642936
11 Closes: https://bugs.gentoo.org/648962
12 Signed-off-by: Pacho Ramos <pacho <AT> gentoo.org>
13 Package-Manager: Portage-2.3.51, Repoman-2.3.11
14
15 dev-util/trinity/files/trinity-autofs.patch | 53 +++++++++++++++
16 dev-util/trinity/files/trinity-irda.patch | 47 +++++++++++++
17 dev-util/trinity/files/trinity-memfd.patch | 79 ++++++++++++++++++++++
18 dev-util/trinity/files/trinity-net-protocols.patch | 11 +++
19 dev-util/trinity/trinity-1.8.ebuild | 15 +++-
20 5 files changed, 202 insertions(+), 3 deletions(-)
21
22 diff --git a/dev-util/trinity/files/trinity-autofs.patch b/dev-util/trinity/files/trinity-autofs.patch
23 new file mode 100644
24 index 00000000000..b8a6c9fdbd5
25 --- /dev/null
26 +++ b/dev-util/trinity/files/trinity-autofs.patch
27 @@ -0,0 +1,53 @@
28 +--- a/configure.orig 2017-11-03 09:14:07.000000000 -0600
29 ++++ b/configure 2017-11-18 14:25:52.095495407 -0700
30 +@@ -47,6 +47,29 @@ check_header()
31 + echo "[*] Checking system headers."
32 +
33 + #############################################################################################
34 ++# Does auto_fs4 define AUTOFS_IOC_EXPIRE_(IN)DIRECT?
35 ++echo -n "[*] Checking autofs headers ... "
36 ++rm -f "$TMP" || exit 1
37 ++
38 ++cat >"$TMP.c" << EOF
39 ++#include <linux/auto_fs4.h>
40 ++
41 ++int main()
42 ++{
43 ++ return AUTOFS_IOC_EXPIRE_INDIRECT + AUTOFS_IOC_EXPIRE_DIRECT;
44 ++}
45 ++EOF
46 ++
47 ++${CC} ${CFLAGS} "$TMP.c" -o "$TMP" &>"$TMP.log"
48 ++if [ ! -x "$TMP" ]; then
49 ++ echo $RED "[NO]" $COL_RESET
50 ++ MISSING_DEFS=1
51 ++else
52 ++ echo $GREEN "[YES]" $COL_RESET
53 ++ echo "#define USE_AUTOFS_EXPIRE 1" >> $CONFIGH
54 ++fi
55 ++
56 ++#############################################################################################
57 + # Are ipv6 headers usable ?
58 + [ -z "$IPV6" ] && IPV6=yes
59 + if [[ "$IPV6" == "yes" ]]; then
60 +@@ -290,6 +313,7 @@ fi
61 +
62 + #############################################################################################
63 +
64 ++check_header linux/auto_fs4.h USE_AUTOFS_EXPIRE
65 + check_header linux/caif/caif_socket.h USE_CAIF
66 + check_header linux/fsmap.h USE_FSMAP
67 + check_header linux/if_alg.h USE_IF_ALG
68 +--- a/ioctls/autofs.c.orig 2017-11-03 09:14:07.000000000 -0600
69 ++++ b/ioctls/autofs.c 2017-11-18 14:21:14.487774564 -0700
70 +@@ -238,8 +238,10 @@ static const struct ioctl autofs_ioctls[
71 + IOCTL(AUTOFS_IOC_SETTIMEOUT),
72 + IOCTL(AUTOFS_IOC_EXPIRE),
73 + IOCTL(AUTOFS_IOC_EXPIRE_MULTI),
74 ++#ifdef PRE_4_14_KERNEL
75 + IOCTL(AUTOFS_IOC_EXPIRE_INDIRECT),
76 + IOCTL(AUTOFS_IOC_EXPIRE_DIRECT),
77 ++#endif
78 + IOCTL(AUTOFS_IOC_PROTOSUBVER),
79 + IOCTL(AUTOFS_IOC_ASKUMOUNT),
80 +
81
82 diff --git a/dev-util/trinity/files/trinity-irda.patch b/dev-util/trinity/files/trinity-irda.patch
83 new file mode 100644
84 index 00000000000..eb298fd99d8
85 --- /dev/null
86 +++ b/dev-util/trinity/files/trinity-irda.patch
87 @@ -0,0 +1,47 @@
88 +--- a/configure.orig 2017-11-18 14:25:52.095495407 -0700
89 ++++ b/configure 2018-07-21 11:44:59.235072132 -0600
90 +@@ -317,6 +317,7 @@ check_header linux/auto_fs4.h USE_AUTOFS
91 + check_header linux/caif/caif_socket.h USE_CAIF
92 + check_header linux/fsmap.h USE_FSMAP
93 + check_header linux/if_alg.h USE_IF_ALG
94 ++check_header linux/irda.h USE_IRDA
95 + check_header linux/rds.h USE_RDS
96 + check_header linux/vfio.h USE_VFIO
97 + check_header drm/drm.h USE_DRM
98 +--- a/net/protocols.c.orig 2017-11-03 09:14:07.000000000 -0600
99 ++++ b/net/protocols.c 2018-07-21 11:48:09.065940013 -0600
100 +@@ -26,7 +26,9 @@ const struct protoptr net_protocols[TRIN
101 + #ifdef USE_RDS
102 + [PF_RDS] = { .proto = &proto_rds },
103 + #endif
104 ++#ifdef USE_IRDA
105 + [PF_IRDA] = { .proto = &proto_irda },
106 ++#endif
107 + [PF_LLC] = { .proto = &proto_llc },
108 + [PF_CAN] = { .proto = &proto_can },
109 + [PF_TIPC] = { .proto = &proto_tipc },
110 +--- a/net/proto-irda.c.orig 2017-11-03 09:14:07.000000000 -0600
111 ++++ b/net/proto-irda.c 2018-07-21 11:45:34.330047712 -0600
112 +@@ -4,13 +4,15 @@
113 + #include <sys/un.h>
114 + /* old irda.h does not include something which defines sa_family_t */
115 + #include <netinet/in.h>
116 +-#include <linux/irda.h>
117 + #include <stdlib.h>
118 + #include "net.h"
119 + #include "random.h"
120 + #include "utils.h" // RAND_ARRAY
121 + #include "compat.h"
122 +
123 ++#ifdef USE_IRDA
124 ++#include <linux/irda.h>
125 ++
126 + static void irda_gen_sockaddr(struct sockaddr **addr, socklen_t *addrlen)
127 + {
128 + struct sockaddr_irda *irda;
129 +@@ -53,3 +55,5 @@ const struct netproto proto_irda = {
130 + .valid_triplets = irda_triplets,
131 + .nr_triplets = ARRAY_SIZE(irda_triplets),
132 + };
133 ++
134 ++#endif
135
136 diff --git a/dev-util/trinity/files/trinity-memfd.patch b/dev-util/trinity/files/trinity-memfd.patch
137 new file mode 100644
138 index 00000000000..d333aac2941
139 --- /dev/null
140 +++ b/dev-util/trinity/files/trinity-memfd.patch
141 @@ -0,0 +1,79 @@
142 +commit c93bb184ce996c4d77eefbae2ab0bf74f396ec45
143 +Author: Baruch Siach <baruch@×××××××.il>
144 +Date: Tue Mar 13 06:53:06 2018 +0200
145 +
146 + memfd: fix build with glibc 2.27
147 +
148 + glibc 2.27 added a wrapper for memfd_create(). This causes build
149 + failure:
150 +
151 + fds/memfd.c:19:12: error: static declaration of 'memfd_create' follows non-static declaration
152 + static int memfd_create(__unused__ const char *uname, __unused__ unsigned int flag)
153 + ^~~~~~~~~~~~
154 +
155 + Don't use the local definition when the libc provides one.
156 +
157 + Signed-off-by: Baruch Siach <baruch@×××××××.il>
158 +
159 +diff --git a/configure b/configure
160 +index dc0a87d8c1ad..c0166af33048 100755
161 +--- a/configure
162 ++++ b/configure
163 +@@ -289,6 +289,29 @@ else
164 + fi
165 +
166 + #############################################################################################
167 ++# Does glibc provide memfd_create() syscall wrapper
168 ++#
169 ++echo -n "[*] Checking if glibc provides memfd_create.. "
170 ++rm -f "$TMP" || exit 1
171 ++
172 ++cat >"$TMP.c" << EOF
173 ++#include <sys/mman.h>
174 ++
175 ++void main()
176 ++{
177 ++ memfd_create();
178 ++}
179 ++EOF
180 ++
181 ++${CC} ${CFLAGS} "$TMP.c" -o "$TMP" &>"$TMP.log"
182 ++if [ ! -x "$TMP" ]; then
183 ++ echo $RED "[NO]" $COL_RESET
184 ++else
185 ++ echo $GREEN "[YES]" $COL_RESET
186 ++ echo "#define USE_MEMFD_CREATE 1" >> $CONFIGH
187 ++fi
188 ++
189 ++#############################################################################################
190 +
191 + check_header linux/caif/caif_socket.h USE_CAIF
192 + check_header linux/fsmap.h USE_FSMAP
193 +diff --git a/fds/memfd.c b/fds/memfd.c
194 +index 210678e4571c..aaaac2f78f54 100644
195 +--- a/fds/memfd.c
196 ++++ b/fds/memfd.c
197 +@@ -5,6 +5,7 @@
198 + #include <stdlib.h>
199 + #include <string.h>
200 + #include <unistd.h>
201 ++#include <sys/mman.h>
202 +
203 + #include "fd.h"
204 + #include "memfd.h"
205 +@@ -16,6 +17,7 @@
206 + #include "trinity.h"
207 + #include "udp.h"
208 +
209 ++#ifndef USE_MEMFD_CREATE
210 + static int memfd_create(__unused__ const char *uname, __unused__ unsigned int flag)
211 + {
212 + #ifdef SYS_memfd_create
213 +@@ -24,6 +26,7 @@ static int memfd_create(__unused__ const char *uname, __unused__ unsigned int fl
214 + return -ENOSYS;
215 + #endif
216 + }
217 ++#endif
218 +
219 + static void memfd_destructor(struct object *obj)
220 + {
221
222 diff --git a/dev-util/trinity/files/trinity-net-protocols.patch b/dev-util/trinity/files/trinity-net-protocols.patch
223 new file mode 100644
224 index 00000000000..d2583b56ebd
225 --- /dev/null
226 +++ b/dev-util/trinity/files/trinity-net-protocols.patch
227 @@ -0,0 +1,11 @@
228 +--- a/syscalls/setsockopt.c.orig 2017-11-03 09:14:07.000000000 -0600
229 ++++ b/syscalls/setsockopt.c 2017-11-18 13:44:19.283946230 -0700
230 +@@ -90,7 +90,7 @@ static void do_random_sso(struct sockopt
231 + retry:
232 + switch (rnd() % 4) {
233 + case 0: /* do a random protocol, even if it doesn't match this socket. */
234 +- i = rnd() % PF_MAX;
235 ++ i = rnd() % TRINITY_PF_MAX;
236 + proto = net_protocols[i].proto;
237 + if (proto != NULL) {
238 + if (proto->setsockopt != NULL) {
239
240 diff --git a/dev-util/trinity/trinity-1.8.ebuild b/dev-util/trinity/trinity-1.8.ebuild
241 index 1072988366e..2cb2ae2a86e 100644
242 --- a/dev-util/trinity/trinity-1.8.ebuild
243 +++ b/dev-util/trinity/trinity-1.8.ebuild
244 @@ -1,7 +1,7 @@
245 -# Copyright 1999-2018 Gentoo Foundation
246 +# Copyright 1999-2018 Gentoo Authors
247 # Distributed under the terms of the GNU General Public License v2
248
249 -EAPI=6
250 +EAPI=7
251 inherit toolchain-funcs
252
253 DESCRIPTION="A Linux system call fuzz tester"
254 @@ -14,9 +14,18 @@ KEYWORDS="~amd64 ~x86"
255 IUSE="examples"
256
257 # We need newer headers to avoid compilation failures in the BPF stuff.
258 -DEPEND="app-arch/xz-utils
259 +DEPEND="
260 >=sys-kernel/linux-headers-4.8
261 "
262 +RDEPEND=""
263 +
264 +PATCHES=(
265 + # Fixes from Fedora and Debian
266 + "${FILESDIR}"/${PN}-autofs.patch
267 + "${FILESDIR}"/${PN}-irda.patch
268 + "${FILESDIR}"/${PN}-memfd.patch
269 + "${FILESDIR}"/${PN}-net-protocols.patch
270 +)
271
272 src_configure() {
273 tc-export CC