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