[CRIU] [PATCH] sk-unix: set mntinfo

Christian Brauner christian.brauner at canonical.com
Wed Sep 7 07:29:48 PDT 2016


phys_stat_resolve() call mount_resolve_path() which requires that mntinfo_tree
in the ns_id struct is initialized. This is a problem we observed with sockets
on btrfs volumes:

 Program received signal SIGSEGV, Segmentation fault.
 0x00005555555bb6dd in mount_resolve_path (mntinfo_tree=<optimized out>, path=0x555555875790 "/var/lib/lxd/unix.socket") at criu/mount.c:213
 213     criu/mount.c: No such file or directory.
 (gdb) bt
 #0  0x00005555555bb6dd in mount_resolve_path (mntinfo_tree=<optimized out>, path=0x555555875790 "/var/lib/lxd/unix.socket") at criu/mount.c:213
 #1  0x00005555555be240 in phys_stat_resolve_dev (ns=<optimized out>, st_dev=43, path=<optimized out>) at criu/mount.c:240
 #2  0x00005555555be2bb in phys_stat_dev_match (st_dev=<optimized out>, phys_dev=41, ns=ns at entry=0x5555558753a0,
     path=path at entry=0x555555875790 "/var/lib/lxd/unix.socket") at criu/mount.c:256
 #3  0x00005555555e75ed in unix_process_name (d=d at entry=0x5555558756e0, tb=tb at entry=0x7fffffffe0c0, m=<optimized out>) at criu/sk-unix.c:565
 #4  0x00005555555e9378 in unix_collect_one (tb=0x7fffffffe0c0, m=0x555555869f18 <buf+312>) at criu/sk-unix.c:620
 #5  unix_receive_one (h=0x555555869f08 <buf+296>, arg=<optimized out>) at criu/sk-unix.c:692
 #6  0x00005555555b85aa in nlmsg_receive (buf=<optimized out>, arg=<optimized out>, err_cb=<optimized out>, cb=<optimized out>, len=<optimized out>)
     at criu/libnetlink.c:45
 #7  do_rtnl_req (nl=nl at entry=5, req=req at entry=0x7fffffffe220, size=size at entry=72, receive_callback=0x5555555e9290 <unix_receive_one>,
     error_callback=0x5555555b83d0 <rtnl_return_err>, error_callback at entry=0x0, arg=arg at entry=0x0) at criu/libnetlink.c:119
 #8  0x00005555555e9cf7 in do_collect_req (nl=nl at entry=5, req=req at entry=0x7fffffffe220, receive_callback=<optimized out>, arg=arg at entry=0x0, size=72)
     at criu/sockets.c:610
 #9  0x00005555555eb1d0 in collect_sockets (ns=ns at entry=0x7fffffffe300) at criu/sockets.c:636
 #10 0x000055555559ddfc in check_sock_diag () at criu/cr-check.c:118
 #11 cr_check () at criu/cr-check.c:999
 #12 0x00005555555872d0 in main (argc=<optimized out>, argv=0x7fffffffe678, envp=<optimized out>) at criu/crtools.c:719

Signed-off-by: Christian Brauner <christian.brauner at canonical.com>
---
 criu/sk-unix.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/criu/sk-unix.c b/criu/sk-unix.c
index 99f0b08..a199ca4 100644
--- a/criu/sk-unix.c
+++ b/criu/sk-unix.c
@@ -525,6 +525,7 @@ static int unix_process_name(struct unix_sk_desc *d, const struct unix_diag_msg
 			ret = -ENOENT;
 			goto out;
 		}
+		ns->mnt.mntinfo_tree = mntinfo;
 
 		mntns_root = mntns_get_root_fd(ns);
 		if (mntns_root < 0) {
-- 
2.9.3



More information about the CRIU mailing list