[CRIU] [PATCH v4 13/31] ns: Set pointer to root_user_ns in ns_ids

Kirill Tkhai ktkhai at virtuozzo.com
Wed Feb 22 03:32:25 PST 2017


Old type images do not have pointer to user_ns.
Set them manually.

Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 criu/namespaces.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/criu/namespaces.c b/criu/namespaces.c
index a3e5dfce1..7e7a430b6 100644
--- a/criu/namespaces.c
+++ b/criu/namespaces.c
@@ -1681,6 +1681,7 @@ static int do_read_old_user_ns_img(struct ns_id *ns, void *arg)
 static int read_old_user_ns_img(void)
 {
 	int ret, count = 0;
+	struct ns_id *ns;
 
 	if (!(root_ns_mask & CLONE_NEWUSER))
 		return 0;
@@ -1689,8 +1690,13 @@ static int read_old_user_ns_img(void)
 		return 0;
 	/* Old format img is only for root_user_ns. More or less is error */
 	ret = walk_namespaces(&user_ns_desc, do_read_old_user_ns_img, &count);
+	if (ret < 0)
+		return -1;
 
-	return ret;
+	for (ns = ns_ids; ns != NULL; ns = ns->next)
+		if (ns->nd != &user_ns_desc)
+			ns->user_ns = root_user_ns;
+	return 0;
 }
 
 int prepare_userns(struct pstree_item *item)



More information about the CRIU mailing list