[CRIU] [PATCH 1/1] do_new_mount() should clear all do_change_type() bits

Tycho Andersen tycho.andersen at canonical.com
Mon Apr 13 08:16:58 PDT 2015


On Mon, Apr 13, 2015 at 04:02:38PM +0200, Oleg Nesterov wrote:
> do_new_mount() clears MS_SHARED but this is not enough. It should clear
> all bits processed in restore_shared_options().
> 
> The patch also adds MS_UNBINDABLE to MS_CHANGE_TYPE_MASK even if it is
> not currently used. Just to match the kernel's do_change_type() check.
> 
> Signed-off-by: Oleg Nesterov <oleg at redhat.com>

Thanks, I was wondering about this. A question below,

> ---
>  mount.c |    5 ++++-
>  1 files changed, 4 insertions(+), 1 deletions(-)
> 
> diff --git a/mount.c b/mount.c
> index 8b57729..55d5f8b 100644
> --- a/mount.c
> +++ b/mount.c
> @@ -1750,6 +1750,9 @@ skip_parent:
>  	return 0;
>  }
>  
> +#define MS_CHANGE_TYPE_MASK	\
> +	(MS_SHARED | MS_PRIVATE | MS_SLAVE | MS_UNBINDABLE)
> +

If we unmask private and slave, should we pass something non-zero for
those to restore_shared_options() below?

>  static int do_new_mount(struct mount_info *mi)
>  {
>  	char *src;
> @@ -1760,7 +1763,7 @@ static int do_new_mount(struct mount_info *mi)
>  		return -1;
>  
>  	if (mount(src, mi->mountpoint, tp->name,
> -			mi->flags & (~MS_SHARED), mi->options) < 0) {
> +			mi->flags & ~MS_CHANGE_TYPE_MASK, mi->options) < 0) {
>  		pr_perror("Can't mount at %s", mi->mountpoint);
>  		return -1;
>  	}
> -- 
> 1.5.5.1
> 
> 


More information about the CRIU mailing list