Hello community,

here is the log from the commit of package criu for openSUSE:Factory checked in 
at 2015-11-22 11:00:55
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/criu (Old)
 and      /work/SRC/openSUSE:Factory/.criu.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "criu"

Changes:
--------
--- /work/SRC/openSUSE:Factory/criu/criu.changes        2015-09-13 
09:45:24.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.criu.new/criu.changes   2015-11-22 
11:02:55.000000000 +0100
@@ -1,0 +2,10 @@
+Thu Nov 19 16:10:29 CET 2015 - [email protected]
+
+- update to criu 1.7.1:
+  Fixes in mounts, notifies and userns found while testing openvz
+- update to criu 1.7.2:
+  Fixes for IPC in userns, venet C/R, socket buffers overflow and
+  unix sockets name off-by-one
+- Add the package dependency on python-protobuf
+
+-------------------------------------------------------------------

Old:
----
  criu-1.7.tar.bz2

New:
----
  criu-1.7.2.tar.bz2

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ criu.spec ++++++
--- /var/tmp/diff_new_pack.CzW065/_old  2015-11-22 11:02:56.000000000 +0100
+++ /var/tmp/diff_new_pack.CzW065/_new  2015-11-22 11:02:56.000000000 +0100
@@ -17,9 +17,9 @@
 
 
 %define with_systemd_service 0
-%define package_version 1.7
+%define package_version 1.7.2
 Name:           criu
-Version:        1.7
+Version:        1.7.2
 Release:        0
 Summary:        Checkpoint/Restore In Userspace Tools
 License:        GPL-2.0
@@ -33,6 +33,7 @@
 BuildRequires:  xmlto
 BuildRequires:  pkgconfig(systemd)
 Requires:       logrotate
+Requires:       python-protobuf
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 ExclusiveArch:  x86_64 aarch64 ppc64le
 

++++++ criu-1.7.tar.bz2 -> criu-1.7.2.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/criu-1.7/Makefile new/criu-1.7.2/Makefile
--- old/criu-1.7/Makefile       2015-09-07 11:26:32.000000000 +0200
+++ new/criu-1.7.2/Makefile     2015-10-28 08:30:29.000000000 +0100
@@ -1,6 +1,6 @@
 VERSION_MAJOR          := 1
 VERSION_MINOR          := 7
-VERSION_SUBLEVEL       :=
+VERSION_SUBLEVEL       := 2
 VERSION_EXTRA          :=
 VERSION_NAME           :=
 VERSION_SO_MAJOR       := 1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/criu-1.7/cr-restore.c new/criu-1.7.2/cr-restore.c
--- old/criu-1.7/cr-restore.c   2015-09-07 11:26:32.000000000 +0200
+++ new/criu-1.7.2/cr-restore.c 2015-10-28 08:30:29.000000000 +0100
@@ -1915,9 +1915,15 @@
         * otherwise an external proccesses can be killed.
         */
        if (root_ns_mask & CLONE_NEWPID) {
+               int status;
+
                /* Kill init */
                if (root_item->pid.real > 0)
                        kill(root_item->pid.real, SIGKILL);
+
+               if (waitpid(root_item->pid.real, &status, 0) < 0)
+                       pr_warn("Unable to wait %d: %s",
+                               root_item->pid.real, strerror(errno));
        } else {
                struct pstree_item *pi;
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/criu-1.7/fsnotify.c new/criu-1.7.2/fsnotify.c
--- old/criu-1.7/fsnotify.c     2015-09-07 11:26:32.000000000 +0200
+++ new/criu-1.7.2/fsnotify.c   2015-10-28 08:30:29.000000000 +0100
@@ -107,6 +107,90 @@
        return sys_open_by_handle_at(fd, arg, O_PATH);
 }
 
