[Devel] [PATCH RH9 09/13] ve/fs: allow devices-realted mounts in VE initial user namespace

Pavel Tikhomirov ptikhomirov at virtuozzo.com
Tue Sep 21 19:04:27 MSK 2021


From: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>

This is needed to be able to open device files on mounts, created in
containers root user namespace.

Signed-off-by: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>

(cherry-picked from vz8 commit dd1beccb211a934396cf5e0ec6948ed0d42e41b5)
Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
---
 fs/super.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/super.c b/fs/super.c
index 91b7f156735b..45e6e73db933 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -37,6 +37,7 @@
 #include <linux/lockdep.h>
 #include <linux/user_namespace.h>
 #include <linux/fs_context.h>
+#include <linux/ve.h>
 #include <uapi/linux/mount.h>
 #include "internal.h"
 
@@ -240,7 +241,7 @@ static struct super_block *alloc_super(struct file_system_type *type, int flags,
 	init_waitqueue_head(&s->s_writers.wait_unfrozen);
 	s->s_bdi = &noop_backing_dev_info;
 	s->s_flags = flags;
-	if (s->s_user_ns != &init_user_ns)
+	if (!current_user_ns_initial())
 		s->s_iflags |= SB_I_NODEV;
 	INIT_HLIST_NODE(&s->s_instances);
 	INIT_HLIST_BL_HEAD(&s->s_roots);
-- 
2.31.1



More information about the Devel mailing list