Skip to content

Commit 5988ec5

Browse files
avaginxemul
authored andcommitted
cr-check: fill up a root task mount namespace
A root mount namespace list is used to resolve paths to unix sockets if they are placed on btrfs. This patch fixes a crash: #0 mount_resolve_path at criu/mount.c:213 #1 phys_stat_resolve_dev at criu/mount.c:240 #2 phys_stat_dev_match at criu/mount.c:256 #3 unix_process_name at criu/sk-unix.c:565 #4 unix_collect_one at criu/sk-unix.c:620 #5 unix_receive_one at criu/sk-unix.c:692 #6 nlmsg_receive at criu/libnetlink.c:45 #7 do_rtnl_req at criu/libnetlink.c:119 #8 do_collect_req at criu/sockets.c:610 #9 collect_sockets at criu/sockets.c:636 travis-ci: success for cr-check: fill up a root task mount namespace https://bugzilla.redhat.com/show_bug.cgi?id=1381351 Signed-off-by: Andrei Vagin <[email protected]> Signed-off-by: Pavel Emelyanov <[email protected]>
1 parent ead54d4 commit 5988ec5

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

criu/cr-check.c

+5-3
Original file line numberDiff line numberDiff line change
@@ -1017,7 +1017,7 @@ static int (*chk_feature)(void);
10171017
} while (0)
10181018
int cr_check(void)
10191019
{
1020-
struct ns_id ns = { .type = NS_CRIU, .ns_pid = PROC_SELF, .nd = &mnt_ns_desc };
1020+
struct ns_id *ns;
10211021
int ret = 0;
10221022

10231023
if (!is_root_user())
@@ -1032,9 +1032,11 @@ int cr_check(void)
10321032
if (collect_pstree_ids())
10331033
return -1;
10341034

1035-
ns.id = root_item->ids->mnt_ns_id;
1035+
ns = lookup_ns_by_id(root_item->ids->mnt_ns_id, &mnt_ns_desc);
1036+
if (ns == NULL)
1037+
return -1;
10361038

1037-
mntinfo = collect_mntinfo(&ns, false);
1039+
mntinfo = collect_mntinfo(ns, false);
10381040
if (mntinfo == NULL)
10391041
return -1;
10401042

0 commit comments

Comments
 (0)