+static char *alloc_openable(unsigned int s_dev, unsigned long i_ino, FhEntry 
*f_handle)
+{
+       struct mount_info *m;
+       fh_t handle;
+       int fd = -1;
+       char *path;
+
+       decode_handle(&handle, f_handle);
+
+       /*
+        * We gonna try to open the handle and then
+        * depending on command line options and type
+        * of the filesystem (tmpfs/devtmpfs do not
+        * preserve their inodes between mounts) we
+        * might need to find out an openable path
+        * get used on restore as a watch destination.
+        */
+       for (m = mntinfo; m; m = m->next) {
+               char buf[PATH_MAX], *__path;
+               int mntfd, openable_fd;
+               struct stat st;
+
+               if (m->s_dev != s_dev)
+                       continue;
+
+               mntfd = __open_mountpoint(m, -1);
+               pr_debug("\t\tTrying via mntid %d root %s ns_mountpoint @%s 
(%d)\n",
+                        m->mnt_id, m->root, m->ns_mountpoint, mntfd);
+               if (mntfd < 0)
+                       continue;
+
+               fd = userns_call(open_by_handle, UNS_FDOUT, &handle,
+                                sizeof(handle), mntfd);
+               close(mntfd);
+               if (fd < 0)
+                       continue;
+
+               if (read_fd_link(fd, buf, sizeof(buf)) < 0) {
+                       close(fd);
+                       goto err;
+               }
+               close(fd);
+
+               /*
+                * Convert into a relative path.
+                */
+               __path = (buf[1] != '\0') ? buf + 1 : ".";
+               pr_debug("\t\t\tlink as %s\n", __path);
+
+               mntfd = mntns_get_root_fd(m->nsid);
+               if (mntfd < 0)
+                       goto err;
+
+               openable_fd = openat(mntfd, __path, O_PATH);
+               if (openable_fd >= 0) {
+                       if (fstat(openable_fd, &st)) {
+                               pr_perror("Can't stat on %s\n", __path);
+                               close(openable_fd);
+                               return ERR_PTR(-errno);
+                       }
+                       close(openable_fd);
+
+                       pr_debug("\t\t\topenable (inode %s) as %s\n",
+                                st.st_ino == i_ino ?
+                                "match" : "don't match", __path);
+
+                       if (st.st_ino == i_ino) {
+                               path = xstrdup(buf);
+                               if (path == NULL)
+                                       goto err;
+
+                               f_handle->has_mnt_id = true;
+                               f_handle->mnt_id = m->mnt_id;
+                               return path;
+                       }
+               } else
+                       pr_debug("\t\t\tnot openable as %s (%m)\n", __path);
+       }
+
+       return ERR_PTR(-ENOENT);
+err:
+       return ERR_PTR(-1);
+}
+
 static int open_handle(unsigned int s_dev, unsigned long i_ino,
                FhEntry *f_handle)
 {
@@ -160,15 +244,12 @@
                 */
                if ((mi->fstype->code == FSTYPE__TMPFS) ||
                                (mi->fstype->code == FSTYPE__DEVTMPFS)) {
-                       char p[PATH_MAX];
-
-                       if (read_fd_link(fd, p, sizeof(p)) < 0)
-                               goto err;
-
-                       path = xstrdup(p);
-                       if (path == NULL)
+                       path = alloc_openable(s_dev, i_ino, f_handle);
+                       if (IS_ERR_OR_NULL(path)) {
+                               pr_err("Can't find suitable path for handle 
(%d)\n",
+                                      (int)PTR_ERR(path));
                                goto err;
-
+                       }
                        goto out;
                }
 
@@ -426,12 +507,19 @@
                *target = openat(mntns_root, remap->path, O_PATH);
        } else if (f_handle->path) {
                int  mntns_root;
+               char *path = ".";
+               uint32_t mnt_id = f_handle->has_mnt_id ? f_handle->mnt_id : -1;
+
 
                /* irmap cache is collected in the root namespaces. */
-               mntns_root = mntns_get_root_by_mnt_id(-1);
+               mntns_root = mntns_get_root_by_mnt_id(mnt_id);
+
+               /* change "/foo" into "foo" and "/" into "." */
+               if (f_handle->path[1] != '\0')
+                       path = f_handle->path + 1;
 
-               pr_debug("\t\tRestore with path hint %s\n", f_handle->path);
-               *target = openat(mntns_root, f_handle->path, O_PATH);
+               pr_debug("\t\tRestore with path hint %d:%s\n", mnt_id, path);
+               *target = openat(mntns_root, path, O_PATH);
        } else
                *target = open_handle(s_dev, i_ino, f_handle);
 
@@ -524,9 +612,9 @@
 
                mntns_root = mntns_get_root_fd(m->nsid);
 
-               target = openat(mntns_root, m->mountpoint, O_PATH);
+               target = openat(mntns_root, m->ns_mountpoint, O_PATH);
                if (target == -1) {
-                       pr_perror("Unable to open %s", m->mountpoint);
+                       pr_perror("Unable to open %s", m->ns_mountpoint);
                        goto err;
                }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/criu-1.7/include/mount.h 
