[CRIU] [PATCH] mnt: Don't validate mounts on pre-dump

Andrew Vagin avagin at parallels.com
Wed Oct 29 05:29:08 PDT 2014


On Wed, Oct 29, 2014 at 11:09:48AM +0400, Pavel Emelyanov wrote:
> This is for two reasons. First, validation can meet external mount
> and will call plugins, which is not correct on pre-dump and actually
> crashes on uninitilized plugins lists. Second, even if on pre-dump
> mount tree is not "supported" this can be a temporary situation (yes,
> yes, unlikely, but still).
> 
> On the other hand, it's better to fail earlier, but that's another
> story.
>

Acked-by: Andrew Vagin <avagin at parallels.com> 
> Reported-by: Sowmini Varadhan <sowmini.varadhan at oracle.com>
> Signed-off-by: Pavel Emelyanov <xemul at parallels.com>
> 
> ---
> 
> diff --git a/include/namespaces.h b/include/namespaces.h
> index 9b93b29..79327f5 100644
> --- a/include/namespaces.h
> +++ b/include/namespaces.h
> @@ -48,7 +48,7 @@ extern struct collect_image_info nsfile_cinfo;
>  
>  extern int walk_namespaces(struct ns_desc *nd, int (*cb)(struct ns_id *, void *), void *oarg);
>  extern int collect_namespaces(bool for_dump);
> -extern int collect_mnt_namespaces(void);
> +extern int collect_mnt_namespaces(bool for_dump);
>  extern int dump_mnt_namespaces(void);
>  extern int dump_namespaces(struct pstree_item *item, unsigned int ns_flags);
>  extern int prepare_namespace(struct pstree_item *item, unsigned long clone_flags);
> diff --git a/mount.c b/mount.c
> index a60c86e..59ffe53 100644
> --- a/mount.c
> +++ b/mount.c
> @@ -2097,7 +2097,7 @@ static int collect_mntns(struct ns_id *ns, void *oarg)
>  	return 0;
>  }
>  
> -int collect_mnt_namespaces(void)
> +int collect_mnt_namespaces(bool for_dump)
>  {
>  	int need_to_validate = 0, ret;
>  
> @@ -2105,7 +2105,7 @@ int collect_mnt_namespaces(void)
>  	if (ret)
>  		goto err;
>  
> -	if (need_to_validate) {
> +	if (for_dump && need_to_validate) {
>  		if (collect_shared(mntinfo))
>  			goto err;
>  		if (validate_mounts(mntinfo, true))
> diff --git a/namespaces.c b/namespaces.c
> index 87849fa..481b23d 100644
> --- a/namespaces.c
> +++ b/namespaces.c
> @@ -574,7 +574,7 @@ int collect_namespaces(bool for_dump)
>  {
>  	int ret;
>  
> -	ret = collect_mnt_namespaces();
> +	ret = collect_mnt_namespaces(for_dump);
>  	if (ret < 0)
>  		return ret;
>  
> 
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu


More information about the CRIU mailing list