From: Eric W. Biederman Date: Tue, 26 Mar 2013 02:57:10 +0000 (-0700) Subject: proc: Restrict mounting the proc filesystem X-Git-Url: http://git.mmlx.us/?a=commitdiff_plain;h=1ca91545961a92067cb8ad3ebc1558c8d1574456;p=linux-edison.git proc: Restrict mounting the proc filesystem commit aee1c13dd0f6c2fc56e0e492b349ee8ac655880f upstream. Don't allow mounting the proc filesystem unless the caller has CAP_SYS_ADMIN rights over the pid namespace. The principle here is if you create or have capabilities over it you can mount it, otherwise you get to live with what other people have mounted. Andy pointed out that this is needed to prevent users in a user namespace from remounting proc and specifying different hidepid and gid options on already existing proc mounts. Reported-by: Andy Lutomirski Signed-off-by: "Eric W. Biederman" Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/proc/root.c b/fs/proc/root.c index 41a6ea93f48..04ec276c7ba 100644 --- a/fs/proc/root.c +++ b/fs/proc/root.c @@ -110,7 +110,8 @@ static struct dentry *proc_mount(struct file_system_type *fs_type, ns = task_active_pid_ns(current); options = data; - if (!current_user_ns()->may_mount_proc) + if (!current_user_ns()->may_mount_proc || + !ns_capable(ns->user_ns, CAP_SYS_ADMIN)) return ERR_PTR(-EPERM); }