new/criu-1.7.2/include/mount.h
--- old/criu-1.7/include/mount.h        2015-09-07 11:26:32.000000000 +0200
+++ new/criu-1.7.2/include/mount.h      2015-10-28 08:30:29.000000000 +0100
@@ -94,6 +94,7 @@
 extern struct ns_id *lookup_nsid_by_mnt_id(int mnt_id);
 
 extern int open_mount(unsigned int s_dev);
+extern int __open_mountpoint(struct mount_info *pm, int mnt_fd);
 extern struct fstype *find_fstype_by_name(char *fst);
 extern bool add_fsname_auto(const char *names);
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/criu-1.7/ipc_ns.c new/criu-1.7.2/ipc_ns.c
--- old/criu-1.7/ipc_ns.c       2015-09-07 11:26:32.000000000 +0200
+++ new/criu-1.7.2/ipc_ns.c     2015-10-28 08:30:29.000000000 +0100
@@ -47,10 +47,10 @@
 {
        desc->id = id;
        desc->key = ipcp->KEY;
-       desc->uid = ipcp->uid;
-       desc->gid = ipcp->gid;
-       desc->cuid = ipcp->cuid;
-       desc->cgid = ipcp->cgid;
+       desc->uid = userns_uid(ipcp->uid);
+       desc->gid = userns_gid(ipcp->gid);
+       desc->cuid = userns_uid(ipcp->cuid);
+       desc->cgid = userns_gid(ipcp->cgid);
        desc->mode = ipcp->mode;
 }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/criu-1.7/mount.c new/criu-1.7.2/mount.c
--- old/criu-1.7/mount.c        2015-09-07 11:26:32.000000000 +0200
+++ new/criu-1.7.2/mount.c      2015-10-28 08:30:29.000000000 +0100
@@ -982,7 +982,7 @@
  * mnt_fd is a file descriptor on the mountpoint, which is closed in an error 
case.
  * If mnt_fd is -1, the mountpoint will be opened by this function.
  */
-static int __open_mountpoint(struct mount_info *pm, int mnt_fd)
+int __open_mountpoint(struct mount_info *pm, int mnt_fd)
 {
        dev_t dev;
        struct stat st;
@@ -995,23 +995,23 @@
                if (mntns_root < 0)
                        return -1;
 
-               mnt_fd = openat(mntns_root, pm->mountpoint, O_RDONLY);
+               mnt_fd = openat(mntns_root, pm->ns_mountpoint, O_RDONLY);
                if (mnt_fd < 0) {
-                       pr_perror("Can't open %s", pm->mountpoint);
+                       pr_perror("Can't open %s", pm->ns_mountpoint);
                        return -1;
                }
        }
 
        ret = fstat(mnt_fd, &st);
        if (ret < 0) {
-               pr_perror("fstat(%s) failed", pm->mountpoint);
+               pr_perror("fstat(%s) failed", pm->ns_mountpoint);
                goto err;
        }
 
-       dev = phys_stat_resolve_dev(pm->nsid, st.st_dev, pm->mountpoint + 1);
+       dev = phys_stat_resolve_dev(pm->nsid, st.st_dev, pm->ns_mountpoint + 1);
        if (dev != pm->s_dev) {
                pr_err("The file system %#x (%#x) %s %s is inaccessible\n",
-                               pm->s_dev, (int)dev, pm->fstype->name, 
pm->mountpoint);
+                      pm->s_dev, (int)dev, pm->fstype->name, 
pm->ns_mountpoint);
                goto err;
        }
 
@@ -2068,14 +2068,27 @@
        /* The root mount */
        if (!mi->parent)
                return true;
-       if (mi->is_ns_root)
-               return true;
 
        if (mi->external)
                return true;
 
-       if (mi->master_id && mi->bind == NULL)
-               return false;
+       /*
+        * We're the slave peer:
+        *   - Make sure the master peer is already mounted
+        *   - Make sure all children is mounted as well to
+        *     eliminame mounts duplications
+        */
+       if (mi->master_id) {
+               struct mount_info *c;
+
+               if (mi->bind == NULL)
+                       return false;
+
+               list_for_each_entry(c, &mi->bind->children, siblings) {
+                       if (!c->mounted)
+                               return false;
+               }
+       }
 
        if (!fsroot_mounted(mi) && (mi->bind == NULL && !mi->need_plugin && 
!mi->external))
                return false;
@@ -2092,9 +2105,6 @@
                        list_for_each_entry(n, &p->mnt_share, mnt_share)
                                if (!n->mounted)
                                        return false;
