mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 11:41:38 -04:00
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 <[email protected]> Signed-off-by: "Eric W. Biederman" <[email protected]>
This commit is contained in:
parent
b33c77ef23
commit
142e1d1d5f
4 changed files with 17 additions and 6 deletions
|
|
@ -161,8 +161,12 @@ static void ipcns_put(void *ns)
|
|||
return put_ipc_ns(ns);
|
||||
}
|
||||
|
||||
static int ipcns_install(struct nsproxy *nsproxy, void *ns)
|
||||
static int ipcns_install(struct nsproxy *nsproxy, void *new)
|
||||
{
|
||||
struct ipc_namespace *ns = new;
|
||||
if (!ns_capable(ns->user_ns, CAP_SYS_ADMIN))
|
||||
return -EPERM;
|
||||
|
||||
/* Ditch state from the old ipc namespace */
|
||||
exit_sem(current);
|
||||
put_ipc_ns(nsproxy->ipc_ns);
|
||||
|
|
|
|||
Loading…
Reference in a new issue