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>
This commit is contained in:
Eric W. Biederman
2012-07-26 01:13:20 -07:00
parent b33c77ef23
commit 142e1d1d5f
4 changed files with 17 additions and 6 deletions

View File

@@ -242,9 +242,6 @@ SYSCALL_DEFINE2(setns, int, fd, int, nstype)
struct file *file;
int err;
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
file = proc_ns_fget(fd);
if (IS_ERR(file))
return PTR_ERR(file);