-                       list_for_each_entry(n, &p->mnt_slave_list, mnt_slave)
-                               if (!n->mounted)
-                                       return false;
                }
        }
 
@@ -2527,7 +2537,8 @@
                return -1;
        }
 
-       print_ns_root(nsid, path, sizeof(path));
+       path[0] = '/';
+       print_ns_root(nsid, path + 1, sizeof(path) - 1);
        if (cr_pivot_root(path))
                return -1;
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/criu-1.7/namespaces.c new/criu-1.7.2/namespaces.c
--- old/criu-1.7/namespaces.c   2015-09-07 11:26:32.000000000 +0200
+++ new/criu-1.7.2/namespaces.c 2015-10-28 08:30:29.000000000 +0100
@@ -821,7 +821,7 @@
         */
        for (i = 0; i < n; i++)
                off += snprintf(buf + off, sizeof(buf) - off,
-                               "%d %d %d\n", extents[i]->first,
+                               "%u %u %u\n", extents[i]->first,
                                        extents[i]->lower_first,
                                        extents[i]->count);
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/criu-1.7/net.c new/criu-1.7.2/net.c
--- old/criu-1.7/net.c  2015-09-07 11:26:32.000000000 +0200
+++ new/criu-1.7.2/net.c        2015-10-28 08:30:29.000000000 +0100
@@ -243,12 +243,7 @@
                struct rtattr **tb, struct cr_imgset *fds)
 {
        if (!strcmp(kind, "venet"))
-               /*
-                * If we meet a link we know about, such as
-                * OpenVZ's venet, save general parameters of
-                * it as external link.
-                */
-               return dump_one_netdev(ND_TYPE__EXTLINK, ifi, tb, fds, NULL);
+               return dump_one_netdev(ND_TYPE__VENET, ifi, tb, fds, NULL);
 
        return dump_unknown_device(ifi, kind, tb, fds);
 }
@@ -441,6 +436,21 @@
        return 0;
 }
 
