aboutsummaryrefslogtreecommitdiffstats
path: root/ipc
diff options
context:
space:
mode:
authorEric W. Biederman2012-07-26 03:13:20 -0500
committerEric W. Biederman2012-11-20 06:17:42 -0600
commit142e1d1d5f088e7a38659daca6e84a730967774a (patch)
treee2297a9a77f55bb15a566979c9c5658cff4737f8 /ipc
parentb33c77ef23dd3ec5692c9c0cc739a3f5f0f2baae (diff)
downloadkernel-omap-142e1d1d5f088e7a38659daca6e84a730967774a.tar.gz
kernel-omap-142e1d1d5f088e7a38659daca6e84a730967774a.tar.xz
kernel-omap-142e1d1d5f088e7a38659daca6e84a730967774a.zip
userns: Allow unprivileged use of setns.
- Push the permission check from the core setns syscall into the setns install methods where the user namespace of the target namespace can be determined, and used in a ns_capable call. Acked-by: Serge Hallyn <serge.hallyn@canonical.com> Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Diffstat (limited to 'ipc')
-rw-r--r--ipc/namespace.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/ipc/namespace.c b/ipc/namespace.c
index f362298c5ce4..6ed33c05cb66 100644
--- a/ipc/namespace.c
+++ b/ipc/namespace.c
@@ -161,8 +161,12 @@ static void ipcns_put(void *ns)
161 return put_ipc_ns(ns); 161 return put_ipc_ns(ns);
162} 162}
163 163
164static int ipcns_install(struct nsproxy *nsproxy, void *ns) 164static int ipcns_install(struct nsproxy *nsproxy, void *new)
165{ 165{
166 struct ipc_namespace *ns = new;
167 if (!ns_capable(ns->user_ns, CAP_SYS_ADMIN))
168 return -EPERM;
169
166 /* Ditch state from the old ipc namespace */ 170 /* Ditch state from the old ipc namespace */
167 exit_sem(current); 171 exit_sem(current);
168 put_ipc_ns(nsproxy->ipc_ns); 172 put_ipc_ns(nsproxy->ipc_ns);