Skip to content

Commit 5eaf563

Browse files
committed
userns: Allow unprivileged users to create user namespaces.
Now that we have been through every permission check in the kernel having uid == 0 and gid == 0 in your local user namespace no longer adds any special privileges. Even having a full set of caps in your local user namespace is safe because capabilies are relative to your local user namespace, and do not confer unexpected privileges. Over the long term this should allow much more of the kernels functionality to be safely used by non-root users. Functionality like unsharing the mount namespace that is only unsafe because it can fool applications whose privileges are raised when they are executed. Since those applications have no privileges in a user namespaces it becomes safe to spoof and confuse those applications all you want. Those capabilities will still need to be enabled carefully because we may still need things like rlimits on the number of unprivileged mounts but that is to avoid DOS attacks not to avoid fooling root owned processes. Acked-by: Serge Hallyn <[email protected]> Signed-off-by: Eric W. Biederman <[email protected]>
1 parent 3cdf5b4 commit 5eaf563

File tree

1 file changed

+0
-8
lines changed

1 file changed

+0
-8
lines changed

kernel/fork.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1569,14 +1569,6 @@ long do_fork(unsigned long clone_flags,
15691569
if (clone_flags & (CLONE_THREAD|CLONE_PARENT))
15701570
return -EINVAL;
15711571
}
1572-
if (clone_flags & CLONE_NEWUSER) {
1573-
/* hopefully this check will go away when userns support is
1574-
* complete
1575-
*/
1576-
if (!capable(CAP_SYS_ADMIN) || !capable(CAP_SETUID) ||
1577-
!capable(CAP_SETGID))
1578-
return -EPERM;
1579-
}
15801572

15811573
/*
15821574
* Determine whether and which event to report to ptracer. When

0 commit comments

Comments
 (0)