diff --git a/0001-rseq-fix-headers-conflict-on-Mariner-GNU-Linux.patch b/0001-rseq-fix-headers-conflict-on-Mariner-GNU-Linux.patch deleted file mode 100644 index 89dfcbecf8bf8eb76f649056e1c9bae680902751..0000000000000000000000000000000000000000 --- a/0001-rseq-fix-headers-conflict-on-Mariner-GNU-Linux.patch +++ /dev/null @@ -1,218 +0,0 @@ -From 1e6e826ffb7ac05f33fa123051c2fc2ddf0f68ea Mon Sep 17 00:00:00 2001 -From: Alexander Mikhalitsyn -Date: Fri, 8 Jul 2022 12:36:57 +0000 -Subject: [PATCH] rseq: fix headers conflict on Mariner GNU/Linux -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -1. For some reason, Marier distribution headers -not correctly define __GLIBC_HAVE_KERNEL_RSEQ -compile-time constant. It remains undefined, -but in fact header files provides corresponding -rseq types declaration which leads to conflict. - -2. Another issue, is that they use uint*_t types -instead of __u* types as in original rseq.h. - -This leads to compile time issues like this: -format '%llx' expects argument of type 'long long unsigned int', but argument 5 has type 'uint64_t' {aka 'long unsigned int'} - -and we can't even replace %llx to %PRIx64 because it will break -compilation on other distros (like Fedora) with analogical error: - -error: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 6 has type ‘__u64’ {aka ‘long long unsigned int’} - -Let's use our-own struct rseq copy fully equal to the kernel one, -it's safe because this structure is a part of Linux Kernel ABI. - -Fixes #1934 - -Reported-by: Nikola Bojanic -Signed-off-by: Alexander Mikhalitsyn ---- - Makefile.config | 3 ++- - criu/cr-dump.c | 15 ++++++++------- - criu/include/linux/rseq.h | 20 ++++++++++++++------ - criu/include/pstree.h | 2 +- - scripts/feature-tests.mak | 19 +++++++++++++++++++ - 5 files changed, 44 insertions(+), 15 deletions(-) - -diff --git a/Makefile.config b/Makefile.config -index d46d84f2d..d113e2246 100644 ---- a/Makefile.config -+++ b/Makefile.config -@@ -78,7 +78,8 @@ export DEFINES += $(FEATURE_DEFINES) - export CFLAGS += $(FEATURE_DEFINES) - - FEATURES_LIST := TCP_REPAIR STRLCPY STRLCAT PTRACE_PEEKSIGINFO \ -- SETPROCTITLE_INIT MEMFD TCP_REPAIR_WINDOW FSCONFIG MEMFD_CREATE OPENAT2 -+ SETPROCTITLE_INIT MEMFD TCP_REPAIR_WINDOW FSCONFIG MEMFD_CREATE \ -+ OPENAT2 NO_LIBC_RSEQ_DEFS - - # $1 - config name - define gen-feature-test -diff --git a/criu/cr-dump.c b/criu/cr-dump.c -index e60da88ed..210f66232 100644 ---- a/criu/cr-dump.c -+++ b/criu/cr-dump.c -@@ -1039,7 +1039,7 @@ static int dump_task_signals(pid_t pid, struct pstree_item *item) - return 0; - } - --static int read_rseq_cs(pid_t tid, struct __ptrace_rseq_configuration *rseqc, struct rseq_cs *rseq_cs, -+static int read_rseq_cs(pid_t tid, struct __ptrace_rseq_configuration *rseqc, struct criu_rseq_cs *rseq_cs, - struct criu_rseq *rseq) - { - int ret; -@@ -1070,10 +1070,11 @@ static int read_rseq_cs(pid_t tid, struct __ptrace_rseq_configuration *rseqc, st - if (!rseq->rseq_cs) - return 0; - -- ret = ptrace_peek_area(tid, rseq_cs, decode_pointer(rseq->rseq_cs), sizeof(struct rseq_cs)); -+ ret = ptrace_peek_area(tid, rseq_cs, decode_pointer(rseq->rseq_cs), sizeof(struct criu_rseq_cs)); - if (ret) { - pr_err("ptrace_peek_area(%d, %lx, %lx, %lx): fail to read rseq_cs struct\n", tid, -- (unsigned long)rseq_cs, (unsigned long)rseq->rseq_cs, (unsigned long)sizeof(struct rseq_cs)); -+ (unsigned long)rseq_cs, (unsigned long)rseq->rseq_cs, -+ (unsigned long)sizeof(struct criu_rseq_cs)); - return -1; - } - -@@ -1088,7 +1089,7 @@ static int dump_thread_rseq(struct pstree_item *item, int i) - CoreEntry *core = item->core[i]; - RseqEntry **rseqep = &core->thread_core->rseq_entry; - struct criu_rseq rseq = {}; -- struct rseq_cs *rseq_cs = &dmpi(item)->thread_rseq_cs[i]; -+ struct criu_rseq_cs *rseq_cs = &dmpi(item)->thread_rseq_cs[i]; - pid_t tid = item->threads[i].real; - - /* -@@ -1154,7 +1155,7 @@ err: - static int dump_task_rseq(pid_t pid, struct pstree_item *item) - { - int i; -- struct rseq_cs *thread_rseq_cs; -+ struct criu_rseq_cs *thread_rseq_cs; - - /* if rseq() syscall isn't supported then nothing to dump */ - if (!kdat.has_rseq) -@@ -1179,7 +1180,7 @@ free_rseq: - return -1; - } - --static bool task_in_rseq(struct rseq_cs *rseq_cs, uint64_t addr) -+static bool task_in_rseq(struct criu_rseq_cs *rseq_cs, uint64_t addr) - { - return addr >= rseq_cs->start_ip && addr < rseq_cs->start_ip + rseq_cs->post_commit_offset; - } -@@ -1187,7 +1188,7 @@ static bool task_in_rseq(struct rseq_cs *rseq_cs, uint64_t addr) - static int fixup_thread_rseq(struct pstree_item *item, int i) - { - CoreEntry *core = item->core[i]; -- struct rseq_cs *rseq_cs = &dmpi(item)->thread_rseq_cs[i]; -+ struct criu_rseq_cs *rseq_cs = &dmpi(item)->thread_rseq_cs[i]; - pid_t tid = item->threads[i].real; - - /* equivalent to (struct rseq)->rseq_cs is NULL */ -diff --git a/criu/include/linux/rseq.h b/criu/include/linux/rseq.h -index a47876e66..5ceefbf8e 100644 ---- a/criu/include/linux/rseq.h -+++ b/criu/include/linux/rseq.h -@@ -9,7 +9,12 @@ - #endif - #endif - --#ifndef __GLIBC_HAVE_KERNEL_RSEQ -+#include -+#include -+ -+#include "common/config.h" -+ -+#ifdef CONFIG_HAS_NO_LIBC_RSEQ_DEFS - /* - * linux/rseq.h - * -@@ -18,9 +23,6 @@ - * Copyright (c) 2015-2018 Mathieu Desnoyers - */ - --#include --#include -- - enum rseq_cpu_id_state { - RSEQ_CPU_ID_UNINITIALIZED = -1, - RSEQ_CPU_ID_REGISTRATION_FAILED = -2, -@@ -41,13 +43,20 @@ enum rseq_cs_flags { - RSEQ_CS_FLAG_NO_RESTART_ON_SIGNAL = (1U << RSEQ_CS_FLAG_NO_RESTART_ON_SIGNAL_BIT), - RSEQ_CS_FLAG_NO_RESTART_ON_MIGRATE = (1U << RSEQ_CS_FLAG_NO_RESTART_ON_MIGRATE_BIT), - }; -+#endif /* CONFIG_HAS_NO_LIBC_RSEQ_DEFS */ - -+/* -+ * Let's use our own definition of struct rseq_cs because some distros -+ * (for example Mariner GNU/Linux) declares this structure their-own way. -+ * This makes trouble with inconsistency between printf formatters and -+ * struct rseq_cs field types. -+ */ - /* - * struct rseq_cs is aligned on 4 * 8 bytes to ensure it is always - * contained within a single cache-line. It is usually declared as - * link-time constant data. - */ --struct rseq_cs { -+struct criu_rseq_cs { - /* Version of this structure. */ - __u32 version; - /* enum rseq_cs_flags */ -@@ -57,7 +66,6 @@ struct rseq_cs { - __u64 post_commit_offset; - __u64 abort_ip; - } __attribute__((aligned(4 * sizeof(__u64)))); --#endif /* __GLIBC_HAVE_KERNEL_RSEQ */ - - /* - * We have to have our own copy of struct rseq definition because -diff --git a/criu/include/pstree.h b/criu/include/pstree.h -index 8ae750e1a..1137046d4 100644 ---- a/criu/include/pstree.h -+++ b/criu/include/pstree.h -@@ -63,7 +63,7 @@ struct dmp_info { - struct parasite_ctl *parasite_ctl; - struct parasite_thread_ctl **thread_ctls; - uint64_t *thread_sp; -- struct rseq_cs *thread_rseq_cs; -+ struct criu_rseq_cs *thread_rseq_cs; - - /* - * Although we don't support dumping different struct creds in general, -diff --git a/scripts/feature-tests.mak b/scripts/feature-tests.mak -index 592552cb8..014e893a8 100644 ---- a/scripts/feature-tests.mak -+++ b/scripts/feature-tests.mak -@@ -196,3 +196,22 @@ int main(void) - return 0; - } - endef -+ -+define FEATURE_TEST_NO_LIBC_RSEQ_DEFS -+ -+#ifdef __has_include -+#if __has_include(\"sys/rseq.h\") -+#include -+#endif -+#endif -+ -+enum rseq_cpu_id_state { -+ RSEQ_CPU_ID_UNINITIALIZED = -1, -+ RSEQ_CPU_ID_REGISTRATION_FAILED = -2, -+}; -+ -+int main(void) -+{ -+ return 0; -+} -+endef --- -2.19.1.6.gb485710b - diff --git a/0002-criu-fix-conflicting-headers.patch b/0002-criu-fix-conflicting-headers.patch deleted file mode 100644 index ebc1cfab0bf21bb2f79917f41fb3740a90f59c3d..0000000000000000000000000000000000000000 --- a/0002-criu-fix-conflicting-headers.patch +++ /dev/null @@ -1,281 +0,0 @@ -From 4c86d6a7d54abb64fc5a15131f3351224e8c071b Mon Sep 17 00:00:00 2001 -From: Radostin Stoyanov -Date: Sun, 31 Jul 2022 16:07:30 +0000 -Subject: [PATCH] criu: fix conflicting headers - -There are several changes in glibc 2.36 that make sys/mount.h header -incompatible with kernel headers: - -https://sourceware.org/glibc/wiki/Release/2.36#Usage_of_.3Clinux.2Fmount.h.3E_and_.3Csys.2Fmount.h.3E - -This patch removes conflicting includes for `` and -updates the content of `criu/include/linux/mount.h` to match -`/usr/include/sys/mount.h`. In addition, inline definitions sys_*() -functions have been moved from "linux/mount.h" to "syscall.h" to -avoid conflicts with `uapi/compel/plugins/std/syscall.h` and -``. The include for `` has been replaced -with local include to avoid conflicts with ``. - -Fixes: #1949 - -Signed-off-by: Radostin Stoyanov ---- - Makefile.config | 2 +- - criu/cgroup.c | 1 + - criu/cr-check.c | 2 +- - criu/cr-restore.c | 3 ++- - criu/include/aio.h | 2 +- - criu/include/linux/aio_abi.h | 14 +++++++++++ - criu/include/linux/mount.h | 48 +++++++++++++++++++----------------- - criu/include/syscall.h | 17 +++++++++++++ - criu/pie/parasite.c | 2 +- - criu/util.c | 1 + - scripts/feature-tests.mak | 13 ---------- - 11 files changed, 64 insertions(+), 41 deletions(-) - create mode 100644 criu/include/linux/aio_abi.h - create mode 100644 criu/include/syscall.h - -diff --git a/Makefile.config b/Makefile.config -index d113e2246..270ec61c0 100644 ---- a/Makefile.config -+++ b/Makefile.config -@@ -78,7 +78,7 @@ export DEFINES += $(FEATURE_DEFINES) - export CFLAGS += $(FEATURE_DEFINES) - - FEATURES_LIST := TCP_REPAIR STRLCPY STRLCAT PTRACE_PEEKSIGINFO \ -- SETPROCTITLE_INIT MEMFD TCP_REPAIR_WINDOW FSCONFIG MEMFD_CREATE \ -+ SETPROCTITLE_INIT MEMFD TCP_REPAIR_WINDOW MEMFD_CREATE \ - OPENAT2 NO_LIBC_RSEQ_DEFS - - # $1 - config name -diff --git a/criu/cgroup.c b/criu/cgroup.c -index e05b0832e..325df6a1d 100644 ---- a/criu/cgroup.c -+++ b/criu/cgroup.c -@@ -27,6 +27,7 @@ - #include "images/cgroup.pb-c.h" - #include "kerndat.h" - #include "linux/mount.h" -+#include "syscall.h" - - /* - * This structure describes set of controller groups -diff --git a/criu/cr-check.c b/criu/cr-check.c -index f589a91da..0ca80192c 100644 ---- a/criu/cr-check.c -+++ b/criu/cr-check.c -@@ -21,7 +21,6 @@ - #include - #include - #include --#include - - #include "../soccr/soccr.h" - -@@ -52,6 +51,7 @@ - #include "net.h" - #include "restorer.h" - #include "uffd.h" -+#include "linux/aio_abi.h" - - #include "images/inventory.pb-c.h" - -diff --git a/criu/cr-restore.c b/criu/cr-restore.c -index 279246c19..d11d28173 100644 ---- a/criu/cr-restore.c -+++ b/criu/cr-restore.c -@@ -22,7 +22,6 @@ - #include - #include "common/compiler.h" - --#include "linux/mount.h" - #include "linux/rseq.h" - - #include "clone-noasan.h" -@@ -86,6 +85,8 @@ - #include - #include "compel/include/asm/syscall.h" - -+#include "linux/mount.h" -+ - #include "protobuf.h" - #include "images/sa.pb-c.h" - #include "images/timer.pb-c.h" -diff --git a/criu/include/aio.h b/criu/include/aio.h -index d1655739d..38e704020 100644 ---- a/criu/include/aio.h -+++ b/criu/include/aio.h -@@ -1,7 +1,7 @@ - #ifndef __CR_AIO_H__ - #define __CR_AIO_H__ - --#include -+#include "linux/aio_abi.h" - #include "images/mm.pb-c.h" - unsigned int aio_estimate_nr_reqs(unsigned int size); - int dump_aio_ring(MmEntry *mme, struct vma_area *vma); -diff --git a/criu/include/linux/aio_abi.h b/criu/include/linux/aio_abi.h -new file mode 100644 -index 000000000..d9ce78720 ---- /dev/null -+++ b/criu/include/linux/aio_abi.h -@@ -0,0 +1,14 @@ -+#ifndef __LINUX__AIO_ABI_H -+#define __LINUX__AIO_ABI_H -+ -+typedef __kernel_ulong_t aio_context_t; -+ -+/* read() from /dev/aio returns these structures. */ -+struct io_event { -+ __u64 data; /* the data field from the iocb */ -+ __u64 obj; /* what iocb this event came from */ -+ __s64 res; /* result code for this event */ -+ __s64 res2; /* secondary result */ -+}; -+ -+#endif /* __LINUX__AIO_ABI_H */ -diff --git a/criu/include/linux/mount.h b/criu/include/linux/mount.h -index 9a3a28b10..0d55a588c 100644 ---- a/criu/include/linux/mount.h -+++ b/criu/include/linux/mount.h -@@ -4,32 +4,34 @@ - #include "common/config.h" - #include "compel/plugins/std/syscall-codes.h" - --#ifdef CONFIG_HAS_FSCONFIG --#include --#else -+/* Copied from /usr/include/sys/mount.h */ -+ -+#ifndef FSCONFIG_CMD_CREATE -+/* The type of fsconfig call made. */ - enum fsconfig_command { -- FSCONFIG_SET_FLAG = 0, /* Set parameter, supplying no value */ -- FSCONFIG_SET_STRING = 1, /* Set parameter, supplying a string value */ -- FSCONFIG_SET_BINARY = 2, /* Set parameter, supplying a binary blob value */ -- FSCONFIG_SET_PATH = 3, /* Set parameter, supplying an object by path */ -- FSCONFIG_SET_PATH_EMPTY = 4, /* Set parameter, supplying an object by (empty) path */ -- FSCONFIG_SET_FD = 5, /* Set parameter, supplying an object by fd */ -- FSCONFIG_CMD_CREATE = 6, /* Invoke superblock creation */ -+ FSCONFIG_SET_FLAG = 0, /* Set parameter, supplying no value */ -+#define FSCONFIG_SET_FLAG FSCONFIG_SET_FLAG -+ FSCONFIG_SET_STRING = 1, /* Set parameter, supplying a string value */ -+#define FSCONFIG_SET_STRING FSCONFIG_SET_STRING -+ FSCONFIG_SET_BINARY = 2, /* Set parameter, supplying a binary blob value */ -+#define FSCONFIG_SET_BINARY FSCONFIG_SET_BINARY -+ FSCONFIG_SET_PATH = 3, /* Set parameter, supplying an object by path */ -+#define FSCONFIG_SET_PATH FSCONFIG_SET_PATH -+ FSCONFIG_SET_PATH_EMPTY = 4, /* Set parameter, supplying an object by (empty) path */ -+#define FSCONFIG_SET_PATH_EMPTY FSCONFIG_SET_PATH_EMPTY -+ FSCONFIG_SET_FD = 5, /* Set parameter, supplying an object by fd */ -+#define FSCONFIG_SET_FD FSCONFIG_SET_FD -+ FSCONFIG_CMD_CREATE = 6, /* Invoke superblock creation */ -+#define FSCONFIG_CMD_CREATE FSCONFIG_CMD_CREATE - FSCONFIG_CMD_RECONFIGURE = 7, /* Invoke superblock reconfiguration */ -+#define FSCONFIG_CMD_RECONFIGURE FSCONFIG_CMD_RECONFIGURE - }; --#endif -+#endif // FSCONFIG_CMD_CREATE - --static inline int sys_fsopen(const char *fsname, unsigned int flags) --{ -- return syscall(__NR_fsopen, fsname, flags); --} --static inline int sys_fsconfig(int fd, unsigned int cmd, const char *key, const char *value, int aux) --{ -- return syscall(__NR_fsconfig, fd, cmd, key, value, aux); --} --static inline int sys_fsmount(int fd, unsigned int flags, unsigned int attr_flags) --{ -- return syscall(__NR_fsmount, fd, flags, attr_flags); --} -+#ifndef MS_MGC_VAL -+/* Magic mount flag number. Has to be or-ed to the flag values. */ -+#define MS_MGC_VAL 0xc0ed0000 /* Magic flag number to indicate "new" flags */ -+#define MS_MGC_MSK 0xffff0000 /* Magic flag number mask */ -+#endif - - #endif -diff --git a/criu/include/syscall.h b/criu/include/syscall.h -new file mode 100644 -index 000000000..c38d6d971 ---- /dev/null -+++ b/criu/include/syscall.h -@@ -0,0 +1,17 @@ -+#ifndef __CR_SYSCALL_H__ -+#define __CR_SYSCALL_H__ -+ -+static inline int sys_fsopen(const char *fsname, unsigned int flags) -+{ -+ return syscall(__NR_fsopen, fsname, flags); -+} -+static inline int sys_fsconfig(int fd, unsigned int cmd, const char *key, const char *value, int aux) -+{ -+ return syscall(__NR_fsconfig, fd, cmd, key, value, aux); -+} -+static inline int sys_fsmount(int fd, unsigned int flags, unsigned int attr_flags) -+{ -+ return syscall(__NR_fsmount, fd, flags, attr_flags); -+} -+ -+#endif /* __CR_SYSCALL_H__ */ -\ No newline at end of file -diff --git a/criu/pie/parasite.c b/criu/pie/parasite.c -index e7eb1fcb6..f75fe13bb 100644 ---- a/criu/pie/parasite.c -+++ b/criu/pie/parasite.c -@@ -3,7 +3,6 @@ - #include - #include - #include --#include - #include - #include - #include -@@ -14,6 +13,7 @@ - #include "int.h" - #include "types.h" - #include -+#include "linux/mount.h" - #include "parasite.h" - #include "fcntl.h" - #include "prctl.h" -diff --git a/criu/util.c b/criu/util.c -index 5f69465b4..060ca3bd4 100644 ---- a/criu/util.c -+++ b/criu/util.c -@@ -40,6 +40,7 @@ - #include "mem.h" - #include "namespaces.h" - #include "criu-log.h" -+#include "syscall.h" - - #include "clone-noasan.h" - #include "cr_options.h" -diff --git a/scripts/feature-tests.mak b/scripts/feature-tests.mak -index 014e893a8..fb5d2ef7a 100644 ---- a/scripts/feature-tests.mak -+++ b/scripts/feature-tests.mak -@@ -137,19 +137,6 @@ ENTRY(main) - END(main) - endef - --define FEATURE_TEST_FSCONFIG -- --#include -- --int main(void) --{ -- if (FSCONFIG_CMD_CREATE > 0) -- return 0; -- return 0; --} -- --endef -- - define FEATURE_TEST_NFTABLES_LIB_API_0 - - #include --- -2.19.1.6.gb485710b - diff --git a/0003-mount-add-definition-for-FSOPEN_CLOEXEC.patch b/0003-mount-add-definition-for-FSOPEN_CLOEXEC.patch deleted file mode 100644 index 9dc51604ec3a3375dfc1d838e20ee124cad5c824..0000000000000000000000000000000000000000 --- a/0003-mount-add-definition-for-FSOPEN_CLOEXEC.patch +++ /dev/null @@ -1,106 +0,0 @@ -From 517c0947050e63aac72f63a3bf373d76264723b9 Mon Sep 17 00:00:00 2001 -From: Radostin Stoyanov -Date: Wed, 24 Aug 2022 21:20:30 +0200 -Subject: [PATCH] mount: add definition for FSOPEN_CLOEXEC - -A recent change in glibc introduced `enum fsconfig_command` [1] and as a -result the compilation of criu fails with the following errors - -In file included from criu/pie/util.c:3: -/usr/include/sys/mount.h:240:6: error: redeclaration of 'enum fsconfig_command' - 240 | enum fsconfig_command - | ^~~~~~~~~~~~~~~~ -In file included from /usr/include/sys/mount.h:32: -criu/include/linux/mount.h:11:6: note: originally defined here - 11 | enum fsconfig_command { - | ^~~~~~~~~~~~~~~~ -/usr/include/sys/mount.h:242:3: error: redeclaration of enumerator 'FSCONFIG_SET_FLAG' - 242 | FSCONFIG_SET_FLAG = 0, /* Set parameter, supplying no value */ - | ^~~~~~~~~~~~~~~~~ -criu/include/linux/mount.h:12:9: note: previous definition of 'FSCONFIG_SET_FLAG' with type 'enum fsconfig_command' - 12 | FSCONFIG_SET_FLAG = 0, /* Set parameter, supplying no value */ - | ^~~~~~~~~~~~~~~~~ -/usr/include/sys/mount.h:244:3: error: redeclaration of enumerator 'FSCONFIG_SET_STRING' - 244 | FSCONFIG_SET_STRING = 1, /* Set parameter, supplying a string value */ - | ^~~~~~~~~~~~~~~~~~~ -criu/include/linux/mount.h:14:9: note: previous definition of 'FSCONFIG_SET_STRING' with type 'enum fsconfig_command' - 14 | FSCONFIG_SET_STRING = 1, /* Set parameter, supplying a string value */ - | ^~~~~~~~~~~~~~~~~~~ -/usr/include/sys/mount.h:246:3: error: redeclaration of enumerator 'FSCONFIG_SET_BINARY' - 246 | FSCONFIG_SET_BINARY = 2, /* Set parameter, supplying a binary blob value */ - | ^~~~~~~~~~~~~~~~~~~ -criu/include/linux/mount.h:16:9: note: previous definition of 'FSCONFIG_SET_BINARY' with type 'enum fsconfig_command' - 16 | FSCONFIG_SET_BINARY = 2, /* Set parameter, supplying a binary blob value */ - | ^~~~~~~~~~~~~~~~~~~ -/usr/include/sys/mount.h:248:3: error: redeclaration of enumerator 'FSCONFIG_SET_PATH' - 248 | FSCONFIG_SET_PATH = 3, /* Set parameter, supplying an object by path */ - | ^~~~~~~~~~~~~~~~~ -criu/include/linux/mount.h:18:9: note: previous definition of 'FSCONFIG_SET_PATH' with type 'enum fsconfig_command' - 18 | FSCONFIG_SET_PATH = 3, /* Set parameter, supplying an object by path */ - | ^~~~~~~~~~~~~~~~~ -/usr/include/sys/mount.h:250:3: error: redeclaration of enumerator 'FSCONFIG_SET_PATH_EMPTY' - 250 | FSCONFIG_SET_PATH_EMPTY = 4, /* Set parameter, supplying an object by (empty) path */ - | ^~~~~~~~~~~~~~~~~~~~~~~ -criu/include/linux/mount.h:20:9: note: previous definition of 'FSCONFIG_SET_PATH_EMPTY' with type 'enum fsconfig_command' - 20 | FSCONFIG_SET_PATH_EMPTY = 4, /* Set parameter, supplying an object by (empty) path */ - | ^~~~~~~~~~~~~~~~~~~~~~~ -/usr/include/sys/mount.h:252:3: error: redeclaration of enumerator 'FSCONFIG_SET_FD' - 252 | FSCONFIG_SET_FD = 5, /* Set parameter, supplying an object by fd */ - | ^~~~~~~~~~~~~~~ -criu/include/linux/mount.h:22:9: note: previous definition of 'FSCONFIG_SET_FD' with type 'enum fsconfig_command' - 22 | FSCONFIG_SET_FD = 5, /* Set parameter, supplying an object by fd */ - | ^~~~~~~~~~~~~~~ -/usr/include/sys/mount.h:254:3: error: redeclaration of enumerator 'FSCONFIG_CMD_CREATE' - 254 | FSCONFIG_CMD_CREATE = 6, /* Invoke superblock creation */ - | ^~~~~~~~~~~~~~~~~~~ -criu/include/linux/mount.h:24:9: note: previous definition of 'FSCONFIG_CMD_CREATE' with type 'enum fsconfig_command' - 24 | FSCONFIG_CMD_CREATE = 6, /* Invoke superblock creation */ - | ^~~~~~~~~~~~~~~~~~~ -/usr/include/sys/mount.h:256:3: error: redeclaration of enumerator 'FSCONFIG_CMD_RECONFIGURE' - 256 | FSCONFIG_CMD_RECONFIGURE = 7, /* Invoke superblock reconfiguration */ - | ^~~~~~~~~~~~~~~~~~~~~~~~ -criu/include/linux/mount.h:26:9: note: previous definition of 'FSCONFIG_CMD_RECONFIGURE' with type 'enum fsconfig_command' - 26 | FSCONFIG_CMD_RECONFIGURE = 7, /* Invoke superblock reconfiguration */ - -This patch adds definition for FSOPEN_CLOEXEC to solve this problem. In particular, -sys/mount.h includes ifndef check for FSOPEN_CLOEXEC surrounding `enum fsconfig_command`. - -[1] https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=7eae6a91e9b1670330c9f15730082c91c0b1d570 - -Reported-by: Younes Manton (@ymanton) -Signed-off-by: Radostin Stoyanov ---- - criu/include/linux/mount.h | 10 ++++++++-- - 1 file changed, 8 insertions(+), 2 deletions(-) - -diff --git a/criu/include/linux/mount.h b/criu/include/linux/mount.h -index 0d55a588c..fefafa89e 100644 ---- a/criu/include/linux/mount.h -+++ b/criu/include/linux/mount.h -@@ -6,7 +6,7 @@ - - /* Copied from /usr/include/sys/mount.h */ - --#ifndef FSCONFIG_CMD_CREATE -+#ifndef FSOPEN_CLOEXEC - /* The type of fsconfig call made. */ - enum fsconfig_command { - FSCONFIG_SET_FLAG = 0, /* Set parameter, supplying no value */ -@@ -26,7 +26,13 @@ enum fsconfig_command { - FSCONFIG_CMD_RECONFIGURE = 7, /* Invoke superblock reconfiguration */ - #define FSCONFIG_CMD_RECONFIGURE FSCONFIG_CMD_RECONFIGURE - }; --#endif // FSCONFIG_CMD_CREATE -+ -+#endif // FSOPEN_CLOEXEC -+ -+/* fsopen flags. With the redundant definition, we check if the kernel, -+ * glibc value and our value still match. -+ */ -+#define FSOPEN_CLOEXEC 0x00000001 - - #ifndef MS_MGC_VAL - /* Magic mount flag number. Has to be or-ed to the flag values. */ --- -2.19.1.6.gb485710b - diff --git a/1000-use-pip-install-instead-of-setup.py-install.patch b/1000-use-pip-install-instead-of-setup.py-install.patch deleted file mode 100644 index 3d47d22a866fb5374899a26b36a3542c9e0f05a6..0000000000000000000000000000000000000000 --- a/1000-use-pip-install-instead-of-setup.py-install.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 5ee3b3ac815310c3ea33839c8172d0e373962350 Mon Sep 17 00:00:00 2001 -From: Bo Ren -Date: Wed, 20 Mar 2024 11:33:20 +0800 -Subject: [PATCH] use 'pip install' instead of 'setup.py install' - -Signed-off-by: Bo Ren ---- - lib/Makefile | 2 +- - lib/setup.py | 25 +++++++++++++++++++++++++ - 2 files changed, 26 insertions(+), 1 deletion(-) - create mode 100644 lib/setup.py - -diff --git a/lib/Makefile b/lib/Makefile -index 575a7ba..a16d18c 100644 ---- a/lib/Makefile -+++ b/lib/Makefile -@@ -59,7 +59,7 @@ install: lib-c lib-a lib-py crit/crit lib/c/criu.pc.in - $(Q) sed -e 's,@version@,$(CRIU_VERSION),' -e 's,@libdir@,$(LIBDIR),' -e 's,@includedir@,$(dir $(INCLUDEDIR)/criu/),' lib/c/criu.pc.in > lib/c/criu.pc - $(Q) install -m 644 lib/c/criu.pc $(DESTDIR)$(LIBDIR)/pkgconfig - $(E) " INSTALL " crit -- $(Q) $(PYTHON) scripts/crit-setup.py install --prefix=$(DESTDIR)$(PREFIX) --record $(CRIT_SETUP_FILES) -+ $(Q) $(PYTHON) -m pip install --upgrade --ignore-installed --prefix=$(DESTDIR)$(PREFIX) ./lib - .PHONY: install - - uninstall: -diff --git a/lib/setup.py b/lib/setup.py -new file mode 100644 -index 0000000..e7dc547 ---- /dev/null -+++ b/lib/setup.py -@@ -0,0 +1,25 @@ -+import os -+from distutils.core import setup -+ -+criu_version = "0.0.1" -+env = os.environ -+ -+if 'CRIU_VERSION_MAJOR' in env and 'CRIU_VERSION_MINOR' in env: -+ criu_version = '{}.{}'.format( -+ env['CRIU_VERSION_MAJOR'], -+ env['CRIU_VERSION_MINOR'] -+ ) -+ -+ if 'CRIU_VERSION_SUBLEVEL' in env and env['CRIU_VERSION_SUBLEVEL']: -+ criu_version += '.' + env['CRIU_VERSION_SUBLEVEL'] -+ -+setup(name="crit", -+ version=criu_version, -+ description="CRiu Image Tool", -+ author="CRIU team", -+ author_email="criu@openvz.org", -+ license="GPLv2", -+ url="https://github.com/checkpoint-restore/criu", -+ package_dir={'pycriu': 'py'}, -+ packages=["pycriu", "pycriu.images"], -+ scripts=["../crit/crit"]) --- -2.31.1 - diff --git a/criu-3.17.1.tar.gz b/criu-3.17.1.tar.gz deleted file mode 100644 index 4da1ffc9a1362036ec8b6f327e4e1fd431343017..0000000000000000000000000000000000000000 Binary files a/criu-3.17.1.tar.gz and /dev/null differ diff --git a/criu-3.19.tar.gz b/criu-3.19.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..7a57acba43258880039d01cc956dc0b3ccb6a75f Binary files /dev/null and b/criu-3.19.tar.gz differ diff --git a/criu.pc.patch b/criu.pc.patch new file mode 100644 index 0000000000000000000000000000000000000000..6211f2c797ba80c594464d03a3d3de11e437e0be --- /dev/null +++ b/criu.pc.patch @@ -0,0 +1,27 @@ +From 341ef149ee259d9432ea4c01507eefab2ef8b83c Mon Sep 17 00:00:00 2001 +From: Radostin Stoyanov +Date: Thu, 14 Oct 2021 12:58:56 +0100 +Subject: [PATCH] criu.pc: Add libprotobuf-c as a dependency + +CRIU has a dependency on protobuf-c-devel. We express this dependency +in pkgconfig to be auto-detected when building a package. + +Signed-off-by: Radostin Stoyanov +--- + lib/c/criu.pc.in | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/lib/c/criu.pc.in b/lib/c/criu.pc.in +index 33986d10d..bcced5033 100644 +--- a/lib/c/criu.pc.in ++++ b/lib/c/criu.pc.in +@@ -4,5 +4,6 @@ includedir=@includedir@ + Name: CRIU + Description: RPC library for userspace checkpoint and restore + Version: @version@ ++Requires.private: libprotobuf-c + Libs: -L${libdir} -lcriu + Cflags: -I${includedir} +-- +2.31.1 + diff --git a/criu.spec b/criu.spec index 73d0831d42bc3a1e8fd2f5ebd52ae27838d10769..0ef8dc9a130abc407dbefb19bdf9559baa9aadf7 100644 --- a/criu.spec +++ b/criu.spec @@ -1,4 +1,6 @@ -%define anolis_release 3 +%define anolis_release 1 +%global py_prefix python3 +%global py_binary %{py_prefix} # With annobin enabled, CRIU does not work anymore. It seems CRIU's # parasite code breaks if annobin is enabled. @@ -9,27 +11,28 @@ %undefine _auto_set_build_flags Name: criu -Version: 3.17.1 +Version: 3.19 Release: %{anolis_release}%{?dist} Summary: Tool for Checkpoint/Restore in User-space -License: GPLv2 +License: GPL-2.0-only AND LGPL-2.1-only AND MIT URL: http://criu.org/ Source0: https://github.com/checkpoint-restore/criu/archive/v%{version}/criu-%{version}.tar.gz -Source1: criu-tmpfiles.conf -# backport from upstream to fix build failed with glibc-2.36 -Patch1: 0001-rseq-fix-headers-conflict-on-Mariner-GNU-Linux.patch -Patch2: 0002-criu-fix-conflicting-headers.patch -Patch3: 0003-mount-add-definition-for-FSOPEN_CLOEXEC.patch -Patch4: 1000-use-pip-install-instead-of-setup.py-install.patch +# Add protobuf-c as a dependency. +# We use this patch because the protobuf-c package name +# in RPM and DEB is different. +Patch99: criu.pc.patch + +Source5: criu-tmpfiles.conf BuildRequires: gcc BuildRequires: systemd BuildRequires: libnet-devel -BuildRequires: protobuf-devel protobuf-c-devel python3-devel libnl3-devel libcap-devel -BuildRequires: python3-setuptools -BuildRequires: python3-pip -BuildRequires: python3-wheel +BuildRequires: protobuf-devel protobuf-c-devel %{py_prefix}-devel libnl3-devel libcap-devel +BuildRequires: %{py_prefix}-pip +BuildRequires: %{py_prefix}-setuptools +BuildRequires: %{py_prefix}-wheel +BuildRequires: %{py_prefix}-protobuf BuildRequires: asciidoctor BuildRequires: perl-interpreter BuildRequires: libselinux-devel @@ -38,6 +41,8 @@ BuildRequires: gnutls-devel Recommends: tar BuildRequires: make +ExclusiveArch: x86_64 %{arm} ppc64le aarch64 s390x loongarch64 + %description criu is the user-space part of Checkpoint/Restore in User-space (CRIU), a project to implement checkpoint/restore functionality for @@ -46,6 +51,7 @@ Linux in user-space. %package devel Summary: Header files and libraries for %{name} Requires: %{name} = %{version}-%{release} +Requires: %{name}-libs = %{version}-%{release} %description devel This package contains header files and libraries for %{name}. @@ -57,18 +63,17 @@ Requires: %{name} = %{version}-%{release} %description libs This package contains the libraries for %{name} -%package -n python3-%{name} -%{?python_provide:%python_provide python3-%{name}} +%package -n %{py_prefix}-%{name} +%{?python_provide:%python_provide %{py_prefix}-%{name}} Summary: Python bindings for %{name} -Requires: python3-protobuf -Obsoletes: python2-criu < 3.10-1 +Requires: %{py_prefix}-protobuf -%description -n python3-%{name} -python3-%{name} contains Python bindings for %{name}. +%description -n %{py_prefix}-%{name} +%{py_prefix}-%{name} contains Python bindings for %{name}. %package -n crit Summary: CRIU image tool -Requires: python3-%{name} = %{version}-%{release} +Requires: %{py_prefix}-%{name} = %{version}-%{release} %description -n crit crit is a tool designed to decode CRIU binary dump files and show @@ -92,27 +97,33 @@ BuildArch: noarch Doc files for CRIU %prep -%autosetup -p1 +%setup -q +%patch -P 99 -p1 %build # This package calls LD directly without specifying the LTO plugins. Until # that is fixed, disable LTO. %define _lto_cflags %{nil} -CFLAGS+=`echo %{optflags} | sed -e 's,-fstack-protector\S*,,g'` make V=1 WERROR=0 PREFIX=%{_prefix} RUNDIR=/run/criu PYTHON=python3 +# %{?_smp_mflags} does not work +# -fstack-protector breaks build +CFLAGS+=`echo %{optflags} | sed -e 's,-fstack-protector\S*,,g'` make V=1 WERROR=0 PREFIX=%{_prefix} RUNDIR=/run/criu PYTHON=%{py_binary} make docs V=1 + %install +sed -e "s,--upgrade --ignore-installed,--no-index --no-deps -v --no-build-isolation,g" -i lib/Makefile -i crit/Makefile make install-criu DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} -make install-lib DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} PYTHON=python3 +make install-lib DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} PYTHON=%{py_binary} +make install-crit DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} PYTHON=%{py_binary} make install-man DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} +rm -f $RPM_BUILD_ROOT%{_mandir}/man1/compel.1 +rm -f $RPM_BUILD_ROOT%{_mandir}/man1/criu-amdgpu-plugin.1 mkdir -p %{buildroot}%{_tmpfilesdir} -install -m 0644 %{SOURCE1} %{buildroot}%{_tmpfilesdir}/%{name}.conf +install -m 0644 %{SOURCE5} %{buildroot}%{_tmpfilesdir}/%{name}.conf install -d -m 0755 %{buildroot}/run/%{name}/ -rm -f $RPM_BUILD_ROOT%{_mandir}/man1/amdgpu_plugin.1 - # remove static lib rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a @@ -122,11 +133,10 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %{_sbindir}/%{name} %{abidir}/%{name}-option.list %doc %{_mandir}/man8/criu.8* -%doc %{_mandir}/man1/compel.1* %{_libexecdir}/%{name} %dir /run/%{name} %{_tmpfilesdir}/%{name}.conf -%doc COPYING +%doc README.md COPYING %files devel %{_includedir}/criu @@ -138,12 +148,13 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %{_libdir}/*.so.* %{abidir}/lib%{name}.dump -%files -n python3-%{name} -%{python3_sitelib}/pycriu/* -%{python3_sitelib}/*dist-info +%files -n %{py_prefix}-%{name} +%{python3_sitelib}/pycriu* %files -n crit %{_bindir}/crit +%{python3_sitelib}/crit-%{version}.dist-info/ +%{python3_sitelib}/crit %doc %{_mandir}/man1/crit.1* %files -n criu-ns @@ -154,6 +165,11 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libcriu.a %doc README.md INSTALL.md CONTRIBUTING.md MAINTAINERS_GUIDE.md %changelog +* Fri Feb 28 2025 Zhao Hang - 3.19-6 +- Refer to CentOS Stream criu-3.19-6 (tdawson@redhat.com) +- add abi files (yuanhui@linux.alibaba.com) +- Add loongarch64 arch + * Mon Mar 11 2024 Bo Ren - 3.17.1-3 - Rebuild with python3.11 - use pip install instead of setup.py install