[Devel] [PATCH RHEL7 COMMIT] ve/fs: don't add MNT_NODEV for ve mounts

Konstantin Khorenko khorenko at virtuozzo.com
Wed Oct 7 04:05:41 PDT 2015


The commit is pushed to "branch-rh7-3.10.0-229.7.2.vz7.8.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-229.7.2.vz7.8.3
------>
commit 9791eb158101e3cb174fbd5f4cac5d275a3833b6
Author: Andrew Vagin <avagin at openvz.org>
Date:   Wed Oct 7 15:05:40 2015 +0400

    ve/fs: don't add MNT_NODEV for ve mounts
    
    Reported-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
    Signed-off-by: Andrew Vagin <avagin at openvz.org>
---
 fs/namespace.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/fs/namespace.c b/fs/namespace.c
index 77a1ede..1377488 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -2167,6 +2167,7 @@ static int do_new_mount(struct path *path, const char *fstype, int flags,
 	struct file_system_type *type;
 	struct user_namespace *user_ns = current->nsproxy->mnt_ns->user_ns;
 	struct vfsmount *mnt;
+	struct user_namespace *root_user_ns;
 	int err;
 
 	if (!fstype)
@@ -2176,7 +2177,12 @@ static int do_new_mount(struct path *path, const char *fstype, int flags,
 	if (!type)
 		return -ENODEV;
 
-	if (user_ns != &init_user_ns) {
+	if (get_exec_env()->init_cred)
+		root_user_ns = get_exec_env()->init_cred->user_ns;
+	else
+		root_user_ns = &init_user_ns;
+
+	if (user_ns != root_user_ns) {
 		if (!(type->fs_flags & FS_USERNS_MOUNT)) {
 			put_filesystem(type);
 			return -EPERM;



More information about the Devel mailing list