lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:	Fri, 23 Dec 2011 15:18:19 -0200
From:	Gustavo Padovan <padovan@...fusion.mobi>
To:	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mount: enable use MS_RDONLY with MS_BIND

So I put Lennart's email wrong. Fixing it.

* Gustavo F. Padovan <padovan@...fusion.mobi> [2011-12-23 15:14:56 -0200]:

> From: "Gustavo F. Padovan" <padovan@...fusion.mobi>
> 
> This allow creation of read-only bind mounts in a single mount() call,
> instead of two.
> 
> Signed-off-by: Gustavo F. Padovan <padovan@...fusion.mobi>
> ---
>  fs/namespace.c |   11 ++++++++---
>  1 files changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/namespace.c b/fs/namespace.c
> index 5c07af8..c08c150 100644
> --- a/fs/namespace.c
> +++ b/fs/namespace.c
> @@ -1743,7 +1743,7 @@ static int do_change_type(struct path *path, int flag)
>   * do loopback mount.
>   */
>  static int do_loopback(struct path *path, char *old_name,
> -				int recurse)
> +						unsigned long flags)
>  {
>  	LIST_HEAD(umount_list);
>  	struct path old_path;
> @@ -1769,7 +1769,7 @@ static int do_loopback(struct path *path, char *old_name,
>  		goto out2;
>  
>  	err = -ENOMEM;
> -	if (recurse)
> +	if (flags & MS_REC)
>  		mnt = copy_tree(old_path.mnt, old_path.dentry, 0);
>  	else
>  		mnt = clone_mnt(old_path.mnt, old_path.dentry, 0);
> @@ -1782,7 +1782,12 @@ static int do_loopback(struct path *path, char *old_name,
>  		br_write_lock(&vfsmount_lock);
>  		umount_tree(mnt, 0, &umount_list);
>  		br_write_unlock(&vfsmount_lock);
> +		goto out2;
>  	}
> +
> +	if (flags & MS_RDONLY)
> +		path->mnt->mnt_flags |= MNT_READONLY;
> +
>  out2:
>  	unlock_mount(path);
>  	release_mounts(&umount_list);
> @@ -2338,7 +2343,7 @@ long do_mount(char *dev_name, char *dir_name, char *type_page,
>  		retval = do_remount(&path, flags & ~MS_REMOUNT, mnt_flags,
>  				    data_page);
>  	else if (flags & MS_BIND)
> -		retval = do_loopback(&path, dev_name, flags & MS_REC);
> +		retval = do_loopback(&path, dev_name, flags);
>  	else if (flags & (MS_SHARED | MS_PRIVATE | MS_SLAVE | MS_UNBINDABLE))
>  		retval = do_change_type(&path, flags);
>  	else if (flags & MS_MOVE)
> -- 
> 1.7.6.4
> 

	Gustavo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