[Devel] [patch vz7] do not allow rootfs umount

Andrey Vagin avagin at virtuozzo.com
Wed Jun 8 08:08:37 PDT 2016


On Mon, Jun 06, 2016 at 03:45:11PM +0300, Vasily Averin wrote:
> In mainline rootfs is marked always as MNT_LOCKED,
> sys_umount checks this flag and fails its processing.
> Our kernels lacks for MNT_LOCKED flag, so we use another kind of check
> to prevent incorrect operation.
> 
> https://jira.sw.ru/browse/PSBM-46437
> 
> Signed-off-by: Vasily Averin <vvs at virtuozzo.com>

> diff --git a/fs/namespace.c b/fs/namespace.c
> index 988320b..6f05245 100644
> --- a/fs/namespace.c
> +++ b/fs/namespace.c
> @@ -1355,6 +1355,8 @@ SYSCALL_DEFINE2(umount, char __user *, name, int, flags)
>  		goto dput_and_out;
>  	if (!check_mnt(mnt))
>  		goto dput_and_out;
> +	if (path.mnt->mnt_parent == path.mnt)

We can user mnt_has_parent() here

> +		goto dput_and_out;
>  
>  	retval = do_umount(mnt, flags);
>  dput_and_out:



More information about the Devel mailing list