[CRIU] [PATCH 11/17] userns: restore per-namespace mappings of user and group IDs (v2)

Pavel Emelyanov xemul at parallels.com
Thu Nov 6 03:45:01 PST 2014


> @@ -1416,6 +1426,10 @@ static int restore_task_with_children(void *_arg)
>  		if (restore_finish_stage(CR_STATE_RESTORE_NS) < 0)
>  			goto err;
>  
> +		/* UID and GID must be set after restoring /proc/PID/{uid,gid}_maps */
> +		if ((ca->clone_flags & CLONE_NEWUSER) && init_userns_creads())

s/creads/creds/

Can we have this call inside the subsequent prepare_namespaces()?

> +			goto err_fini_mnt;
> +
>  		if (prepare_namespace(current, ca->clone_flags))
>  			goto err_fini_mnt;
>  
> @@ -1713,6 +1727,9 @@ static int restore_root_task(struct pstree_item *init)
>  		}
>  	}
>  
> +	if ((root_ns_mask & CLONE_NEWUSER) && prepare_userns(init))

Plz, add a comment that we need to prepare userns preparation _outsize_
and this should happen _before_ the init_userns_creads().

> +		goto out;
> +
>  	pr_info("Wait until namespaces are created\n");
>  	ret = restore_wait_inprogress_tasks();
>  	if (ret)



More information about the CRIU mailing list