[Devel] [PATCH RH7 3/3] vfs: allow mount proc and mqueue inside container

Pavel Tikhomirov ptikhomirov at virtuozzo.com
Tue Jun 30 05:17:54 PDT 2015


need this for docker, as it tries to mount proc and mqueue
and as we will not allow CAP_SYS_ADMIN in container.

* after switching to user namespaces we won't need this patch
https://jira.sw.ru/browse/PSBM-34523

Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
---
 fs/proc/root.c | 3 ++-
 ipc/mqueue.c   | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/proc/root.c b/fs/proc/root.c
index 88be7c2..0b7dbdb 100644
--- a/fs/proc/root.c
+++ b/fs/proc/root.c
@@ -121,7 +121,8 @@ static struct dentry *proc_mount(struct file_system_type *fs_type,
 		options = data;
 
 		if (!current_user_ns()->may_mount_proc ||
-		    !ns_capable(ns->user_ns, CAP_SYS_ADMIN))
+		    (!ns_capable(ns->user_ns, CAP_SYS_ADMIN) &&
+		     !ns_capable(ns->user_ns, CAP_VE_SYS_ADMIN)))
 			return ERR_PTR(-EPERM);
 	}
 
diff --git a/ipc/mqueue.c b/ipc/mqueue.c
index 657814c..c5f1d3e 100644
--- a/ipc/mqueue.c
+++ b/ipc/mqueue.c
@@ -335,7 +335,8 @@ static struct dentry *mqueue_mount(struct file_system_type *fs_type,
 		/* Don't allow mounting unless the caller has CAP_SYS_ADMIN
 		 * over the ipc namespace.
 		 */
-		if (!ns_capable(ns->user_ns, CAP_SYS_ADMIN))
+		if (!ns_capable(ns->user_ns, CAP_SYS_ADMIN) &&
+		    !ns_capable(ns->user_ns, CAP_VE_SYS_ADMIN))
 			return ERR_PTR(-EPERM);
 
 		data = ns;
-- 
1.9.3




More information about the Devel mailing list