Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package criu for openSUSE:Factory checked in at 2022-08-11 18:32:36 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/criu (Old) and /work/SRC/openSUSE:Factory/.criu.new.1521 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "criu" Thu Aug 11 18:32:36 2022 rev:56 rq:994460 version:3.17.1 Changes: -------- --- /work/SRC/openSUSE:Factory/criu/criu.changes 2022-05-18 13:13:53.674699039 +0200 +++ /work/SRC/openSUSE:Factory/.criu.new.1521/criu.changes 2022-08-11 18:32:50.454241744 +0200 @@ -1,0 +2,9 @@ +Thu Aug 11 07:06:26 UTC 2022 - Takashi Iwai <[email protected]> + +- Update to criu 3.17.1: + * Fixes for pre-dump read mode + * Fixes for mount-v2 + * amdgpu plugin build and installation fixes + * Some minor CI related fixes + +------------------------------------------------------------------- Old: ---- criu-3.17.tar.gz New: ---- criu-3.17.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ criu.spec ++++++ --- /var/tmp/diff_new_pack.lKytGL/_old 2022-08-11 18:32:51.086240775 +0200 +++ /var/tmp/diff_new_pack.lKytGL/_new 2022-08-11 18:32:51.090240769 +0200 @@ -34,7 +34,7 @@ %define proto_c_ver %(protoc-c --version | head -1 | awk '{print $2}') Name: criu -Version: 3.17 +Version: 3.17.1 Release: 0 Summary: Checkpoint/Restore In Userspace Tools License: GPL-2.0-only ++++++ criu-3.17.tar.gz -> criu-3.17.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/criu-3.17/.github/workflows/lint.yml new/criu-3.17.1/.github/workflows/lint.yml --- old/criu-3.17/.github/workflows/lint.yml 2022-05-05 21:42:14.000000000 +0200 +++ new/criu-3.17.1/.github/workflows/lint.yml 2022-06-23 23:53:25.000000000 +0200 @@ -10,9 +10,16 @@ steps: - name: Install tools run: sudo dnf -y install git make python3-flake8 ShellCheck clang-tools-extra which findutils codespell + - uses: actions/checkout@v2 + + - name: Set git safe directory + # https://github.com/actions/checkout/issues/760 + run: git config --global --add safe.directory "$GITHUB_WORKSPACE" + - name: Run make lint run: make lint + - name: Run make indent run: > make indent && diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/criu-3.17/Makefile new/criu-3.17.1/Makefile --- old/criu-3.17/Makefile 2022-05-05 21:42:14.000000000 +0200 +++ new/criu-3.17.1/Makefile 2022-06-23 23:53:25.000000000 +0200 @@ -418,6 +418,7 @@ flake8 --config=scripts/flake8.cfg test/others/rpc/config_file.py flake8 --config=scripts/flake8.cfg lib/py/images/pb2dict.py flake8 --config=scripts/flake8.cfg scripts/criu-ns + flake8 --config=scripts/flake8.cfg scripts/crit-setup.py flake8 --config=scripts/flake8.cfg coredump/ shellcheck --version shellcheck scripts/*.sh diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/criu-3.17/Makefile.install new/criu-3.17.1/Makefile.install --- old/criu-3.17/Makefile.install 2022-05-05 21:42:14.000000000 +0200 +++ new/criu-3.17.1/Makefile.install 2022-06-23 23:53:25.000000000 +0200 @@ -7,7 +7,7 @@ INCLUDEDIR ?= $(PREFIX)/include LIBEXECDIR ?= $(PREFIX)/libexec RUNDIR ?= /run -PLUGINDIR ?= /var/lib/criu +PLUGINDIR ?= $(PREFIX)/lib/criu # # For recent Debian/Ubuntu with multiarch support. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/criu-3.17/Makefile.versions new/criu-3.17.1/Makefile.versions --- old/criu-3.17/Makefile.versions 2022-05-05 21:42:14.000000000 +0200 +++ new/criu-3.17.1/Makefile.versions 2022-06-23 23:53:25.000000000 +0200 @@ -2,7 +2,7 @@ # CRIU version. CRIU_VERSION_MAJOR := 3 CRIU_VERSION_MINOR := 17 -CRIU_VERSION_SUBLEVEL := +CRIU_VERSION_SUBLEVEL := 1 CRIU_VERSION_EXTRA := CRIU_VERSION_NAME := Radiant Redstart CRIU_VERSION := $(CRIU_VERSION_MAJOR)$(if $(CRIU_VERSION_MINOR),.$(CRIU_VERSION_MINOR))$(if $(CRIU_VERSION_SUBLEVEL),.$(CRIU_VERSION_SUBLEVEL))$(if $(CRIU_VERSION_EXTRA),.$(CRIU_VERSION_EXTRA)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/criu-3.17/criu/arch/x86/cpu.c new/criu-3.17.1/criu/arch/x86/cpu.c --- old/criu-3.17/criu/arch/x86/cpu.c 2022-05-05 21:42:14.000000000 +0200 +++ new/criu-3.17.1/criu/arch/x86/cpu.c 2022-06-23 23:53:25.000000000 +0200 @@ -78,7 +78,7 @@ cpu_info.n_x86_entry = 1; cpu_x86_info.vendor_id = (rt_cpu_info.x86_vendor == X86_VENDOR_INTEL) ? CPUINFO_X86_ENTRY__VENDOR__INTEL : - CPUINFO_X86_ENTRY__VENDOR__AMD; + CPUINFO_X86_ENTRY__VENDOR__AMD; cpu_x86_info.cpu_family = rt_cpu_info.x86_family; cpu_x86_info.model = rt_cpu_info.x86_model; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/criu-3.17/criu/arch/x86/crtools.c new/criu-3.17.1/criu/arch/x86/crtools.c --- old/criu-3.17/criu/arch/x86/crtools.c 2022-05-05 21:42:14.000000000 +0200 +++ new/criu-3.17.1/criu/arch/x86/crtools.c 2022-06-23 23:53:25.000000000 +0200 @@ -409,7 +409,7 @@ { fpu_state_t *fpu_state = core_is_compat(core) ? &sigframe->compat.fpu_state : &sigframe->native.fpu_state; struct xsave_struct *x = core_is_compat(core) ? (void *)&fpu_state->fpu_state_ia32.xsave : - (void *)&fpu_state->fpu_state_64.xsave; + (void *)&fpu_state->fpu_state_64.xsave; /* * If no FPU information provided -- we're restoring diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/criu-3.17/criu/cr-check.c new/criu-3.17.1/criu/cr-check.c --- old/criu-3.17/criu/cr-check.c 2022-05-05 21:42:14.000000000 +0200 +++ new/criu-3.17.1/criu/cr-check.c 2022-06-23 23:53:25.000000000 +0200 @@ -1291,7 +1291,7 @@ { check_sock_diag(); return (socket_test_collect_bit(AF_INET, IPPROTO_RAW) && socket_test_collect_bit(AF_INET6, IPPROTO_RAW)) ? 0 : - -1; + -1; } static int check_pidfd_store(void) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/criu-3.17/criu/include/page-xfer.h new/criu-3.17.1/criu/include/page-xfer.h --- old/criu-3.17/criu/include/page-xfer.h 2022-05-05 21:42:14.000000000 +0200 +++ new/criu-3.17.1/criu/include/page-xfer.h 2022-06-23 23:53:25.000000000 +0200 @@ -10,7 +10,7 @@ extern int cr_page_server(bool daemon_mode, bool lazy_dump, int cfd); /* User buffer for read-mode pre-dump*/ -#define BUFFER_SIZE (PIPE_MAX_SIZE << PAGE_SHIFT) +#define PIPE_MAX_BUFFER_SIZE (PIPE_MAX_SIZE << PAGE_SHIFT) /* * page_xfer -- transfer pages into image file. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/criu-3.17/criu/include/plugin.h new/criu-3.17.1/criu/include/plugin.h --- old/criu-3.17/criu/include/plugin.h 2022-05-05 21:42:14.000000000 +0200 +++ new/criu-3.17.1/criu/include/plugin.h 2022-06-23 23:53:25.000000000 +0200 @@ -5,7 +5,9 @@ #include "common/compiler.h" #include "common/list.h" -#define CR_PLUGIN_DEFAULT "/var/lib/criu/" +#ifndef CR_PLUGIN_DEFAULT +#define CR_PLUGIN_DEFAULT "/usr/lib/criu/" +#endif void cr_plugin_fini(int stage, int err); int cr_plugin_init(int stage); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/criu-3.17/criu/mount-v2.c new/criu-3.17.1/criu/mount-v2.c --- old/criu-3.17/criu/mount-v2.c 2022-05-05 21:42:14.000000000 +0200 +++ new/criu-3.17.1/criu/mount-v2.c 2022-06-23 23:53:25.000000000 +0200 @@ -925,27 +925,25 @@ return 0; } -static int restore_one_sharing_group(struct sharing_group *sg) +static int restore_one_sharing(struct sharing_group *sg, struct mount_info *target) { - struct mount_info *first, *other; - char first_path[PATH_MAX]; - int first_fd; + char target_path[PATH_MAX]; + int target_fd; - first = get_first_mount(sg); - first_fd = fdstore_get(first->mnt_fd_id); - BUG_ON(first_fd < 0); - snprintf(first_path, sizeof(first_path), "/proc/self/fd/%d", first_fd); + target_fd = fdstore_get(target->mnt_fd_id); + BUG_ON(target_fd < 0); + snprintf(target_path, sizeof(target_path), "/proc/self/fd/%d", target_fd); - /* Restore first's master_id from shared_id of the source */ + /* Restore target's master_id from shared_id of the source */ if (sg->master_id) { if (sg->parent) { - struct mount_info *p; + struct mount_info *first; /* Get shared_id from parent sharing group */ - p = get_first_mount(sg->parent); - if (move_mount_set_group(p->mnt_fd_id, NULL, first->mnt_fd_id)) { - pr_err("Failed to copy sharing from %d to %d\n", p->mnt_id, first->mnt_id); - close(first_fd); + first = get_first_mount(sg->parent); + if (move_mount_set_group(first->mnt_fd_id, NULL, target->mnt_fd_id)) { + pr_err("Failed to copy sharing from %d to %d\n", first->mnt_id, target->mnt_id); + close(target_fd); return -1; } } else { @@ -956,39 +954,77 @@ * or non-shared slave). If source is a private mount * we would fail. */ - if (move_mount_set_group(-1, sg->source, first->mnt_fd_id)) { - pr_err("Failed to copy sharing from source %s to %d\n", sg->source, first->mnt_id); - close(first_fd); + if (move_mount_set_group(-1, sg->source, target->mnt_fd_id)) { + pr_err("Failed to copy sharing from source %s to %d\n", sg->source, target->mnt_id); + close(target_fd); return -1; } } /* Convert shared_id to master_id */ - if (mount(NULL, first_path, NULL, MS_SLAVE, NULL)) { - pr_perror("Failed to make mount %d slave", first->mnt_id); - close(first_fd); + if (mount(NULL, target_path, NULL, MS_SLAVE, NULL)) { + pr_perror("Failed to make mount %d slave", target->mnt_id); + close(target_fd); return -1; } } - /* Restore first's shared_id */ + /* Restore target's shared_id */ if (sg->shared_id) { - if (mount(NULL, first_path, NULL, MS_SHARED, NULL)) { - pr_perror("Failed to make mount %d shared", first->mnt_id); - close(first_fd); + if (mount(NULL, target_path, NULL, MS_SHARED, NULL)) { + pr_perror("Failed to make mount %d shared", target->mnt_id); + close(target_fd); return -1; } } - close(first_fd); + close(target_fd); + + return 0; +} + +static int restore_one_sharing_group(struct sharing_group *sg) +{ + struct mount_info *first, *other; + + first = get_first_mount(sg); + + if (restore_one_sharing(sg, first)) + return -1; /* Restore sharing for other mounts from the sharing group */ list_for_each_entry(other, &sg->mnt_list, mnt_sharing) { if (other == first) continue; - if (move_mount_set_group(first->mnt_fd_id, NULL, other->mnt_fd_id)) { - pr_err("Failed to copy sharing from %d to %d\n", first->mnt_id, other->mnt_id); - return -1; + if (is_sub_path(other->root, first->root)) { + if (move_mount_set_group(first->mnt_fd_id, NULL, other->mnt_fd_id)) { + pr_err("Failed to copy sharing from %d to %d\n", first->mnt_id, other->mnt_id); + return -1; + } + } else { + /* + * Case where mounts of this sharing group don't have common root. + * For instance we can create two sub-directories .a and .b in some + * shared mount, bindmount them separately somethere and umount the + * original mount. Now we have both bindmounts shared between each + * other. Kernel only allows to copy sharing between mounts when + * source root contains destination root, which is not true for + * these two, so we can't just copy from first to other. + * + * For external sharing (!sg->parent) with only master_id (shared_id + * == 0) we can workaround this by copying from their external source + * instead (same as we did for a first mount). + * + * This is a w/a runc usecase, see https://github.com/opencontainers/runc/pull/3442 + */ + if (!sg->parent && !sg->shared_id) { + if (restore_one_sharing(sg, other)) + return -1; + } else { + pr_err("Can't copy sharing from %d[%s] to %d[%s]\n", first->mnt_id, first->root, + other->mnt_id, other->root); + return -1; + } } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/criu-3.17/criu/page-pipe.c new/criu-3.17.1/criu/page-pipe.c --- old/criu-3.17/criu/page-pipe.c 2022-05-05 21:42:14.000000000 +0200 +++ new/criu-3.17.1/criu/page-pipe.c 2022-06-23 23:53:25.000000000 +0200 @@ -56,7 +56,7 @@ if (new_size > PIPE_MAX_SIZE) { if (ppb->pipe_size < PIPE_MAX_SIZE) - ppb->pipe_size = PIPE_MAX_SIZE; + new_size = PIPE_MAX_SIZE; else return 1; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/criu-3.17/criu/page-xfer.c new/criu-3.17.1/criu/page-xfer.c --- old/criu-3.17/criu/page-xfer.c 2022-05-05 21:42:14.000000000 +0200 +++ new/criu-3.17.1/criu/page-xfer.c 2022-06-23 23:53:25.000000000 +0200 @@ -617,31 +617,18 @@ */ unsigned long handle_faulty_iov(int pid, struct iovec *riov, unsigned long faulty_index, struct iovec *bufvec, - struct iovec *aux_iov, unsigned long *aux_len, unsigned long partial_read_bytes) + struct iovec *aux_iov, unsigned long *aux_len) { struct iovec dummy; ssize_t bytes_read; - unsigned long offset = 0; unsigned long final_read_cnt = 0; - /* Handling Case 2*/ - if (riov[faulty_index].iov_len == PAGE_SIZE) { - cnt_sub(CNT_PAGES_WRITTEN, 1); - return 0; - } - /* Handling Case 3-Part 3.2*/ - offset = (partial_read_bytes) ? partial_read_bytes : PAGE_SIZE; - - dummy.iov_base = riov[faulty_index].iov_base + offset; - dummy.iov_len = riov[faulty_index].iov_len - offset; - - if (!partial_read_bytes) - cnt_sub(CNT_PAGES_WRITTEN, 1); + dummy.iov_base = riov[faulty_index].iov_base; + dummy.iov_len = riov[faulty_index].iov_len; while (dummy.iov_len) { bytes_read = process_vm_readv(pid, bufvec, 1, &dummy, 1, 0); - if (bytes_read == -1) { /* Handling faulty page read in faulty iov */ cnt_sub(CNT_PAGES_WRITTEN, 1); @@ -671,14 +658,12 @@ /* * This function will position start pointer to the latest - * successfully read iov in iovec. In case of partial read it - * returns partial_read_bytes, otherwise 0. + * successfully read iov in iovec. */ static unsigned long analyze_iov(ssize_t bytes_read, struct iovec *riov, unsigned long *index, struct iovec *aux_iov, unsigned long *aux_len) { ssize_t processed_bytes = 0; - unsigned long partial_read_bytes = 0; /* correlating iovs with read bytes */ while (processed_bytes < bytes_read) { @@ -692,13 +677,17 @@ /* handling partially processed faulty iov*/ if (processed_bytes - bytes_read) { + unsigned long partial_read_bytes = 0; + (*index) -= 1; partial_read_bytes = riov[*index].iov_len - (processed_bytes - bytes_read); aux_iov[*aux_len - 1].iov_len = partial_read_bytes; + riov[*index].iov_base += partial_read_bytes; + riov[*index].iov_len -= partial_read_bytes; } - return partial_read_bytes; + return 0; } /* @@ -723,40 +712,36 @@ ssize_t bytes_read; unsigned long total_read = 0; unsigned long start = 0; - unsigned long partial_read_bytes = 0; while (start < ppb->nr_segs) { bytes_read = process_vm_readv(pid, bufvec, 1, &riov[start], ppb->nr_segs - start, 0); - if (bytes_read == -1) { + if (errno == ESRCH) { + pr_debug("Target process PID:%d not found\n", pid); + return -ESRCH; + } + if (errno != EFAULT) { + pr_perror("process_vm_readv failed"); + return -1; + } /* Handling Case 1*/ if (riov[start].iov_len == PAGE_SIZE) { cnt_sub(CNT_PAGES_WRITTEN, 1); start += 1; continue; - } else if (errno == ESRCH) { - pr_debug("Target process PID:%d not found\n", pid); - return ESRCH; } + total_read += handle_faulty_iov(pid, riov, start, bufvec, aux_iov, aux_len); + start += 1; + continue; } - partial_read_bytes = 0; - if (bytes_read > 0) { - partial_read_bytes = analyze_iov(bytes_read, riov, &start, aux_iov, aux_len); + if (analyze_iov(bytes_read, riov, &start, aux_iov, aux_len) < 0) + return -1; bufvec->iov_base += bytes_read; bufvec->iov_len -= bytes_read; total_read += bytes_read; } - - /* - * If all iovs not processed in one go, - * it means some iov in between has failed. - */ - if (start < ppb->nr_segs) - total_read += handle_faulty_iov(pid, riov, start, bufvec, aux_iov, aux_len, partial_read_bytes); - - start += 1; } return total_read; @@ -777,40 +762,62 @@ struct page_pipe_buf *ppb; unsigned int cur_hole = 0, i; unsigned long ret, bytes_read; + unsigned long userbuf_len; struct iovec bufvec; - struct iovec aux_iov[PIPE_MAX_SIZE]; + struct iovec *aux_iov; unsigned long aux_len; + void *userbuf; - char *userbuf = mmap(NULL, BUFFER_SIZE, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); - + userbuf_len = PIPE_MAX_BUFFER_SIZE; + userbuf = mmap(NULL, userbuf_len, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); if (userbuf == MAP_FAILED) { pr_perror("Unable to mmap a buffer"); return -1; } + aux_iov = xmalloc(userbuf_len / PAGE_SIZE * sizeof(aux_iov[0])); + if (!aux_iov) + goto err; list_for_each_entry(ppb, &pp->bufs, l) { + if (ppb->pipe_size * PAGE_SIZE > userbuf_len) { + void *addr; + + addr = mremap(userbuf, userbuf_len, ppb->pipe_size * PAGE_SIZE, MREMAP_MAYMOVE); + if (addr == MAP_FAILED) { + pr_perror("Unable to mmap a buffer"); + goto err; + } + userbuf_len = ppb->pipe_size * PAGE_SIZE; + userbuf = addr; + addr = xrealloc(aux_iov, ppb->pipe_size * sizeof(aux_iov[0])); + if (!addr) + goto err; + aux_iov = addr; + } timing_start(TIME_MEMDUMP); aux_len = 0; - bufvec.iov_len = BUFFER_SIZE; + bufvec.iov_len = userbuf_len; bufvec.iov_base = userbuf; bytes_read = fill_userbuf(pid, ppb, &bufvec, aux_iov, &aux_len); - - if (bytes_read == ESRCH) { - munmap(userbuf, BUFFER_SIZE); - return -1; + if (bytes_read == -ESRCH) { + timing_stop(TIME_MEMDUMP); + munmap(userbuf, userbuf_len); + xfree(aux_iov); + return 0; } + if (bytes_read < 0) + goto err; bufvec.iov_base = userbuf; bufvec.iov_len = bytes_read; - ret = vmsplice(ppb->p[1], &bufvec, 1, SPLICE_F_NONBLOCK); + ret = vmsplice(ppb->p[1], &bufvec, 1, SPLICE_F_NONBLOCK | SPLICE_F_GIFT); if (ret == -1 || ret != bytes_read) { pr_err("vmsplice: Failed to splice user buffer to pipe %ld\n", ret); - munmap(userbuf, BUFFER_SIZE); - return -1; + goto err; } timing_stop(TIME_MEMDUMP); @@ -822,10 +829,8 @@ u32 flags; ret = dump_holes(xfer, pp, &cur_hole, iov.iov_base); - if (ret) { - munmap(userbuf, BUFFER_SIZE); - return ret; - } + if (ret) + goto err; BUG_ON(iov.iov_base < (void *)xfer->offset); iov.iov_base -= xfer->offset; @@ -833,24 +838,25 @@ flags = ppb_xfer_flags(xfer, ppb); - if (xfer->write_pagemap(xfer, &iov, flags)) { - munmap(userbuf, BUFFER_SIZE); - return -1; - } + if (xfer->write_pagemap(xfer, &iov, flags)) + goto err; - if (xfer->write_pages(xfer, ppb->p[0], iov.iov_len)) { - munmap(userbuf, BUFFER_SIZE); - return -1; - } + if (xfer->write_pages(xfer, ppb->p[0], iov.iov_len)) + goto err; } timing_stop(TIME_MEMWRITE); } - munmap(userbuf, BUFFER_SIZE); + munmap(userbuf, userbuf_len); + xfree(aux_iov); timing_start(TIME_MEMWRITE); return dump_holes(xfer, pp, &cur_hole, NULL); +err: + munmap(userbuf, userbuf_len); + xfree(aux_iov); + return -1; } int page_xfer_dump_pages(struct page_xfer *xfer, struct page_pipe *pp) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/criu-3.17/criu/unittest/mock.c new/criu-3.17.1/criu/unittest/mock.c --- old/criu-3.17/criu/unittest/mock.c 2022-05-05 21:42:14.000000000 +0200 +++ new/criu-3.17.1/criu/unittest/mock.c 2022-06-23 23:53:25.000000000 +0200 @@ -103,8 +103,7 @@ { } -struct ns_desc { -}; +struct ns_desc {}; struct ns_desc user_ns_desc; int switch_ns(int pid, struct ns_desc *nd, int *rst) { @@ -118,8 +117,7 @@ } typedef struct VmaEntry VmaEntry; -struct VmaEntry { -}; +struct VmaEntry {}; void vma_entry__init(VmaEntry *message) { } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/criu-3.17/criu/util.c new/criu-3.17.1/criu/util.c --- old/criu-3.17/criu/util.c 2022-05-05 21:42:14.000000000 +0200 +++ new/criu-3.17.1/criu/util.c 2022-06-23 23:53:25.000000000 +0200 @@ -2021,6 +2021,10 @@ char *mp_path, *free_path; bool is_mountpoint; + /* + * The dirname() function may modify the contents of given path, + * so we need a strdup here to preserve path. + */ mp_path = free_path = xstrdup(path); if (!mp_path) return NULL; @@ -2031,7 +2035,7 @@ * by openat2 RESOLVE_NO_XDEV, let's just assume they are. */ if (is_same_path(mp_path, "/")) - return mp_path; + goto out; if (path_is_mountpoint(mp_path, &is_mountpoint) == -1) { xfree(free_path); @@ -2039,7 +2043,7 @@ } if (is_mountpoint) - return mp_path; + goto out; /* Try parent directory */ mp_path = dirname(mp_path); @@ -2048,4 +2052,14 @@ /* never get here */ xfree(free_path); return NULL; +out: + /* + * The dirname() function may or may not return statically allocated + * strings, so here mp_path can be either dynamically allocated or + * statically allocated. Let's strdup to make the return pointer + * always freeable. + */ + mp_path = xstrdup(mp_path); + xfree(free_path); + return mp_path; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/criu-3.17/plugins/amdgpu/Makefile new/criu-3.17.1/plugins/amdgpu/Makefile --- old/criu-3.17/plugins/amdgpu/Makefile 2022-05-05 21:42:14.000000000 +0200 +++ new/criu-3.17.1/plugins/amdgpu/Makefile 2022-06-23 23:53:25.000000000 +0200 @@ -2,7 +2,7 @@ PLUGIN_SOBJ := amdgpu_plugin.so -PLUGIN_INCLUDE := -iquote../../../criu/include +PLUGIN_INCLUDE := -iquote../../include PLUGIN_INCLUDE += -iquote../../criu/include PLUGIN_INCLUDE += -iquote../../criu/arch/$(ARCH)/include/ PLUGIN_INCLUDE += -iquote../../ @@ -15,7 +15,7 @@ include $(__nmk_dir)msg.mk CC := gcc -PLUGIN_CFLAGS := -g -Wall -Werror -D _GNU_SOURCE -shared -nostartfiles -fPIC +PLUGIN_CFLAGS := -g -Wall -Werror -D _GNU_SOURCE -shared -nostartfiles -fPIC -DCR_PLUGIN_DEFAULT="$(PLUGINDIR)" PLUGIN_LDFLAGS := -lpthread -lrt -ldrm -ldrm_amdgpu ifeq ($(CONFIG_AMDGPU),y) @@ -50,16 +50,16 @@ mrproper: clean install: - $(Q) mkdir -p $(PLUGINDIR) ifeq ($(CONFIG_AMDGPU),y) + $(Q) mkdir -p $(DESTDIR)$(PLUGINDIR) $(E) " INSTALL " $(PLUGIN_NAME) - $(Q) install -m 644 $(PLUGIN_SOBJ) $(PLUGINDIR) + $(Q) install -m 644 $(PLUGIN_SOBJ) $(DESTDIR)$(PLUGINDIR) endif .PHONY: install uninstall: ifeq ($(CONFIG_AMDGPU),y) $(E) " UNINSTALL" $(PLUGIN_NAME) - $(Q) $(RM) $(PLUGINDIR)/$(PLUGIN_SOBJ) + $(Q) $(RM) $(DESTDIR)$(PLUGINDIR)/$(PLUGIN_SOBJ) endif .PHONY: uninstall diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/criu-3.17/plugins/amdgpu/amdgpu_plugin.c new/criu-3.17.1/plugins/amdgpu/amdgpu_plugin.c --- old/criu-3.17/plugins/amdgpu/amdgpu_plugin.c 2022-05-05 21:42:14.000000000 +0200 +++ new/criu-3.17.1/plugins/amdgpu/amdgpu_plugin.c 2022-06-23 23:53:25.000000000 +0200 @@ -873,7 +873,7 @@ } max_copy_size = (gpu_info.family_id >= AMDGPU_FAMILY_AI) ? SDMA_LINEAR_COPY_MAX_SIZE : - SDMA_LINEAR_COPY_MAX_SIZE - 1; + SDMA_LINEAR_COPY_MAX_SIZE - 1; for (i = 0; i < thread_data->num_of_bos; i++) { if (bo_buckets[i].gpu_id == thread_data->gpu_id && @@ -967,7 +967,7 @@ } max_copy_size = (gpu_info.family_id >= AMDGPU_FAMILY_AI) ? SDMA_LINEAR_COPY_MAX_SIZE : - SDMA_LINEAR_COPY_MAX_SIZE - 1; + SDMA_LINEAR_COPY_MAX_SIZE - 1; snprintf(img_path, sizeof(img_path), IMG_PAGES_FILE, thread_data->id, thread_data->gpu_id); bo_contents_fp = open_img_file(img_path, false, &image_size); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/criu-3.17/scripts/ci/run-ci-tests.sh new/criu-3.17.1/scripts/ci/run-ci-tests.sh --- old/criu-3.17/scripts/ci/run-ci-tests.sh 2022-05-05 21:42:14.000000000 +0200 +++ new/criu-3.17.1/scripts/ci/run-ci-tests.sh 2022-06-23 23:53:25.000000000 +0200 @@ -268,6 +268,7 @@ ./test/zdtm.py run -t zdtm/transition/maps007 --pre 2 --noauto-dedup ./test/zdtm.py run -t zdtm/transition/maps007 --pre 2 --page-server ./test/zdtm.py run -t zdtm/transition/maps007 --pre 2 --page-server --dedup +./test/zdtm.py run -t zdtm/transition/maps007 --pre 2 --pre-dump-mode read ./test/zdtm.py run -t zdtm/transition/pid_reuse --pre 2 # start time based pid reuse detection ./test/zdtm.py run -t zdtm/transition/pidfd_store_sk --rpc --pre 2 # pidfd based pid reuse detection diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/criu-3.17/scripts/crit-setup.py new/criu-3.17.1/scripts/crit-setup.py --- old/criu-3.17/scripts/crit-setup.py 2022-05-05 21:42:14.000000000 +0200 +++ new/criu-3.17.1/scripts/crit-setup.py 2022-06-23 23:53:25.000000000 +0200 @@ -1,10 +1,24 @@ +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="0.0.1", + version=criu_version, description="CRiu Image Tool", author="CRIU team", author_email="[email protected]", + license="GPLv2", url="https://github.com/checkpoint-restore/criu", package_dir={'pycriu': 'lib/py'}, packages=["pycriu", "pycriu.images"], diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/criu-3.17/test/zdtm/static/Makefile new/criu-3.17.1/test/zdtm/static/Makefile --- old/criu-3.17/test/zdtm/static/Makefile 2022-05-05 21:42:14.000000000 +0200 +++ new/criu-3.17.1/test/zdtm/static/Makefile 2022-06-23 23:53:25.000000000 +0200 @@ -402,10 +402,12 @@ mnt_ext_master \ mnt_ext_dev \ mnt_ext_root \ + mnt_root_ext \ mnt_ext_collision \ mntns_pivot_root \ mntns_pivot_root_ro \ mnt_ext_sharing \ + mnt_ext_multiple \ mount_complex_sharing \ mnt_tracefs \ mntns_deleted \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/criu-3.17/test/zdtm/static/inotify_system.c new/criu-3.17.1/test/zdtm/static/inotify_system.c --- old/criu-3.17/test/zdtm/static/inotify_system.c 2022-05-05 21:42:14.000000000 +0200 +++ new/criu-3.17.1/test/zdtm/static/inotify_system.c 2022-06-23 23:53:25.000000000 +0200 @@ -57,7 +57,7 @@ (MASK == IN_UNMOUNT) ? "IN_UNMOUNT" : \ (MASK == IN_Q_OVERFLOW) ? "IN_Q_OVERFLOW" : \ (MASK == IN_IGNORED) ? "IN_IGNORED" : \ - "UNKNOWN" + "UNKNOWN" #include <unistd.h> #include <fcntl.h> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/criu-3.17/test/zdtm/static/mnt_ext_multiple.c new/criu-3.17.1/test/zdtm/static/mnt_ext_multiple.c --- old/criu-3.17/test/zdtm/static/mnt_ext_multiple.c 1970-01-01 01:00:00.000000000 +0100 +++ new/criu-3.17.1/test/zdtm/static/mnt_ext_multiple.c 2022-06-23 23:53:25.000000000 +0200 @@ -0,0 +1,118 @@ +#include <sched.h> +#include <sys/mount.h> +#include <sys/stat.h> +#include <linux/limits.h> + +#include "zdtmtst.h" + +const char *test_doc = "Check multiple non-common root external mounts with same external master"; +const char *test_author = "Pavel Tikhomirov <[email protected]>"; + +char *dirname = "mnt_ext_multiple.test"; +char *source = "zdtm_ext_multiple"; +char *ext_source = "zdtm_ext_multiple.ext"; +TEST_OPTION(dirname, string, "directory name", 1); + +int main(int argc, char **argv) +{ + char *root, testdir[PATH_MAX]; + char dst_a[PATH_MAX], dst_b[PATH_MAX]; + char src[PATH_MAX], src_a[PATH_MAX], src_b[PATH_MAX]; + char nsdst_a[PATH_MAX], nsdst_b[PATH_MAX]; + char *tmp = "/tmp/zdtm_ext_multiple.tmp"; + char *zdtm_newns = getenv("ZDTM_NEWNS"); + + root = getenv("ZDTM_ROOT"); + if (root == NULL) { + pr_perror("root"); + return 1; + } + + if (!zdtm_newns) { + pr_perror("ZDTM_NEWNS is not set"); + return 1; + } else if (strcmp(zdtm_newns, "1")) { + goto test; + } + + /* Prepare directories in test root */ + sprintf(testdir, "%s/%s", root, dirname); + mkdir(testdir, 0755); + sprintf(dst_a, "%s/%s/dst_a", root, dirname); + mkdir(dst_a, 0755); + sprintf(dst_b, "%s/%s/dst_b", root, dirname); + mkdir(dst_b, 0755); + + /* Prepare directories in criu root */ + mkdir(tmp, 0755); + if (mount(source, tmp, "tmpfs", 0, NULL)) { + pr_perror("mount tmpfs"); + return 1; + } + if (mount(NULL, tmp, NULL, MS_PRIVATE, NULL)) { + pr_perror("make private"); + return 1; + } + sprintf(src, "%s/src", tmp); + mkdir(src, 0755); + + /* Create a shared mount in criu mntns */ + if (mount(ext_source, src, "tmpfs", 0, NULL)) { + pr_perror("mount tmpfs"); + return 1; + } + if (mount(NULL, src, NULL, MS_PRIVATE, NULL)) { + pr_perror("make private"); + return 1; + } + if (mount(NULL, src, NULL, MS_SHARED, NULL)) { + pr_perror("make shared"); + return 1; + } + + /* + * Create temporary mntns, next mounts will not show up in criu mntns + */ + if (unshare(CLONE_NEWNS)) { + pr_perror("unshare"); + return 1; + } + + /* + * Populate to the tests root subdirectories of the src mount + */ + sprintf(src_a, "%s/src/a", tmp); + mkdir(src_a, 0755); + if (mount(src_a, dst_a, NULL, MS_BIND, NULL)) { + pr_perror("bind"); + return 1; + } + sprintf(src_b, "%s/src/b", tmp); + mkdir(src_b, 0755); + if (mount(src_b, dst_b, NULL, MS_BIND, NULL)) { + pr_perror("bind"); + return 1; + } + +test: + test_init(argc, argv); + + /* Make "external" mounts to have external master */ + sprintf(nsdst_a, "/%s/dst_a", dirname); + if (mount(NULL, nsdst_a, NULL, MS_SLAVE, NULL)) { + pr_perror("make slave"); + return 1; + } + sprintf(nsdst_b, "/%s/dst_b", dirname); + if (mount(NULL, nsdst_b, NULL, MS_SLAVE, NULL)) { + pr_perror("make slave"); + return 1; + } + + test_daemon(); + test_waitsig(); + + pass(); + + return 0; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/criu-3.17/test/zdtm/static/mnt_ext_multiple.desc new/criu-3.17.1/test/zdtm/static/mnt_ext_multiple.desc --- old/criu-3.17/test/zdtm/static/mnt_ext_multiple.desc 1970-01-01 01:00:00.000000000 +0100 +++ new/criu-3.17.1/test/zdtm/static/mnt_ext_multiple.desc 2022-06-23 23:53:25.000000000 +0200 @@ -0,0 +1,5 @@ +{ 'dopts': '--external mnt[/mnt_ext_multiple.test/dst_a]:MNT_A --external mnt[/mnt_ext_multiple.test/dst_b]:MNT_B', + 'feature': 'mnt_id move_mount_set_group', + 'flavor': 'ns uns', + 'flags': 'suid', + 'ropts': '--external mnt[MNT_A]:/tmp/zdtm_ext_multiple.tmp/src/a --external mnt[MNT_B]:/tmp/zdtm_ext_multiple.tmp/src/b --no-mntns-compat-mode'} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/criu-3.17/test/zdtm/static/mnt_root_ext.c new/criu-3.17.1/test/zdtm/static/mnt_root_ext.c --- old/criu-3.17/test/zdtm/static/mnt_root_ext.c 1970-01-01 01:00:00.000000000 +0100 +++ new/criu-3.17.1/test/zdtm/static/mnt_root_ext.c 2022-06-23 23:53:25.000000000 +0200 @@ -0,0 +1,79 @@ +#include <sched.h> +#include <sys/mount.h> +#include <sys/stat.h> +#include <linux/limits.h> + +#include "zdtmtst.h" + +const char *test_doc = "Check external mount from host's rootfs"; +const char *test_author = "Pavel Tikhomirov <[email protected]>"; + +char *dirname = "mnt_root_ext.test"; +TEST_OPTION(dirname, string, "directory name", 1); + +int main(int argc, char **argv) +{ + char *root, testdir[PATH_MAX], nstestdir[PATH_MAX]; + char *zdtm_newns = getenv("ZDTM_NEWNS"); + char tmp[] = "/.zdtm_root_ext.tmp"; + + root = getenv("ZDTM_ROOT"); + if (root == NULL) { + pr_perror("root"); + return 1; + } + + if (!zdtm_newns) { + pr_perror("ZDTM_NEWNS is not set"); + return 1; + } else if (strcmp(zdtm_newns, "1")) { + goto test; + } + + /* Prepare directories in test root */ + sprintf(testdir, "%s/%s", root, dirname); + mkdir(testdir, 0755); + + /* Prepare directories in criu root */ + mkdir(tmp, 0755); + + /* Make criu's mntns root mount shared */ + if (mount(NULL, "/", NULL, MS_SHARED, NULL)) { + pr_perror("make shared"); + return 1; + } + + /* + * Create temporary mntns, next mounts will not show up in criu mntns + */ + if (unshare(CLONE_NEWNS)) { + pr_perror("unshare"); + return 1; + } + + /* + * Populate to the tests root host's rootfs subdir + */ + if (mount(tmp, testdir, NULL, MS_BIND, NULL)) { + pr_perror("bind"); + return 1; + } +test: + test_init(argc, argv); + + /* + * Make "external" mount to be slave + */ + sprintf(nstestdir, "/%s", dirname); + if (mount(NULL, nstestdir, NULL, MS_SLAVE, NULL)) { + pr_perror("make slave"); + return 1; + } + + test_daemon(); + test_waitsig(); + + pass(); + + return 0; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/criu-3.17/test/zdtm/static/mnt_root_ext.desc new/criu-3.17.1/test/zdtm/static/mnt_root_ext.desc --- old/criu-3.17/test/zdtm/static/mnt_root_ext.desc 1970-01-01 01:00:00.000000000 +0100 +++ new/criu-3.17.1/test/zdtm/static/mnt_root_ext.desc 2022-06-23 23:53:25.000000000 +0200 @@ -0,0 +1,5 @@ +{ 'dopts': '--external mnt[/mnt_root_ext.test]:MNT', + 'feature': 'mnt_id move_mount_set_group', + 'flavor': 'ns uns', + 'flags': 'suid', + 'ropts': '--external mnt[MNT]:.zdtm_root_ext.tmp --no-mntns-compat-mode'} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/criu-3.17/test/zdtm/static/mnt_root_ext.hook new/criu-3.17.1/test/zdtm/static/mnt_root_ext.hook --- old/criu-3.17/test/zdtm/static/mnt_root_ext.hook 1970-01-01 01:00:00.000000000 +0100 +++ new/criu-3.17.1/test/zdtm/static/mnt_root_ext.hook 2022-06-23 23:53:25.000000000 +0200 @@ -0,0 +1,5 @@ +#!/bin/bash + +[ "$1" == "--clean" ] || exit 0 + +rmdir /.zdtm_root_ext.tmp ++++++ criu-amdgpu-plugin-fix.patch ++++++ --- /var/tmp/diff_new_pack.lKytGL/_old 2022-08-11 18:32:54.742235167 +0200 +++ /var/tmp/diff_new_pack.lKytGL/_new 2022-08-11 18:32:54.746235161 +0200 @@ -1,12 +1,12 @@ --- - plugins/amdgpu/Makefile | 9 +++++---- + plugins/amdgpu/Makefile | 3 ++- plugins/amdgpu/kfd_ioctl.h | 2 +- - 2 files changed, 6 insertions(+), 5 deletions(-) + 2 files changed, 3 insertions(+), 2 deletions(-) --- a/plugins/amdgpu/Makefile +++ b/plugins/amdgpu/Makefile @@ -5,7 +5,8 @@ PLUGIN_SOBJ := amdgpu_plugin.so - PLUGIN_INCLUDE := -iquote../../../criu/include + PLUGIN_INCLUDE := -iquote../../include PLUGIN_INCLUDE += -iquote../../criu/include PLUGIN_INCLUDE += -iquote../../criu/arch/$(ARCH)/include/ -PLUGIN_INCLUDE += -iquote../../ @@ -15,26 +15,6 @@ COMPEL := ../../compel/compel-host LIBDRM_INC := -I/usr/include/libdrm -@@ -50,16 +51,16 @@ clean: amdgpu_plugin_clean amdgpu_plugin - mrproper: clean - - install: -- $(Q) mkdir -p $(PLUGINDIR) -+ $(Q) mkdir -p $(DESTDIR)$(PLUGINDIR) - ifeq ($(CONFIG_AMDGPU),y) - $(E) " INSTALL " $(PLUGIN_NAME) -- $(Q) install -m 644 $(PLUGIN_SOBJ) $(PLUGINDIR) -+ $(Q) install -m 644 $(PLUGIN_SOBJ) $(DESTDIR)$(PLUGINDIR) - endif - .PHONY: install - - uninstall: - ifeq ($(CONFIG_AMDGPU),y) - $(E) " UNINSTALL" $(PLUGIN_NAME) -- $(Q) $(RM) $(PLUGINDIR)/$(PLUGIN_SOBJ) -+ $(Q) $(RM) $(DESTDIR)$(PLUGINDIR)/$(PLUGIN_SOBJ) - endif - .PHONY: uninstall --- a/plugins/amdgpu/kfd_ioctl.h +++ b/plugins/amdgpu/kfd_ioctl.h @@ -23,7 +23,7 @@ ++++++ plugin-dir-path.patch ++++++ --- /var/tmp/diff_new_pack.lKytGL/_old 2022-08-11 18:32:54.762235136 +0200 +++ /var/tmp/diff_new_pack.lKytGL/_new 2022-08-11 18:32:54.766235130 +0200 @@ -13,22 +13,22 @@ +LIBDIR ?= $(PREFIX)/lib LIBEXECDIR ?= $(PREFIX)/libexec RUNDIR ?= /run --PLUGINDIR ?= /var/lib/criu +-PLUGINDIR ?= $(PREFIX)/lib/criu +PLUGINDIR ?= $(LIBDIR)/criu # # For recent Debian/Ubuntu with multiarch support. --- a/criu/include/plugin.h +++ b/criu/include/plugin.h -@@ -5,7 +5,7 @@ - #include "common/compiler.h" +@@ -6,7 +6,7 @@ #include "common/list.h" --#define CR_PLUGIN_DEFAULT "/var/lib/criu/" + #ifndef CR_PLUGIN_DEFAULT +-#define CR_PLUGIN_DEFAULT "/usr/lib/criu/" +#define CR_PLUGIN_DEFAULT LIBDIR "/criu/" + #endif void cr_plugin_fini(int stage, int err); - int cr_plugin_init(int stage); --- a/criu/Makefile +++ b/criu/Makefile @@ -29,6 +29,9 @@ CFLAGS += -iquote $(ARCH_DIR)/include