+static int venet_link_info(NetDeviceEntry *nde, struct newlink_req *req)
+{
+       struct rtattr *venet_data;
+
+       BUG_ON(ns_fd < 0);
+
+       venet_data = NLMSG_TAIL(&req->h);
+       addattr_l(&req->h, sizeof(*req), IFLA_INFO_KIND, "venet", 5);
+       addattr_l(&req->h, sizeof(*req), IFLA_INFO_DATA, NULL, 0);
+       addattr_l(&req->h, sizeof(*req), IFLA_NET_NS_FD, &ns_fd, sizeof(ns_fd));
+       venet_data->rta_len = (void *)NLMSG_TAIL(&req->h) - (void *)venet_data;
+
+       return 0;
+}
+
 static int restore_link(NetDeviceEntry *nde, int nlsk)
 {
        pr_info("Restoring link %s type %d\n", nde->name, nde->type);
@@ -449,6 +459,8 @@
        case ND_TYPE__LOOPBACK: /* fallthrough */
        case ND_TYPE__EXTLINK:  /* see comment in protobuf/netdev.proto */
                return restore_link_parms(nde, nlsk);
+       case ND_TYPE__VENET:
+               return restore_one_link(nde, nlsk, venet_link_info);
        case ND_TYPE__VETH:
                return restore_one_link(nde, nlsk, veth_link_info);
        case ND_TYPE__TUN:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/criu-1.7/proc_parse.c new/criu-1.7.2/proc_parse.c
--- old/criu-1.7/proc_parse.c   2015-09-07 11:26:32.000000000 +0200
+++ new/criu-1.7.2/proc_parse.c 2015-10-28 08:30:29.000000000 +0100
@@ -1017,6 +1017,7 @@
        new->mountpoint = xmalloc(PATH_MAX);
        if (new->mountpoint == NULL)
                goto err;
+       new->ns_mountpoint = new->mountpoint;
 
        new->mountpoint[0] = '.';
        ret = sscanf(str, "%i %i %u:%u %ms %s %ms %n",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/criu-1.7/protobuf/fh.proto 
new/criu-1.7.2/protobuf/fh.proto
--- old/criu-1.7/protobuf/fh.proto      2015-09-07 11:26:32.000000000 +0200
+++ new/criu-1.7.2/protobuf/fh.proto    2015-10-28 08:30:29.000000000 +0100
@@ -9,6 +9,7 @@
        /* The minimum is fh_n_handle repetitions */
        repeated uint64         handle  = 3;
        optional string         path    = 4;
+       optional uint32         mnt_id  = 5;
 }
 
 message irmap_cache_entry {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/criu-1.7/protobuf/netdev.proto 
new/criu-1.7.2/protobuf/netdev.proto
--- old/criu-1.7/protobuf/netdev.proto  2015-09-07 11:26:32.000000000 +0200
+++ new/criu-1.7.2/protobuf/netdev.proto        2015-10-28 08:30:29.000000000 
+0100
@@ -12,6 +12,10 @@
         * by the setup-namespaces script.
         */
        EXTLINK         = 4;
+       /*
+        * Virtuozzo specific device.
+        */
+       VENET           = 5;
 }
 
 message net_device_entry {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/criu-1.7/seize.c new/criu-1.7.2/seize.c
--- old/criu-1.7/seize.c        2015-09-07 11:26:32.000000000 +0200
+++ new/criu-1.7.2/seize.c      2015-10-28 08:30:29.000000000 +0100
@@ -1,6 +1,7 @@
 #include <stdbool.h>
 #include <stdlib.h>
 #include <sys/types.h>
+#include <sys/stat.h>
 #include <unistd.h>
 #include <sys/time.h>
 #include <sys/resource.h>
@@ -141,6 +142,14 @@
                                continue;
 
                        if (seize_catch_task(pid) && state == frozen) {
+                               char buf[] = "/proc/XXXXXXXXXX/exe";
+                               struct stat st;
+
+                               /* skip kernel threads */
+                               snprintf(buf, sizeof(buf), "/proc/%d/exe", pid);
+                               if (stat(buf, &st) == -1 && errno == ENOENT)
+                                       continue;
+
                                /* fails when meets a zombie */
                                fclose(f);
                                goto err;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/criu-1.7/sk-unix.c new/criu-1.7.2/sk-unix.c
--- old/criu-1.7/sk-unix.c      2015-09-07 11:26:32.000000000 +0200
+++ new/criu-1.7.2/sk-unix.c    2015-10-28 08:30:29.000000000 +0100
@@ -825,16 +825,36 @@
        return 0;
 }
 
-static int prep_unix_sk_cwd(struct unix_sk_info *ui)
+static void revert_unix_sk_cwd(int *prev_cwd_fd)
+{
+       if (prev_cwd_fd && *prev_cwd_fd >= 0) {
+               if (fchdir(*prev_cwd_fd))
+                       pr_perror("Can't revert working dir");
+               else
+                       pr_debug("Reverted working dir\n");
+               close(*prev_cwd_fd);
+               *prev_cwd_fd = -1;
+       }
+}
+
+static int prep_unix_sk_cwd(struct unix_sk_info *ui, int *prev_cwd_fd)
 {
        if (ui->name_dir) {
+               *prev_cwd_fd = open(".", O_RDONLY);
+               if (*prev_cwd_fd < 0) {
+                       pr_err("Can't open current dir\n");
+                       return -1;
+               }
                if (chdir(ui->name_dir)) {
                        pr_perror("Can't change working dir %s\n",
                                  ui->name_dir);
+                       close(*prev_cwd_fd);
+                       *prev_cwd_fd = -1;
                        return -1;
                }
                pr_debug("Change working dir to %s\n", ui->name_dir);
-       }
+       } else
+               *prev_cwd_fd = -1;
        return 0;
 }
 
@@ -843,6 +863,7 @@
        struct unix_sk_info *ui;
        struct unix_sk_info *peer;
        struct sockaddr_un addr;
+       int cwd_fd = -1;
 
        ui = container_of(d, struct unix_sk_info, d);
        if (ui->flags & (USK_PAIR_MASTER | USK_PAIR_SLAVE))
@@ -869,16 +890,19 @@
 
        pr_info("\tConnect %#x to %#x\n", ui->ue->ino, peer->ue->ino);
 
-       if (prep_unix_sk_cwd(peer))
+       if (prep_unix_sk_cwd(peer, &cwd_fd))
                return -1;
 
        if (connect(fd, (struct sockaddr *)&addr,
                                sizeof(addr.sun_family) +
                                peer->ue->name.len) < 0) {
+               revert_unix_sk_cwd(&cwd_fd);
                pr_perror("Can't connect %#x socket", ui->ue->ino);
                return -1;
        }
 
+       revert_unix_sk_cwd(&cwd_fd);
+
        if (peer->queuer == ui->ue->ino && restore_sk_queue(fd, peer->ue->id))
                return -1;
 
@@ -897,8 +921,10 @@
 static int bind_unix_sk(int sk, struct unix_sk_info *ui)
 {
        struct sockaddr_un addr;
+       int cwd_fd = -1;
+       int ret = -1;
 
-       if ((ui->ue->type == SOCK_STREAM) && (ui->ue->state == TCP_ESTABLISHED))
+       if ((ui->ue->type == SOCK_STREAM) && (ui->ue->state == 
TCP_ESTABLISHED)) {
                /*
                 * FIXME this can be done, but for doing this properly we
                 * need to bind socket to its name, then rename one to
@@ -906,19 +932,21 @@
                 * restored we should walk those temp names and rename
                 * some of them back to real ones.
                 */
+               ret = 0;
                goto done;
+       }
 
        memset(&addr, 0, sizeof(addr));
        addr.sun_family = AF_UNIX;
        memcpy(&addr.sun_path, ui->name, ui->ue->name.len);
 
-       if (prep_unix_sk_cwd(ui))
+       if (prep_unix_sk_cwd(ui, &cwd_fd))
                return -1;
 
        if (bind(sk, (struct sockaddr *)&addr,
                                sizeof(addr.sun_family) + ui->ue->name.len)) {
                pr_perror("Can't bind socket");
-               return -1;
+               goto done;
        }
 
        if (ui->ue->name.len && *ui->name && ui->ue->file_perms) {
@@ -927,7 +955,7 @@
 
                if (ui->ue->name.len >= sizeof(fname)) {
                        pr_err("The file name is too long\n");
-                       return -1;
+                       goto done;
                }
 
                memcpy(fname, ui->name, ui->ue->name.len);
@@ -935,19 +963,22 @@
 
                if (fchownat(AT_FDCWD, fname, perms->uid, perms->gid, 0) == -1) 
{
                        pr_perror("Unable to change file owner and group");
-                       return -1;
+                       goto done;
                }
 
                if (fchmodat(AT_FDCWD, fname, perms->mode, 0) == -1) {
                        pr_perror("Unable to change file mode bits");
-                       return -1;
+                       goto done;
                }
        }
 
        if (ui->ue->state != TCP_LISTEN)
                futex_set_and_wake(&ui->prepared, 1);
+
+       ret = 0;
 done:
-       return 0;
+       revert_unix_sk_cwd(&cwd_fd);
+       return ret;
 }
 
 static int unixsk_should_open_transport(FdinfoEntry *fe,
@@ -1198,13 +1229,18 @@
  */
 static int unlink_stale(struct unix_sk_info *ui)
 {
+       int ret, cwd_fd;
+
        if (ui->name[0] == '\0' || (ui->ue->uflags & USK_EXTERN))
                return 0;
 
-       if (prep_unix_sk_cwd(ui))
+       if (prep_unix_sk_cwd(ui, &cwd_fd))
                return -1;
 
-       return unlinkat(AT_FDCWD, ui->name, 0) ? -1 : 0;
+       ret = unlinkat(AT_FDCWD, ui->name, 0) ? -1 : 0;
+       revert_unix_sk_cwd(&cwd_fd);
+
+       return ret;
 }
 
 static int collect_one_unixsk(void *o, ProtobufCMessage *base)
@@ -1215,7 +1251,7 @@
        ui->name_dir = (void *)ui->ue->name_dir;
 
        if (ui->ue->name.len) {
-               if (ui->ue->name.len >= UNIX_PATH_MAX) {
+               if (ui->ue->name.len > UNIX_PATH_MAX) {
                        pr_err("Bad unix name len %d\n", (int)ui->ue->name.len);
                        return -1;
                }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/criu-1.7/sockets.c new/criu-1.7.2/sockets.c
--- old/criu-1.7/sockets.c      2015-09-07 11:26:32.000000000 +0200
+++ new/criu-1.7.2/sockets.c    2015-10-28 08:30:29.000000000 +0100
@@ -419,7 +419,8 @@
 {
        int ret = 0, val;
        struct timeval tv;
-       u32 bufs[2] = { soe->so_sndbuf, soe->so_rcvbuf };
+       /* In kernel a bufsize value is doubled. */
+       u32 bufs[2] = { soe->so_sndbuf / 2, soe->so_rcvbuf / 2};
 
        pr_info("%d restore sndbuf %d rcv buf %d\n", sk, soe->so_sndbuf, 
soe->so_rcvbuf);
 


Reply via email to