1 |
commit: 97d4262f6c82af3f9c1c73e7d2345198114d92ed |
2 |
Author: Sam James <sam <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Aug 5 01:02:36 2022 +0000 |
4 |
Commit: Sam James <sam <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Aug 5 01:02:36 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=97d4262f |
7 |
|
8 |
sys-process/criu: fix build w/ glibc 2.36 |
9 |
|
10 |
Closes: https://bugs.gentoo.org/863683 |
11 |
Signed-off-by: Sam James <sam <AT> gentoo.org> |
12 |
|
13 |
sys-process/criu/criu-3.17-r1.ebuild | 1 + |
14 |
sys-process/criu/files/criu-3.17-glibc-2.36.patch | 242 ++++++++++++++++++++++ |
15 |
2 files changed, 243 insertions(+) |
16 |
|
17 |
diff --git a/sys-process/criu/criu-3.17-r1.ebuild b/sys-process/criu/criu-3.17-r1.ebuild |
18 |
index 66993d5ce406..ac5e1722d999 100644 |
19 |
--- a/sys-process/criu/criu-3.17-r1.ebuild |
20 |
+++ b/sys-process/criu/criu-3.17-r1.ebuild |
21 |
@@ -60,6 +60,7 @@ PATCHES=( |
22 |
"${FILESDIR}/criu-3.16.1-buildsystem.patch" |
23 |
|
24 |
"${FILESDIR}/${P}-amdgpu-build-fixes.patch" |
25 |
+ "${FILESDIR}/${PN}-3.17-glibc-2.36.patch" |
26 |
) |
27 |
|
28 |
criu_arch() { |
29 |
|
30 |
diff --git a/sys-process/criu/files/criu-3.17-glibc-2.36.patch b/sys-process/criu/files/criu-3.17-glibc-2.36.patch |
31 |
new file mode 100644 |
32 |
index 000000000000..5387c5a5b97c |
33 |
--- /dev/null |
34 |
+++ b/sys-process/criu/files/criu-3.17-glibc-2.36.patch |
35 |
@@ -0,0 +1,242 @@ |
36 |
+https://bugs.gentoo.org/863683 |
37 |
+https://github.com/checkpoint-restore/criu/pull/1943 |
38 |
+ |
39 |
+From 8cd5fccd6cf3d03afb5abe463134d31f54d42258 Mon Sep 17 00:00:00 2001 |
40 |
+From: Radostin Stoyanov <rstoyanov@×××××××××××××.org> |
41 |
+Date: Sun, 31 Jul 2022 16:07:30 +0000 |
42 |
+Subject: [PATCH 2/2] criu: fix conflicting headers |
43 |
+ |
44 |
+There are several changes in glibc 2.36 that make sys/mount.h header |
45 |
+incompatible with kernel headers: |
46 |
+ |
47 |
+https://sourceware.org/glibc/wiki/Release/2.36#Usage_of_.3Clinux.2Fmount.h.3E_and_.3Csys.2Fmount.h.3E |
48 |
+ |
49 |
+This patch removes conflicting includes for `<linux/mount.h>` and |
50 |
+updates the content of `criu/include/linux/mount.h` to match |
51 |
+`/usr/include/sys/mount.h`. In addition, inline definitions sys_*() |
52 |
+functions have been moved from "linux/mount.h" to "syscall.h" to |
53 |
+avoid conflicts with `uapi/compel/plugins/std/syscall.h` and |
54 |
+`<unistd.h>`. The include for `<linux/aio_abi.h>` has been replaced |
55 |
+with local include to avoid conflicts with `<sys/mount.h>`. |
56 |
+ |
57 |
+Fixes: #1949 |
58 |
+ |
59 |
+Signed-off-by: Radostin Stoyanov <rstoyanov@×××××××××××××.org> |
60 |
+--- a/criu/cgroup.c |
61 |
++++ b/criu/cgroup.c |
62 |
+@@ -27,6 +27,7 @@ |
63 |
+ #include "images/cgroup.pb-c.h" |
64 |
+ #include "kerndat.h" |
65 |
+ #include "linux/mount.h" |
66 |
++#include "syscall.h" |
67 |
+ |
68 |
+ /* |
69 |
+ * This structure describes set of controller groups |
70 |
+--- a/criu/cr-check.c |
71 |
++++ b/criu/cr-check.c |
72 |
+@@ -21,7 +21,6 @@ |
73 |
+ #include <sys/prctl.h> |
74 |
+ #include <sched.h> |
75 |
+ #include <sys/mount.h> |
76 |
+-#include <linux/aio_abi.h> |
77 |
+ |
78 |
+ #include "../soccr/soccr.h" |
79 |
+ |
80 |
+@@ -52,6 +51,7 @@ |
81 |
+ #include "net.h" |
82 |
+ #include "restorer.h" |
83 |
+ #include "uffd.h" |
84 |
++#include "linux/aio_abi.h" |
85 |
+ |
86 |
+ #include "images/inventory.pb-c.h" |
87 |
+ |
88 |
+--- a/criu/cr-restore.c |
89 |
++++ b/criu/cr-restore.c |
90 |
+@@ -22,7 +22,6 @@ |
91 |
+ #include <compel/ptrace.h> |
92 |
+ #include "common/compiler.h" |
93 |
+ |
94 |
+-#include "linux/mount.h" |
95 |
+ #include "linux/rseq.h" |
96 |
+ |
97 |
+ #include "clone-noasan.h" |
98 |
+@@ -86,6 +85,8 @@ |
99 |
+ #include <compel/plugins/std/syscall-codes.h> |
100 |
+ #include "compel/include/asm/syscall.h" |
101 |
+ |
102 |
++#include "linux/mount.h" |
103 |
++ |
104 |
+ #include "protobuf.h" |
105 |
+ #include "images/sa.pb-c.h" |
106 |
+ #include "images/timer.pb-c.h" |
107 |
+--- a/criu/include/aio.h |
108 |
++++ b/criu/include/aio.h |
109 |
+@@ -1,7 +1,7 @@ |
110 |
+ #ifndef __CR_AIO_H__ |
111 |
+ #define __CR_AIO_H__ |
112 |
+ |
113 |
+-#include <linux/aio_abi.h> |
114 |
++#include "linux/aio_abi.h" |
115 |
+ #include "images/mm.pb-c.h" |
116 |
+ unsigned int aio_estimate_nr_reqs(unsigned int size); |
117 |
+ int dump_aio_ring(MmEntry *mme, struct vma_area *vma); |
118 |
+--- /dev/null |
119 |
++++ b/criu/include/linux/aio_abi.h |
120 |
+@@ -0,0 +1,14 @@ |
121 |
++#ifndef __LINUX__AIO_ABI_H |
122 |
++#define __LINUX__AIO_ABI_H |
123 |
++ |
124 |
++typedef __kernel_ulong_t aio_context_t; |
125 |
++ |
126 |
++/* read() from /dev/aio returns these structures. */ |
127 |
++struct io_event { |
128 |
++ __u64 data; /* the data field from the iocb */ |
129 |
++ __u64 obj; /* what iocb this event came from */ |
130 |
++ __s64 res; /* result code for this event */ |
131 |
++ __s64 res2; /* secondary result */ |
132 |
++}; |
133 |
++ |
134 |
++#endif /* __LINUX__AIO_ABI_H */ |
135 |
+--- a/criu/include/linux/mount.h |
136 |
++++ b/criu/include/linux/mount.h |
137 |
+@@ -4,32 +4,34 @@ |
138 |
+ #include "common/config.h" |
139 |
+ #include "compel/plugins/std/syscall-codes.h" |
140 |
+ |
141 |
+-#ifdef CONFIG_HAS_FSCONFIG |
142 |
+-#include <linux/mount.h> |
143 |
+-#else |
144 |
++/* Copied from /usr/include/sys/mount.h */ |
145 |
++ |
146 |
++#ifndef FSCONFIG_CMD_CREATE |
147 |
++/* The type of fsconfig call made. */ |
148 |
+ enum fsconfig_command { |
149 |
+- FSCONFIG_SET_FLAG = 0, /* Set parameter, supplying no value */ |
150 |
+- FSCONFIG_SET_STRING = 1, /* Set parameter, supplying a string value */ |
151 |
+- FSCONFIG_SET_BINARY = 2, /* Set parameter, supplying a binary blob value */ |
152 |
+- FSCONFIG_SET_PATH = 3, /* Set parameter, supplying an object by path */ |
153 |
+- FSCONFIG_SET_PATH_EMPTY = 4, /* Set parameter, supplying an object by (empty) path */ |
154 |
+- FSCONFIG_SET_FD = 5, /* Set parameter, supplying an object by fd */ |
155 |
+- FSCONFIG_CMD_CREATE = 6, /* Invoke superblock creation */ |
156 |
++ FSCONFIG_SET_FLAG = 0, /* Set parameter, supplying no value */ |
157 |
++#define FSCONFIG_SET_FLAG FSCONFIG_SET_FLAG |
158 |
++ FSCONFIG_SET_STRING = 1, /* Set parameter, supplying a string value */ |
159 |
++#define FSCONFIG_SET_STRING FSCONFIG_SET_STRING |
160 |
++ FSCONFIG_SET_BINARY = 2, /* Set parameter, supplying a binary blob value */ |
161 |
++#define FSCONFIG_SET_BINARY FSCONFIG_SET_BINARY |
162 |
++ FSCONFIG_SET_PATH = 3, /* Set parameter, supplying an object by path */ |
163 |
++#define FSCONFIG_SET_PATH FSCONFIG_SET_PATH |
164 |
++ FSCONFIG_SET_PATH_EMPTY = 4, /* Set parameter, supplying an object by (empty) path */ |
165 |
++#define FSCONFIG_SET_PATH_EMPTY FSCONFIG_SET_PATH_EMPTY |
166 |
++ FSCONFIG_SET_FD = 5, /* Set parameter, supplying an object by fd */ |
167 |
++#define FSCONFIG_SET_FD FSCONFIG_SET_FD |
168 |
++ FSCONFIG_CMD_CREATE = 6, /* Invoke superblock creation */ |
169 |
++#define FSCONFIG_CMD_CREATE FSCONFIG_CMD_CREATE |
170 |
+ FSCONFIG_CMD_RECONFIGURE = 7, /* Invoke superblock reconfiguration */ |
171 |
++#define FSCONFIG_CMD_RECONFIGURE FSCONFIG_CMD_RECONFIGURE |
172 |
+ }; |
173 |
+-#endif |
174 |
++#endif // FSCONFIG_CMD_CREATE |
175 |
+ |
176 |
+-static inline int sys_fsopen(const char *fsname, unsigned int flags) |
177 |
+-{ |
178 |
+- return syscall(__NR_fsopen, fsname, flags); |
179 |
+-} |
180 |
+-static inline int sys_fsconfig(int fd, unsigned int cmd, const char *key, const char *value, int aux) |
181 |
+-{ |
182 |
+- return syscall(__NR_fsconfig, fd, cmd, key, value, aux); |
183 |
+-} |
184 |
+-static inline int sys_fsmount(int fd, unsigned int flags, unsigned int attr_flags) |
185 |
+-{ |
186 |
+- return syscall(__NR_fsmount, fd, flags, attr_flags); |
187 |
+-} |
188 |
++#ifndef MS_MGC_VAL |
189 |
++/* Magic mount flag number. Has to be or-ed to the flag values. */ |
190 |
++#define MS_MGC_VAL 0xc0ed0000 /* Magic flag number to indicate "new" flags */ |
191 |
++#define MS_MGC_MSK 0xffff0000 /* Magic flag number mask */ |
192 |
++#endif |
193 |
+ |
194 |
+ #endif |
195 |
+--- /dev/null |
196 |
++++ b/criu/include/syscall.h |
197 |
+@@ -0,0 +1,17 @@ |
198 |
++#ifndef __CR_SYSCALL_H__ |
199 |
++#define __CR_SYSCALL_H__ |
200 |
++ |
201 |
++static inline int sys_fsopen(const char *fsname, unsigned int flags) |
202 |
++{ |
203 |
++ return syscall(__NR_fsopen, fsname, flags); |
204 |
++} |
205 |
++static inline int sys_fsconfig(int fd, unsigned int cmd, const char *key, const char *value, int aux) |
206 |
++{ |
207 |
++ return syscall(__NR_fsconfig, fd, cmd, key, value, aux); |
208 |
++} |
209 |
++static inline int sys_fsmount(int fd, unsigned int flags, unsigned int attr_flags) |
210 |
++{ |
211 |
++ return syscall(__NR_fsmount, fd, flags, attr_flags); |
212 |
++} |
213 |
++ |
214 |
++#endif /* __CR_SYSCALL_H__ */ |
215 |
+\ No newline at end of file |
216 |
+--- a/criu/pie/parasite.c |
217 |
++++ b/criu/pie/parasite.c |
218 |
+@@ -3,7 +3,6 @@ |
219 |
+ #include <signal.h> |
220 |
+ #include <linux/limits.h> |
221 |
+ #include <linux/capability.h> |
222 |
+-#include <sys/mount.h> |
223 |
+ #include <stdarg.h> |
224 |
+ #include <sys/ioctl.h> |
225 |
+ #include <sys/uio.h> |
226 |
+@@ -14,6 +13,7 @@ |
227 |
+ #include "int.h" |
228 |
+ #include "types.h" |
229 |
+ #include <compel/plugins/std/syscall.h> |
230 |
++#include "linux/mount.h" |
231 |
+ #include "parasite.h" |
232 |
+ #include "fcntl.h" |
233 |
+ #include "prctl.h" |
234 |
+--- a/criu/util.c |
235 |
++++ b/criu/util.c |
236 |
+@@ -40,6 +40,7 @@ |
237 |
+ #include "mem.h" |
238 |
+ #include "namespaces.h" |
239 |
+ #include "criu-log.h" |
240 |
++#include "syscall.h" |
241 |
+ |
242 |
+ #include "clone-noasan.h" |
243 |
+ #include "cr_options.h" |
244 |
+--- a/scripts/feature-tests.mak |
245 |
++++ b/scripts/feature-tests.mak |
246 |
+@@ -137,19 +137,6 @@ ENTRY(main) |
247 |
+ END(main) |
248 |
+ endef |
249 |
+ |
250 |
+-define FEATURE_TEST_FSCONFIG |
251 |
+- |
252 |
+-#include <linux/mount.h> |
253 |
+- |
254 |
+-int main(void) |
255 |
+-{ |
256 |
+- if (FSCONFIG_CMD_CREATE > 0) |
257 |
+- return 0; |
258 |
+- return 0; |
259 |
+-} |
260 |
+- |
261 |
+-endef |
262 |
+- |
263 |
+ define FEATURE_TEST_NFTABLES_LIB_API_0 |
264 |
+ |
265 |
+ #include <string.h> |
266 |
+ |
267 |
+--- a/Makefile.config |
268 |
++++ b/Makefile.config |
269 |
+@@ -70,7 +70,7 @@ export DEFINES += $(FEATURE_DEFINES) |
270 |
+ export CFLAGS += $(FEATURE_DEFINES) |
271 |
+ |
272 |
+ FEATURES_LIST := TCP_REPAIR STRLCPY STRLCAT PTRACE_PEEKSIGINFO \ |
273 |
+- SETPROCTITLE_INIT MEMFD TCP_REPAIR_WINDOW FSCONFIG MEMFD_CREATE OPENAT2 |
274 |
++ SETPROCTITLE_INIT MEMFD TCP_REPAIR_WINDOW MEMFD_CREATE OPENAT2 |
275 |
+ |
276 |
+ # $1 - config name |
277 |
+ define gen-feature-test |