From 9b493afb481294c6060aa6da5df28b5e2f0a8618 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Aug 06 2019 11:05:42 +0000 Subject: import criu-3.12-2.el7 --- diff --git a/.criu.metadata b/.criu.metadata index acf36e1..f33f9a7 100644 --- a/.criu.metadata +++ b/.criu.metadata @@ -1 +1 @@ -4391d17f23893b276b9f59bc912663a4e4d8a33d SOURCES/criu-3.9.tar.bz2 +b2ceaf9705aa8239915010136a59664d31044fe3 SOURCES/criu-3.12.tar.bz2 diff --git a/.gitignore b/.gitignore index 0ddcc0f..d9f1e8d 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -SOURCES/criu-3.9.tar.bz2 +SOURCES/criu-3.12.tar.bz2 diff --git a/SOURCES/0001-criu-Remove-PAGE_IMAGE_SIZE.patch b/SOURCES/0001-criu-Remove-PAGE_IMAGE_SIZE.patch deleted file mode 100644 index 8680470..0000000 --- a/SOURCES/0001-criu-Remove-PAGE_IMAGE_SIZE.patch +++ /dev/null @@ -1,46 +0,0 @@ -From 2ea16be20271dae61156a157b9fabd542b328387 Mon Sep 17 00:00:00 2001 -From: Dmitry Safonov -Date: Thu, 10 May 2018 19:14:41 +0100 -Subject: [PATCH 1/8] criu: Remove PAGE_IMAGE_SIZE - -It's unused since commit fd3f33f5d23a ("headers: image.h -- Drop unused -entries"), so let's remove it completely. - -Signed-off-by: Dmitry Safonov -Signed-off-by: Andrei Vagin ---- - criu/crtools.c | 1 - - criu/include/image.h | 5 ----- - 2 files changed, 6 deletions(-) - -diff --git a/criu/crtools.c b/criu/crtools.c -index 5cf53d8a0..4ff7a9f24 100644 ---- a/criu/crtools.c -+++ b/criu/crtools.c -@@ -356,7 +356,6 @@ int main(int argc, char *argv[], char *envp[]) - - #undef BOOL_OPT - -- BUILD_BUG_ON(PAGE_SIZE != PAGE_IMAGE_SIZE); - BUILD_BUG_ON(CTL_32 != SYSCTL_TYPE__CTL_32); - BUILD_BUG_ON(__CTL_STR != SYSCTL_TYPE__CTL_STR); - /* We use it for fd overlap handling in clone_service_fd() */ -diff --git a/criu/include/image.h b/criu/include/image.h -index d9c4bdbc8..d576f5a13 100644 ---- a/criu/include/image.h -+++ b/criu/include/image.h -@@ -12,11 +12,6 @@ - #include "log.h" - #include "common/bug.h" - --#ifdef _ARCH_PPC64 --#define PAGE_IMAGE_SIZE 65536 --#else --#define PAGE_IMAGE_SIZE 4096 --#endif /* _ARCH_PPC64 */ - #define PAGE_RSS 1 - #define PAGE_ANON 2 - --- -2.17.0 - diff --git a/SOURCES/0002-parasite-Rename-misnamed-nr_pages.patch b/SOURCES/0002-parasite-Rename-misnamed-nr_pages.patch deleted file mode 100644 index 3f81b16..0000000 --- a/SOURCES/0002-parasite-Rename-misnamed-nr_pages.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 454fe3e7c07ba48a7a065135482196b53e376de0 Mon Sep 17 00:00:00 2001 -From: Dmitry Safonov -Date: Thu, 10 May 2018 19:14:42 +0100 -Subject: [PATCH 2/8] parasite: Rename misnamed nr_pages - -It's actually number of bytes spliced, not pages. -And I bet (unsigned long) suits the purpose more than (int). - -Signed-off-by: Dmitry Safonov -Signed-off-by: Andrei Vagin ---- - criu/pie/parasite.c | 10 +++++----- - 1 file changed, 5 insertions(+), 5 deletions(-) - -diff --git a/criu/pie/parasite.c b/criu/pie/parasite.c -index 7a48f324e..b9dae3f94 100644 ---- a/criu/pie/parasite.c -+++ b/criu/pie/parasite.c -@@ -67,7 +67,8 @@ static int dump_pages(struct parasite_dump_pages_args *args) - { - int p, ret, tsock; - struct iovec *iovs; -- int off, nr_segs, nr_pages; -+ int off, nr_segs; -+ unsigned long spliced_bytes = 0; - - tsock = parasite_get_rpc_sock(); - p = recv_fd(tsock); -@@ -75,7 +76,6 @@ static int dump_pages(struct parasite_dump_pages_args *args) - return -1; - - iovs = pargs_iovs(args); -- nr_pages = 0; - off = 0; - nr_segs = args->nr_segs; - if (nr_segs > UIO_MAXIOV) -@@ -89,16 +89,16 @@ static int dump_pages(struct parasite_dump_pages_args *args) - ret, nr_segs, args->off + off); - return -1; - } -- nr_pages += ret; -+ spliced_bytes += ret; - off += nr_segs; - if (off == args->nr_segs) - break; - if (off + nr_segs > args->nr_segs) - nr_segs = args->nr_segs - off; - } -- if (nr_pages != args->nr_pages * PAGE_SIZE) { -+ if (spliced_bytes != args->nr_pages * PAGE_SIZE) { - sys_close(p); -- pr_err("Can't splice all pages to pipe (%d/%d)\n", nr_pages, args->nr_pages); -+ pr_err("Can't splice all pages to pipe (%lu/%d)\n", spliced_bytes, args->nr_pages); - return -1; - } - --- -2.17.0 - diff --git a/SOURCES/0003-aio-Allow-expressions-in-NR_IOEVENTS_IN_PAGES-macro.patch b/SOURCES/0003-aio-Allow-expressions-in-NR_IOEVENTS_IN_PAGES-macro.patch deleted file mode 100644 index 153107d..0000000 --- a/SOURCES/0003-aio-Allow-expressions-in-NR_IOEVENTS_IN_PAGES-macro.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 37c5b64e0e6966afe66d62ad9c700d27f3065e4e Mon Sep 17 00:00:00 2001 -From: Dmitry Safonov -Date: Thu, 10 May 2018 19:14:43 +0100 -Subject: [PATCH 3/8] aio: Allow expressions in NR_IOEVENTS_IN_PAGES macro - -The macro is used only in aio_estimate_nr_reqs(): -unsigned int k_max_reqs = NR_IOEVENTS_IN_NPAGES(size/PAGE_SIZE); - -Which compiler may evaluate as (((PAGE_SIZE*size)/PAGE_SIZE) - ...) -It works as long as PAGE_SIZE is long. -The patches set converts PAGE_SIZE to use sysconf() returning -(unsigned), non-long type and making the aio macro overflowing. - -I do not see any value making PAGE_SIZE (unsigned long) typed. - -Cc: Kirill Tkhai -Signed-off-by: Dmitry Safonov -Signed-off-by: Andrei Vagin ---- - criu/aio.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/criu/aio.c b/criu/aio.c -index 27c251df5..45651f2d3 100644 ---- a/criu/aio.c -+++ b/criu/aio.c -@@ -13,7 +13,7 @@ - #include "images/mm.pb-c.h" - #include - --#define NR_IOEVENTS_IN_NPAGES(npages) ((PAGE_SIZE * npages - sizeof(struct aio_ring)) / sizeof(struct io_event)) -+#define NR_IOEVENTS_IN_NPAGES(npages) ((PAGE_SIZE * (npages) - sizeof(struct aio_ring)) / sizeof(struct io_event)) - - int dump_aio_ring(MmEntry *mme, struct vma_area *vma) - { --- -2.17.0 - diff --git a/SOURCES/0004-compel-criu-Add-ARCH_HAS_LONG_PAGES-to-PIE-binaries.patch b/SOURCES/0004-compel-criu-Add-ARCH_HAS_LONG_PAGES-to-PIE-binaries.patch deleted file mode 100644 index 3d9c8ed..0000000 --- a/SOURCES/0004-compel-criu-Add-ARCH_HAS_LONG_PAGES-to-PIE-binaries.patch +++ /dev/null @@ -1,215 +0,0 @@ -From 0f98ee4641458301a3bbe49c88df381edaea93dc Mon Sep 17 00:00:00 2001 -From: Dmitry Safonov -Date: Thu, 10 May 2018 19:14:44 +0100 -Subject: [PATCH 4/8] compel/criu: Add ARCH_HAS_LONG_PAGES to PIE binaries - -For architectures like aarch64/ppc64 it's needed to propagate the size -of page inside PIEs. For the parasite page size will be defined during -seizing, and for restorer during early initialization. -Afterward we can use PAGE_SIZE in PIEs like we did before. - -Signed-off-by: Dmitry Safonov -Signed-off-by: Andrei Vagin ---- - compel/include/rpc-pie-priv.h | 3 +++ - compel/plugins/std/infect.c | 17 +++++++++++++++++ - compel/src/lib/infect.c | 3 +++ - criu/cr-restore.c | 3 +++ - criu/include/restorer.h | 3 +++ - criu/pie/restorer.c | 16 ++++++++++++++++ - include/common/arch/aarch64/asm/page.h | 9 +++++++++ - include/common/arch/ppc64/asm/page.h | 9 +++++++++ - 8 files changed, 63 insertions(+) - -diff --git a/compel/include/rpc-pie-priv.h b/compel/include/rpc-pie-priv.h -index f25ca89eb..15f5b14ca 100644 ---- a/compel/include/rpc-pie-priv.h -+++ b/compel/include/rpc-pie-priv.h -@@ -38,6 +38,9 @@ struct parasite_init_args { - uint64_t sigreturn_addr; - uint64_t sigframe; /* pointer to sigframe */ - futex_t daemon_connected; -+#ifdef ARCH_HAS_LONG_PAGES -+ uint32_t page_size; -+#endif - }; - - struct parasite_unmap_args { -diff --git a/compel/plugins/std/infect.c b/compel/plugins/std/infect.c -index 2d3aa3df8..d5e1b4354 100644 ---- a/compel/plugins/std/infect.c -+++ b/compel/plugins/std/infect.c -@@ -3,6 +3,7 @@ - #include "common/scm.h" - #include "common/compiler.h" - #include "common/lock.h" -+#include "common/page.h" - - #define pr_err(fmt, ...) print_on_level(1, fmt, ##__VA_ARGS__) - #define pr_info(fmt, ...) print_on_level(3, fmt, ##__VA_ARGS__) -@@ -19,6 +20,19 @@ static int tsock = -1; - - static struct rt_sigframe *sigframe; - -+#ifdef ARCH_HAS_LONG_PAGES -+/* -+ * XXX: Make it compel's std plugin global variable. Drop parasite_size(). -+ * Hint: compel on aarch64 shall learn relocs for that. -+ */ -+static unsigned __page_size; -+ -+unsigned __attribute((weak)) page_size(void) -+{ -+ return __page_size; -+} -+#endif -+ - int parasite_get_rpc_sock(void) - { - return tsock; -@@ -142,6 +156,9 @@ static noinline __used int parasite_init_daemon(void *data) - - args->sigreturn_addr = (uint64_t)(uintptr_t)fini_sigreturn; - sigframe = (void*)(uintptr_t)args->sigframe; -+#ifdef ARCH_HAS_LONG_PAGES -+ __page_size = args->page_size; -+#endif - - ret = tsock = sys_socket(PF_UNIX, SOCK_SEQPACKET, 0); - if (tsock < 0) { -diff --git a/compel/src/lib/infect.c b/compel/src/lib/infect.c -index ecc6599b1..d51b8aa88 100644 ---- a/compel/src/lib/infect.c -+++ b/compel/src/lib/infect.c -@@ -613,6 +613,9 @@ static int parasite_init_daemon(struct parasite_ctl *ctl) - - args->sigframe = (uintptr_t)ctl->rsigframe; - args->log_level = compel_log_get_loglevel(); -+#ifdef ARCH_HAS_LONG_PAGES -+ args->page_size = PAGE_SIZE; -+#endif - - futex_set(&args->daemon_connected, 0); - -diff --git a/criu/cr-restore.c b/criu/cr-restore.c -index 54216b8ea..8a436cc98 100644 ---- a/criu/cr-restore.c -+++ b/criu/cr-restore.c -@@ -3650,6 +3650,9 @@ static int sigreturn_restore(pid_t pid, struct task_restore_args *task_args, uns - task_args->premmapped_len = rsti(current)->premmapped_len; - - task_args->task_size = kdat.task_size; -+#ifdef ARCH_HAS_LONG_PAGES -+ task_args->page_size = PAGE_SIZE; -+#endif - - RST_MEM_FIXUP_PPTR(task_args->vmas); - RST_MEM_FIXUP_PPTR(task_args->rings); -diff --git a/criu/include/restorer.h b/criu/include/restorer.h -index 15307d9c0..70223be55 100644 ---- a/criu/include/restorer.h -+++ b/criu/include/restorer.h -@@ -209,6 +209,9 @@ struct task_restore_args { - void **breakpoint; - - enum faults fault_strategy; -+#ifdef ARCH_HAS_LONG_PAGES -+ unsigned page_size; -+#endif - } __aligned(64); - - /* -diff --git a/criu/pie/restorer.c b/criu/pie/restorer.c -index 69f8504e3..da20f3298 100644 ---- a/criu/pie/restorer.c -+++ b/criu/pie/restorer.c -@@ -36,6 +36,7 @@ - #include "uffd.h" - - #include "common/lock.h" -+#include "common/page.h" - #include "restorer.h" - #include "aio.h" - #include "seccomp.h" -@@ -76,6 +77,18 @@ bool fault_injected(enum faults f) - return __fault_injected(f, fi_strategy); - } - -+#ifdef ARCH_HAS_LONG_PAGES -+/* -+ * XXX: Make it compel's std plugin global variable. Drop parasite_size(). -+ * Hint: compel on aarch64 shall learn relocs for that. -+ */ -+static unsigned __page_size; -+unsigned page_size(void) -+{ -+ return __page_size; -+} -+#endif -+ - /* - * These are stubs for std compel plugin. - */ -@@ -1230,6 +1243,9 @@ long __export_restore_task(struct task_restore_args *args) - zombies = args->zombies; - n_zombies = args->zombies_n; - *args->breakpoint = rst_sigreturn; -+#ifdef ARCH_HAS_LONG_PAGES -+ __page_size = args->page_size; -+#endif - - ksigfillset(&act.rt_sa_mask); - act.rt_sa_handler = sigchld_handler; -diff --git a/include/common/arch/aarch64/asm/page.h b/include/common/arch/aarch64/asm/page.h -index de1fe5428..4126c8474 100644 ---- a/include/common/arch/aarch64/asm/page.h -+++ b/include/common/arch/aarch64/asm/page.h -@@ -1,6 +1,9 @@ - #ifndef __CR_ASM_PAGE_H__ - #define __CR_ASM_PAGE_H__ - -+#define ARCH_HAS_LONG_PAGES -+ -+#ifndef CR_NOGLIBC - #include - - #ifndef PAGE_SHIFT -@@ -18,4 +21,10 @@ - #define PAGE_PFN(addr) ((addr) / PAGE_SIZE) - #define page_size() sysconf(_SC_PAGESIZE) - -+#else /* CR_NOGLIBC */ -+ -+extern unsigned page_size(void); -+#define PAGE_SIZE page_size() -+ -+#endif /* CR_NOGLIBC */ - #endif /* __CR_ASM_PAGE_H__ */ -diff --git a/include/common/arch/ppc64/asm/page.h b/include/common/arch/ppc64/asm/page.h -index 9d10455f1..a95af55ef 100644 ---- a/include/common/arch/ppc64/asm/page.h -+++ b/include/common/arch/ppc64/asm/page.h -@@ -1,6 +1,9 @@ - #ifndef __CR_ASM_PAGE_H__ - #define __CR_ASM_PAGE_H__ - -+#define ARCH_HAS_LONG_PAGES -+ -+#ifndef CR_NOGLIBC - #include - - /* -@@ -22,4 +25,10 @@ - #define PAGE_PFN(addr) ((addr) / PAGE_SIZE) - #define page_size() sysconf(_SC_PAGESIZE) - -+#else /* CR_NOGLIBC */ -+ -+extern unsigned page_size(void); -+#define PAGE_SIZE page_size() -+ -+#endif /* CR_NOGLIBC */ - #endif /* __CR_ASM_PAGE_H__ */ --- -2.17.0 - diff --git a/SOURCES/0005-criu-dump-Fix-size-of-personality-buffer.patch b/SOURCES/0005-criu-dump-Fix-size-of-personality-buffer.patch deleted file mode 100644 index 133b57f..0000000 --- a/SOURCES/0005-criu-dump-Fix-size-of-personality-buffer.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 14c0abb1da33176f47939eee04846e8cf3e6992f Mon Sep 17 00:00:00 2001 -From: Dmitry Safonov -Date: Thu, 10 May 2018 19:14:45 +0100 -Subject: [PATCH 5/8] criu/dump: Fix size of personality buffer - -Personality value is printed in kernel like this: -static int proc_pid_personality(/* .. */) -{ - int err = lock_trace(task); - if (!err) { - seq_printf(m, "%08x\n", task->personality); - unlock_trace(task); - } - return err; -} - -So, we don't need a whole page to read the value. - -Signed-off-by: Dmitry Safonov -Signed-off-by: Andrei Vagin ---- - criu/cr-dump.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/criu/cr-dump.c b/criu/cr-dump.c -index b48a38b8b..208bd5060 100644 ---- a/criu/cr-dump.c -+++ b/criu/cr-dump.c -@@ -98,7 +98,8 @@ int __attribute__((weak)) arch_set_thread_regs(struct pstree_item *item, - return 0; - } - --static char loc_buf[PAGE_SIZE]; -+#define PERSONALITY_LENGTH 9 -+static char loc_buf[PERSONALITY_LENGTH]; - - void free_mappings(struct vm_area_list *vma_area_list) - { --- -2.17.0 - diff --git a/SOURCES/0006-criu-log-Define-log-buffer-length-without-PAGE_SIZE.patch b/SOURCES/0006-criu-log-Define-log-buffer-length-without-PAGE_SIZE.patch deleted file mode 100644 index 8702306..0000000 --- a/SOURCES/0006-criu-log-Define-log-buffer-length-without-PAGE_SIZE.patch +++ /dev/null @@ -1,34 +0,0 @@ -From f8064a7413a0a66ebe7afc8c19e2678b62177b9d Mon Sep 17 00:00:00 2001 -From: Dmitry Safonov -Date: Thu, 10 May 2018 19:14:46 +0100 -Subject: [PATCH 6/8] criu/log: Define log buffer length without PAGE_SIZE - -The same value, but as PAGE_SIZE can be different for the same -platform - it's no more static value. - -Signed-off-by: Dmitry Safonov -Signed-off-by: Andrei Vagin ---- - criu/log.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/criu/log.c b/criu/log.c -index 6a13266eb..43dcd106f 100644 ---- a/criu/log.c -+++ b/criu/log.c -@@ -30,10 +30,11 @@ - #define DEFAULT_LOGFD STDERR_FILENO - /* Enable timestamps if verbosity is increased from default */ - #define LOG_TIMESTAMP (DEFAULT_LOGLEVEL + 1) -+#define LOG_BUF_LEN (8*1024) - - static unsigned int current_loglevel = DEFAULT_LOGLEVEL; - --static char buffer[PAGE_SIZE * 2]; -+static char buffer[LOG_BUF_LEN]; - static char buf_off = 0; - - static struct timeval start; --- -2.17.0 - diff --git a/SOURCES/0007-criu-proc-Define-BUF_SIZE-without-PAGE_SIZE-dependen.patch b/SOURCES/0007-criu-proc-Define-BUF_SIZE-without-PAGE_SIZE-dependen.patch deleted file mode 100644 index 6187639..0000000 --- a/SOURCES/0007-criu-proc-Define-BUF_SIZE-without-PAGE_SIZE-dependen.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 9457b3169d9c09b4255322c588c59df402fe3196 Mon Sep 17 00:00:00 2001 -From: Dmitry Safonov -Date: Thu, 10 May 2018 19:14:47 +0100 -Subject: [PATCH 7/8] criu/proc: Define BUF_SIZE without PAGE_SIZE dependency - -PAGE_SIZE will be a variable value on platforms where it can be -different due to large pages. -And looks like (c) there is no reason for BUF_SIZE == PAGE_SIZE, -so let's keep it as it was, rather than complicating it with dynamic -allocation for the buffer. - -Signed-off-by: Dmitry Safonov -Signed-off-by: Andrei Vagin ---- - criu/proc_parse.c | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/criu/proc_parse.c b/criu/proc_parse.c -index 27719416a..edc56bb99 100644 ---- a/criu/proc_parse.c -+++ b/criu/proc_parse.c -@@ -61,16 +61,16 @@ - #define SIGEV_THREAD_ID 4 /* deliver to thread */ - #endif - -+#define BUF_SIZE 4096 /* Good enough value - can be changed */ -+ - struct buffer { -- char buf[PAGE_SIZE]; -+ char buf[BUF_SIZE]; - char end; /* '\0' */ - }; - - static struct buffer __buf; - static char *buf = __buf.buf; - --#define BUF_SIZE sizeof(__buf.buf) -- - /* - * This is how AIO ring buffers look like in proc - */ --- -2.17.0 - diff --git a/SOURCES/0008-ppc64-aarch64-Dynamically-define-PAGE_SIZE.patch b/SOURCES/0008-ppc64-aarch64-Dynamically-define-PAGE_SIZE.patch deleted file mode 100644 index 84420c3..0000000 --- a/SOURCES/0008-ppc64-aarch64-Dynamically-define-PAGE_SIZE.patch +++ /dev/null @@ -1,184 +0,0 @@ -From c37583942c14d3574efbb42e39798bd21e65cfc3 Mon Sep 17 00:00:00 2001 -From: Dmitry Safonov -Date: Thu, 10 May 2018 19:14:48 +0100 -Subject: [PATCH 8/8] ppc64/aarch64: Dynamically define PAGE_SIZE - -On ppc64/aarch64 Linux can be set to use Large pages, so the PAGE_SIZE -isn't build-time constant anymore. Define it through _SC_PAGESIZE. - -There are different sizes for a page on ppc64: -: #if defined(CONFIG_PPC_256K_PAGES) -: #define PAGE_SHIFT 18 -: #elif defined(CONFIG_PPC_64K_PAGES) -: #define PAGE_SHIFT 16 -: #elif defined(CONFIG_PPC_16K_PAGES) -: #define PAGE_SHIFT 14 -: #else -: #define PAGE_SHIFT 12 -: #endif - -And on aarch64 there are default sizes and possibly someone can set his -own PAGE_SHIFT: -: config ARM64_PAGE_SHIFT -: int -: default 16 if ARM64_64K_PAGES -: default 14 if ARM64_16K_PAGES -: default 12 - -On the downside - each time we need PAGE_SIZE, we're doing libc -function call on aarch64/ppc64. - -Fixes: #415 - -Tested-by: Adrian Reber -Signed-off-by: Dmitry Safonov -Signed-off-by: Andrei Vagin ---- - criu/arch/aarch64/crtools.c | 3 ++ - criu/arch/ppc64/crtools.c | 3 ++ - include/common/arch/aarch64/asm/page.h | 42 +++++++++++++++++--------- - include/common/arch/ppc64/asm/page.h | 40 +++++++++++++++--------- - 4 files changed, 59 insertions(+), 29 deletions(-) - -diff --git a/criu/arch/aarch64/crtools.c b/criu/arch/aarch64/crtools.c -index f98743a23..b2ef1c312 100644 ---- a/criu/arch/aarch64/crtools.c -+++ b/criu/arch/aarch64/crtools.c -@@ -21,6 +21,9 @@ - #include "restorer.h" - #include - -+unsigned __page_size = 0; -+unsigned __page_shift = 0; -+ - #define assign_reg(dst, src, e) dst->e = (__typeof__(dst->e))(src)->e - - int save_task_regs(void *x, user_regs_struct_t *regs, user_fpregs_struct_t *fpsimd) -diff --git a/criu/arch/ppc64/crtools.c b/criu/arch/ppc64/crtools.c -index 5a5966ad4..077c243b2 100644 ---- a/criu/arch/ppc64/crtools.c -+++ b/criu/arch/ppc64/crtools.c -@@ -23,6 +23,9 @@ - #include "images/core.pb-c.h" - #include "images/creds.pb-c.h" - -+unsigned __page_size = 0; -+unsigned __page_shift = 0; -+ - static UserPpc64FpstateEntry *copy_fp_regs(uint64_t *fpregs) - { - UserPpc64FpstateEntry *fpe; -diff --git a/include/common/arch/aarch64/asm/page.h b/include/common/arch/aarch64/asm/page.h -index 4126c8474..bd8fe8f71 100644 ---- a/include/common/arch/aarch64/asm/page.h -+++ b/include/common/arch/aarch64/asm/page.h -@@ -4,22 +4,36 @@ - #define ARCH_HAS_LONG_PAGES - - #ifndef CR_NOGLIBC --#include -- --#ifndef PAGE_SHIFT --# define PAGE_SHIFT 12 --#endif -- --#ifndef PAGE_SIZE --# define PAGE_SIZE (1UL << PAGE_SHIFT) --#endif -- --#ifndef PAGE_MASK --# define PAGE_MASK (~(PAGE_SIZE - 1)) --#endif -+#include /* ffsl() */ -+#include /* _SC_PAGESIZE */ -+ -+extern unsigned __page_size; -+extern unsigned __page_shift; -+ -+static inline unsigned page_size(void) -+{ -+ if (!__page_size) -+ __page_size = sysconf(_SC_PAGESIZE); -+ return __page_size; -+} -+ -+static inline unsigned page_shift(void) -+{ -+ if (!__page_shift) -+ __page_shift = (ffsl(page_size()) - 1); -+ return __page_shift; -+} -+ -+/* -+ * Don't add ifdefs for PAGE_SIZE: if any header defines it as a constant -+ * on aarch64, then we need refrain using PAGE_SIZE in criu and use -+ * page_size() across sources (as it may differ on aarch64). -+ */ -+#define PAGE_SIZE page_size() -+#define PAGE_MASK (~(PAGE_SIZE - 1)) -+#define PAGE_SHIFT page_shift() - - #define PAGE_PFN(addr) ((addr) / PAGE_SIZE) --#define page_size() sysconf(_SC_PAGESIZE) - - #else /* CR_NOGLIBC */ - -diff --git a/include/common/arch/ppc64/asm/page.h b/include/common/arch/ppc64/asm/page.h -index a95af55ef..5107cb8e0 100644 ---- a/include/common/arch/ppc64/asm/page.h -+++ b/include/common/arch/ppc64/asm/page.h -@@ -4,26 +4,36 @@ - #define ARCH_HAS_LONG_PAGES - - #ifndef CR_NOGLIBC --#include -+#include /* ffsl() */ -+#include /* _SC_PAGESIZE */ -+ -+extern unsigned __page_size; -+extern unsigned __page_shift; -+ -+static inline unsigned page_size(void) -+{ -+ if (!__page_size) -+ __page_size = sysconf(_SC_PAGESIZE); -+ return __page_size; -+} -+ -+static inline unsigned page_shift(void) -+{ -+ if (!__page_shift) -+ __page_shift = (ffsl(page_size()) - 1); -+ return __page_shift; -+} - - /* -- * Default config for Pseries is to use 64K pages. -- * See kernel file arch/powerpc/configs/pseries_*defconfig -+ * Don't add ifdefs for PAGE_SIZE: if any header defines it as a constant -+ * on ppc64, then we need refrain using PAGE_SIZE in criu and use -+ * page_size() across sources (as it may differ on ppc64). - */ --#ifndef PAGE_SHIFT --# define PAGE_SHIFT 16 --#endif -- --#ifndef PAGE_SIZE --# define PAGE_SIZE (1UL << PAGE_SHIFT) --#endif -- --#ifndef PAGE_MASK --# define PAGE_MASK (~(PAGE_SIZE - 1)) --#endif -+#define PAGE_SIZE page_size() -+#define PAGE_MASK (~(PAGE_SIZE - 1)) -+#define PAGE_SHIFT page_shift() - - #define PAGE_PFN(addr) ((addr) / PAGE_SIZE) --#define page_size() sysconf(_SC_PAGESIZE) - - #else /* CR_NOGLIBC */ - --- -2.17.0 - diff --git a/SOURCES/27034e7c64b00a1f2467afb5ebb1d5b9b1a06ce1.patch b/SOURCES/27034e7c64b00a1f2467afb5ebb1d5b9b1a06ce1.patch deleted file mode 100644 index 269236a..0000000 --- a/SOURCES/27034e7c64b00a1f2467afb5ebb1d5b9b1a06ce1.patch +++ /dev/null @@ -1,83 +0,0 @@ -From 27034e7c64b00a1f2467afb5ebb1d5b9b1a06ce1 Mon Sep 17 00:00:00 2001 -From: Pavel Tikhomirov -Date: Wed, 11 Jul 2018 13:43:33 +0300 -Subject: [PATCH] mount: fix regression where open_mountpoint failed on - readonly fs - -If we fail to create temporary directory for doing a clean mount we can -make mount clean reusing the code which enters new mountns to umount -overmounts. As when last process exits mntns all mounts are implicitly -cleaned from children, see in kernel source - sys_exit->do_exit -->exit_task_namespaces->switch_task_namespaces->free_nsproxy -->put_mnt_ns->umount_tree->drop_collected_mounts->umount_tree: - - /* Hide the mounts from mnt_mounts */ - list_for_each_entry(p, &tmp_list, mnt_list) { - list_del_init(&p->mnt_child); - } - -Fixes commit b6cfb1ce2948 ("mount: make open_mountpoint handle overmouts -properly") - -https://github.com/checkpoint-restore/criu/issues/520 -Signed-off-by: Pavel Tikhomirov -Acked-by: Adrian Reber -Signed-off-by: Andrei Vagin ---- - criu/mount.c | 28 ++++++++++++++++++++-------- - 1 file changed, 20 insertions(+), 8 deletions(-) - -diff --git a/criu/mount.c b/criu/mount.c -index b56164e953..9cc8f6e940 100644 ---- a/criu/mount.c -+++ b/criu/mount.c -@@ -1325,10 +1325,18 @@ int ns_open_mountpoint(void *arg) - if (umount_overmounts(mi)) - goto err; - -- /* Save fd which we opened for parent due to CLONE_FILES flag */ -- *fd = get_clean_fd(mi); -- if (*fd < 0) -+ /* -+ * Save fd which we opened for parent due to CLONE_FILES flag -+ * -+ * Mount can still have children in it, but we don't need to clean it -+ * explicitly as when last process exits mntns all mounts in it are -+ * cleaned from their children, and we are exactly the last process. -+ */ -+ *fd = open(mi->mountpoint, O_DIRECTORY|O_RDONLY); -+ if (*fd < 0) { -+ pr_perror("Unable to open %s", mi->mountpoint); - goto err; -+ } - - return 0; - err: -@@ -1367,18 +1375,22 @@ int open_mountpoint(struct mount_info *pm) - - if (!mnt_is_overmounted(pm)) { - pr_info("\tmount has children %s\n", pm->mountpoint); -- - fd = get_clean_fd(pm); -- if (fd < 0) -- goto err; -- } else { -+ } -+ -+ /* -+ * Mount is overmounted or probably we can't create a temporary -+ * direcotry for a cleaned mount -+ */ -+ if (fd < 0) { - int pid, status; - struct clone_arg ca = { - .mi = pm, - .fd = &fd - }; - -- pr_info("\tmount is overmounted %s\n", pm->mountpoint); -+ pr_info("\tmount is overmounted or has children %s\n", -+ pm->mountpoint); - - /* - * We are overmounted - not accessible in a regular way. We diff --git a/SOURCES/80a4d3cf8cf227c1d0aa45153a6324b16ae5a647.patch b/SOURCES/80a4d3cf8cf227c1d0aa45153a6324b16ae5a647.patch deleted file mode 100644 index 630c4c7..0000000 --- a/SOURCES/80a4d3cf8cf227c1d0aa45153a6324b16ae5a647.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 80a4d3cf8cf227c1d0aa45153a6324b16ae5a647 Mon Sep 17 00:00:00 2001 -From: Andrei Vagin -Date: Sun, 17 Jun 2018 06:44:42 +0300 -Subject: [PATCH] bitops: use the UL literal for constants - -We operate by long variables in out bit arithmetics, so our constants -should be marked as long too. - -Cc: Adrian Reber -Reported-by: Adrian Reber -Signed-off-by: Andrei Vagin -Tested-by: Adrian Reber -Reviewed-by: Dmitry Safonov <0x7f454c46@gmail.com> -Signed-off-by: Andrei Vagin ---- - include/common/asm-generic/bitops.h | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/include/common/asm-generic/bitops.h b/include/common/asm-generic/bitops.h -index cb449fbf8d..fbd25c1b6b 100644 ---- a/include/common/asm-generic/bitops.h -+++ b/include/common/asm-generic/bitops.h -@@ -28,25 +28,25 @@ - - static inline void set_bit(int nr, volatile unsigned long *addr) { - addr += nr / BITS_PER_LONG; -- *addr |= (1 << (nr % BITS_PER_LONG)); -+ *addr |= (1UL << (nr % BITS_PER_LONG)); - } - - static inline void change_bit(int nr, volatile unsigned long *addr) - { - addr += nr / BITS_PER_LONG; -- *addr ^= (1 << (nr % BITS_PER_LONG)); -+ *addr ^= (1UL << (nr % BITS_PER_LONG)); - } - - static inline int test_bit(int nr, volatile const unsigned long *addr) - { - addr += nr / BITS_PER_LONG; -- return (*addr & (1 << (nr % BITS_PER_LONG))) ? -1 : 0; -+ return (*addr & (1UL << (nr % BITS_PER_LONG))) ? -1 : 0; - } - - static inline void clear_bit(int nr, volatile unsigned long *addr) - { - addr += nr / BITS_PER_LONG; -- *addr &= ~(1 << (nr % BITS_PER_LONG)); -+ *addr &= ~(1UL << (nr % BITS_PER_LONG)); - } - - /** diff --git a/SOURCES/crit.1 b/SOURCES/crit.1 index 4572477..ab8398e 100644 --- a/SOURCES/crit.1 +++ b/SOURCES/crit.1 @@ -2,12 +2,12 @@ .\" Title: crit .\" Author: [see the "AUTHOR" section] .\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 06/01/2018 +.\" Date: 04/23/2019 .\" Manual: CRIU Manual -.\" Source: criu 3.9 +.\" Source: criu 3.12 .\" Language: English .\" -.TH "CRIT" "1" "06/01/2018" "criu 3\&.9" "CRIU Manual" +.TH "CRIT" "1" "04/23/2019" "criu 3\&.12" "CRIU Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/SOURCES/criu.8 b/SOURCES/criu.8 index 5973085..eea1e76 100644 --- a/SOURCES/criu.8 +++ b/SOURCES/criu.8 @@ -2,12 +2,12 @@ .\" Title: criu .\" Author: [see the "AUTHOR" section] .\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 06/01/2018 +.\" Date: 04/23/2019 .\" Manual: CRIU Manual -.\" Source: criu 3.9 +.\" Source: criu 3.12 .\" Language: English .\" -.TH "CRIU" "8" "06/01/2018" "criu 3\&.9" "CRIU Manual" +.TH "CRIU" "8" "04/23/2019" "criu 3\&.12" "CRIU Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -262,6 +262,16 @@ above plus lots of debug\&. .RE .RE .PP +\fB\-\-config\fR \fIfile\fR +.RS 4 +Pass a specific configuration file to criu\&. +.RE +.PP +\fB\-\-no\-default\-config\fR +.RS 4 +Forbid parsing of default configuration files\&. +.RE +.PP \fB\-\-pidfile\fR \fIfile\fR .RS 4 Write root task, service or page\-server pid into a @@ -274,11 +284,6 @@ Write logging messages to \fIfile\fR\&. .RE .PP -\fB\-\-log\-pid\fR -.RS 4 -Write separate logging files per each pid\&. -.RE -.PP \fB\-\-display\-stats\fR .RS 4 During dump as well as during restore @@ -355,16 +360,21 @@ run prior to beginning a \fBrestore\fR .RE .PP +\fBpost\-restore\fR +.RS 4 +run upon +\fBrestore\fR +completion +.RE +.PP \fBpre\-resume\fR .RS 4 run when all processes and resources are restored but tasks are stopped waiting for final kick to run\&. Must not fail\&. .RE .PP -\fBpost\-restore\fR +\fBpost\-resume\fR .RS 4 -run upon -\fBrestore\fR -completion +called at the very end, when everything is restored and processes were resumed .RE .PP \fBnetwork\-lock\fR @@ -379,7 +389,17 @@ run to unlock network in a target network namespace .PP \fBsetup\-namespaces\fR .RS 4 -run once root task just been created with required namespaces\&. Note it is an early stage of restore, when nothing is restored yet except for namespaces themselves +run once root task has just been created with required namespaces\&. Note it is an early stage of restore, when nothing is restored yet, except for namespaces themselves +.RE +.PP +\fBpost\-setup\-namespaces\fR +.RS 4 +called after the namespaces are configured +.RE +.PP +\fBorphan\-pts\-master\fR +.RS 4 +called after master pty is opened and unlocked\&. This hook can be used only in the RPC mode, and the notification message contains a file descriptor for the master pty .RE .RE .PP @@ -438,7 +458,7 @@ of resource, followed by resource \fIid\fR (enclosed in literal square brackets), and optional \fIvalue\fR -(prepended by a literal semicolon)\&. The following resource types are currently supported: +(prepended by a literal colon)\&. The following resource types are currently supported: \fBmnt\fR, \fBdev\fR, \fBfile\fR, @@ -467,7 +487,7 @@ to also dump external master mounts, \fBs\fR to also dump external shared mounts (default behavior is to abort dumping if such mounts are found)\&. If \fIflags\fR -are not provided, semicolon is optional\&. +are not provided, colon is optional\&. .RE .PP \fB\-\-external dev[\fR\fImajor\fR\fB/\fR\fIminor\fR\fB]:\fR\fIname\fR @@ -632,11 +652,6 @@ This option skips in\-flight TCP connections\&. If any TCP connections that are ignores these connections, rather than errors out\&. The TCP stack on the client side is expected to handle the re\-connect gracefully\&. .RE .PP -\fB\-\-tcp\-close\fR -.RS 4 -Restore connected TCP sockets in closed state\&. -.RE -.PP \fB\-\-evasive\-devices\fR .RS 4 Use any path to a device file if the original one is inaccessible\&. @@ -700,13 +715,72 @@ as well\&. .PP \fB\-\-cpu\-cap\fR [\fIcap\fR[,\fIcap\fR\&...]] .RS 4 -Specify CPU capabilities to write to an image file\&. The argument is a comma\-separated list of -\fBnone\fR, -\fBfpu\fR, -\fBcpu\fR, -\fBins\fR, -\fBall\fR\&. If the argument is omitted or set to -\fBnone\fR, capabilities will not be written, which is the default behavior\&. +Specify CPU capabilities to write to an image file\&. The argument is a comma\-separated list of: +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +\fBnone\fR +to ignore capabilities at all; the image will not be produced on dump, neither any check performed on restore; +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +\fBfpu\fR +to check if FPU module is compatible; +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +\fBins\fR +to check if CPU supports all instructions required; +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +\fBcpu\fR +to check if CPU capabilities are exactly matching; +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +\fBall\fR +for all above set\&. +.RE +.sp +By default the option is set to +\fBfpu\fR +and +\fBins\fR\&. .RE .PP \fB\-\-cgroup\-root\fR [\fIcontroller\fR:]/\fInewroot\fR @@ -824,6 +898,11 @@ Restore root task as a sibling (makes sense only with \fB\-\-restore\-detached\fR)\&. .RE .PP +\fB\-\-log\-pid\fR +.RS 4 +Write separate logging files per each pid\&. +.RE +.PP \fB\-r\fR, \fB\-\-root\fR \fIpath\fR .RS 4 Change the root filesystem to @@ -839,7 +918,7 @@ of resource, followed by resource \fIid\fR (enclosed in literal square brackets), and optional \fIvalue\fR -(prepended by a literal semicolon)\&. The following resource types are currently supported: +(prepended by a literal colon)\&. The following resource types are currently supported: \fBmnt\fR, \fBdev\fR, \fBveth\fR, @@ -948,6 +1027,11 @@ and phases so other side of a connection simply notice a kind of lag\&. .RE .PP +\fB\-\-tcp\-close\fR +.RS 4 +Restore connected TCP sockets in closed state\&. +.RE +.PP \fB\-\-veth\-pair\fR \fIIN\fR\fB=\fR\fIOUT\fR .RS 4 Correspondence between outside and inside names of veth devices\&. @@ -958,6 +1042,16 @@ Correspondence between outside and inside names of veth devices\&. Restore file locks from the image\&. .RE .PP +\fB\-\-lsm\-profile\fR \fItype\fR\fB:\fR\fIname\fR +.RS 4 +Specify an LSM profile to be used during restore\&. The +\FCtype\F[] +can be either +\fBapparmor\fR +or +\fBselinux\fR\&. +.RE +.PP \fB\-\-auto\-dedup\fR .RS 4 As soon as a page is restored it get punched out from image\&. @@ -1110,14 +1204,14 @@ Launches \fBcriu\fR in page server mode\&. Runs page server as a daemon (background process)\&. .RE .PP -\fB\-\-status_fd\fR +\fB\-\-status\-fd\fR .RS 4 -Write \e\e0 to the FD and close it once page\-server is ready to handle requests\&. The status\-fd allows to not daemonize a process and get its exit code at the end\&. It isn\(cqt supposed to use \-\-daemon and \-\-status\-fd together\&. +Write \e0 to the FD and close it once page\-server is ready to handle requests\&. The status\-fd allows to not daemonize a process and get its exit code at the end\&. It isn\(cqt supposed to use \-\-daemon and \-\-status\-fd together\&. .RE .PP \fB\-\-address\fR \fIaddress\fR .RS 4 -Page server IP address\&. +Page server IP address or hostname\&. .RE .PP \fB\-\-port\fR \fInumber\fR @@ -1125,6 +1219,11 @@ Page server IP address\&. Page server port number\&. .RE .PP +\fB\-\-ps\-socket\fR \fIfd\fR +.RS 4 +Use provided file descriptor as socket for incoming connection\&. In this case \-\-address and \-\-port are ignored\&. Useful for intercepting page\-server traffic e\&.g\&. to add encryption or authentication\&. +.RE +.PP \fB\-\-lazy\-pages\fR .RS 4 Serve local memory dump to a remote @@ -1133,13 +1232,13 @@ daemon\&. In this mode the \fBpage\-server\fR reads local memory dump and allows the remote \fBlazy\-pages\fR -deamon to request memory pages in random order\&. +daemon to request memory pages in random order\&. .RE .SS "lazy\-pages" .sp Launches \fBcriu\fR in lazy\-pages daemon mode\&. .sp -The \fBlazy\-pages\fR daemon is responsible for managing user\-level demand paging for the restored processes\&. It gets information required to fill the process memory pages from the \fBrestore\fR and from the checkpont directory\&. When a restored process access certain memory page for the first time, the \fBlazy\-pages\fR daemon injects its contents into the process address space\&. The memory pages that are not yet requested by the restored processes are injected in the background\&. +The \fBlazy\-pages\fR daemon is responsible for managing user\-level demand paging for the restored processes\&. It gets information required to fill the process memory pages from the \fBrestore\fR and from the checkpoint directory\&. When a restored process access certain memory page for the first time, the \fBlazy\-pages\fR daemon injects its contents into the process address space\&. The memory pages that are not yet requested by the restored processes are injected in the background\&. .SS "exec" .sp Executes a system call inside a destination task\*(Aqs context\&. This functionality is deprecated; please use \fBCompel\fR instead\&. @@ -1155,6 +1254,110 @@ Fetches current CPU features and write them into an image file\&. .SS "cpuinfo check" .sp Fetches current CPU features (i\&.e\&. CPU the \fBcriu\fR is running on) and test if they are compatible with the ones present in an image file\&. +.SH "CONFIGURATION FILES" +.sp +\fBCriu\fR supports usage of configuration files to avoid the need of writing every option on command line, which is useful especially with repeated usage of same options\&. A specific configuration file can be passed with the "\fB\-\-config\fR \fIfile\fR" option\&. If no file is passed, the default configuration files \fI/etc/criu/default\&.conf\fR and \fI$HOME/\&.criu/default\&.conf\fR are parsed (if present on the system)\&. If the environment variable CRIU_CONFIG_FILE is set, it will also be parsed\&. +.sp +The options passed to CRIU via CLI, RPC or configuration file are evaluated in the following order: +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +apply_config(/etc/criu/default\&.conf) +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +apply_config($HOME/\&.criu/default\&.conf) +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +apply_config(CRIU_CONFIG_FILE) +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +apply_config(\fB\-\-config\fR +\fIfile\fR) +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +apply_config(CLI) or apply_config(RPC) +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +apply_config(RPC configuration file) (only for RPC mode) +.RE +.sp +Default configuration file parsing can be deactivated with "\fB\-\-no\-default\-config\fR" if needed\&. Parsed configuration files are merged with command line options, which allows overriding boolean options\&. +.SS "Configuration file syntax" +.sp +Comments are supported using \*(Aq#\*(Aq sign\&. The rest of the line is ignored\&. Options are the same as command line options without the \*(Aq\-\-\*(Aq prefix, use one option per line (with corresponding argument if applicable, divided by whitespaces)\&. If needed, the argument can be provided in double quotes (this should be needed only if the argument contains whitespaces)\&. In case this type of argument contains a literal double quote as well, it can be escaped using the \*(Aq\e\*(Aq sign\&. Usage of commands is disallowed and all other escape sequences are interpreted literally\&. +.sp +Example of configuration file to illustrate syntax: +.sp +.if n \{\ +.RS 4 +.\} +.fam C +.ps -1 +.nf +.BB lightgray +$ cat ~/\&.criu/default\&.conf +tcp\-established +work\-dir "/home/USERNAME/criu/my \e"work\e" directory" +#this is a comment +no\-restore\-sibling # this is another comment +.EB lightgray +.fi +.fam +.ps +1 +.if n \{\ +.RE +.\} +.SS "Configuration files in RPC mode" +.sp +Not only does \fBcriu\fR evaluate configuration files in CLI mode, it also evaluates configuration files in RPC mode\&. Just as in CLI mode the configuration file values are evaluated first\&. This means that any option set via RPC will overwrite the configuration file setting\&. The user can thus change \fBcriu\fR\*(Aqs default behavior but it is not possible to change settings which are explicitly set by the RPC client\&. +.sp +The RPC client can, however, specify an additional configuration file which will be evaluated after the RPC options (see above for option evaluation order)\&. The RPC client can specify this additional configuration file via "req\&.opts\&.config_file = \fI/path/to/file\fR"\&. The values from this configuration file will overwrite all other configuration file settings or RPC options\&. \fBThis can lead to undesired behavior of criu and should only be used carefully\&.\fR .SH "EXAMPLES" .sp To checkpoint a program with pid of \fB1234\fR and write all image files into directory \fBcheckpoint\fR: diff --git a/SPECS/criu.spec b/SPECS/criu.spec index f4270db..f75b1fc 100644 --- a/SPECS/criu.spec +++ b/SPECS/criu.spec @@ -1,32 +1,25 @@ -%if 0%{?fedora} > 27 || 0%{?rhel} > 7 -%global py2_prefix python2 +%if 0%{?fedora} >= 27 || 0%{?rhel} > 7 +%global py_prefix python3 +%global py_binary %{py_prefix} %else -%global py2_prefix python +%global py_prefix python +%global py_binary python2 %endif +# With annobin enabled, CRIU does not work anymore. It seems CRIU's +# parasite code breaks if annobin is enabled. +%undefine _annotated_build + Name: criu -Version: 3.9 -Release: 5%{?dist} +Version: 3.12 +Release: 2%{?dist} Provides: crtools = %{version}-%{release} Obsoletes: crtools <= 1.0-2 Summary: Tool for Checkpoint/Restore in User-space -Group: System Environment/Base License: GPLv2 URL: http://criu.org/ Source0: http://download.openvz.org/criu/criu-%{version}.tar.bz2 -Patch1: 0001-criu-Remove-PAGE_IMAGE_SIZE.patch -Patch2: 0002-parasite-Rename-misnamed-nr_pages.patch -Patch3: 0003-aio-Allow-expressions-in-NR_IOEVENTS_IN_PAGES-macro.patch -Patch4: 0004-compel-criu-Add-ARCH_HAS_LONG_PAGES-to-PIE-binaries.patch -Patch5: 0005-criu-dump-Fix-size-of-personality-buffer.patch -Patch6: 0006-criu-log-Define-log-buffer-length-without-PAGE_SIZE.patch -Patch7: 0007-criu-proc-Define-BUF_SIZE-without-PAGE_SIZE-dependen.patch -Patch8: 0008-ppc64-aarch64-Dynamically-define-PAGE_SIZE.patch -Patch9: https://github.com/checkpoint-restore/criu/commit/80a4d3cf8cf227c1d0aa45153a6324b16ae5a647.patch -Patch10: https://github.com/checkpoint-restore/criu/commit/27034e7c64b00a1f2467afb5ebb1d5b9b1a06ce1.patch - - %if 0%{?rhel} && 0%{?rhel} <= 7 BuildRequires: perl # RHEL has no asciidoc; take man-page from Fedora 26 @@ -40,12 +33,19 @@ Patch100: aio-fix.patch Source3: criu-tmpfiles.conf +BuildRequires: gcc BuildRequires: systemd BuildRequires: libnet-devel -BuildRequires: protobuf-devel protobuf-c-devel python2-devel libnl3-devel libcap-devel +BuildRequires: protobuf-devel protobuf-c-devel %{py_prefix}-devel libnl3-devel libcap-devel %if 0%{?fedora} || 0%{?rhel} > 7 BuildRequires: asciidoc xmlto BuildRequires: perl-interpreter +BuildRequires: libselinux-devel +# Checkpointing containers with a tmpfs requires tar +Recommends: tar +%if 0%{?fedora} +BuildRequires: libbsd-devel +%endif %endif # user-space and kernel changes are only available for x86_64, arm, @@ -61,30 +61,36 @@ Linux in user-space. %if 0%{?fedora} || 0%{?rhel} > 7 %package devel Summary: Header files and libraries for %{name} -Group: Development/Libraries Requires: %{name} = %{version}-%{release} %description devel This package contains header files and libraries for %{name}. + +%package libs +Summary: Libraries for %{name} +Requires: %{name} = %{version}-%{release} + +%description libs +This package contains the libraries for %{name} %endif -%package -n %{py2_prefix}-%{name} -%{?python_provide:%python_provide %{py2_prefix}-%{name}} +%package -n %{py_prefix}-%{name} +%{?python_provide:%python_provide %{py_prefix}-%{name}} Summary: Python bindings for %{name} -Group: Development/Languages -Requires: %{name} = %{version}-%{release} %{py2_prefix}-ipaddr -%if 0%{?fedora} || 0%{?rhel} > 7 -Requires: python2-protobuf -%else +%if 0%{?rhel} && 0%{?rhel} <= 7 Requires: protobuf-python +Requires: %{name} = %{version}-%{release} %{py_prefix}-ipaddr +%else +Requires: %{py_prefix}-protobuf +Obsoletes: python2-criu < 3.10-1 %endif -%description -n %{py2_prefix}-%{name} -python-%{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: %{py2_prefix}-%{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 @@ -94,17 +100,6 @@ their content in human-readable form. %prep %setup -q -%patch1 -p1 -%patch2 -p1 -%patch3 -p1 -%patch4 -p1 -%patch5 -p1 -%patch6 -p1 -%patch7 -p1 -%patch8 -p1 -%patch9 -p1 -%patch10 -p1 - %if 0%{?rhel} && 0%{?rhel} <= 7 %patch100 -p1 %endif @@ -112,7 +107,7 @@ their content in human-readable form. %build # %{?_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 +CFLAGS+=`echo %{optflags} | sed -e 's,-fstack-protector\S*,,g'` make V=1 WERROR=0 PREFIX=%{_prefix} RUNDIR=/run/criu PYTHON=%{py_binary} %if 0%{?fedora} || 0%{?rhel} > 7 make docs V=1 %endif @@ -120,7 +115,7 @@ make docs V=1 %install make install-criu DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} -make install-lib DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} +make install-lib DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} LIBDIR=%{_libdir} PYTHON=%{py_binary} %if 0%{?fedora} || 0%{?rhel} > 7 # only install documentation on Fedora as it requires asciidoc, # which is not available on RHEL7 @@ -142,14 +137,10 @@ rm -rf $RPM_BUILD_ROOT%{_libdir}/pkgconfig rm -rf $RPM_BUILD_ROOT%{_libexecdir}/%{name} %endif -%post -p /sbin/ldconfig -%postun -p /sbin/ldconfig - %files %{_sbindir}/%{name} %doc %{_mandir}/man8/criu.8* %if 0%{?fedora} || 0%{?rhel} > 7 -%{_libdir}/*.so.* %{_libexecdir}/%{name} %endif %dir /run/%{name} @@ -161,11 +152,19 @@ rm -rf $RPM_BUILD_ROOT%{_libexecdir}/%{name} %{_includedir}/criu %{_libdir}/*.so %{_libdir}/pkgconfig/*.pc + +%files libs +%{_libdir}/*.so.* %endif -%files -n %{py2_prefix}-%{name} +%files -n %{py_prefix}-%{name} +%if 0%{?rhel} && 0%{?rhel} <= 7 %{python2_sitelib}/pycriu/* %{python2_sitelib}/*egg-info +%else +%{python3_sitelib}/pycriu/* +%{python3_sitelib}/*egg-info +%endif %files -n crit %{_bindir}/crit @@ -173,6 +172,15 @@ rm -rf $RPM_BUILD_ROOT%{_libexecdir}/%{name} %changelog +* Thu Apr 25 2019 Adrian Reber - 3.12-2 +- Updated to official 3.12 + +* Tue Apr 23 2019 Adrian Reber - 3.12-0.1 +- Updated to 3.12 (pre-release) +- Create libs subpackage +- Build against SELinux (Fedora and RHEL8) +- Build against libbsd (Fedora) + * Sun Jul 15 2018 Adrian Reber - 3.9-5 - Add patch to fix runc read-only regression (#1598028)