mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
kernel: add a helper to get an owning user namespace for a namespace
Return -EPERM if an owning user namespace is outside of a process
current user namespace.
v2: In a first version ns_get_owner returned ENOENT for init_user_ns.
This special cases was removed from this version. There is nothing
outside of init_user_ns, so we can return EPERM.
v3: rename ns->get_owner() to ns->owner(). get_* usually means that it
grabs a reference.
Acked-by: Serge Hallyn <[email protected]>
Signed-off-by: Andrei Vagin <[email protected]>
Signed-off-by: Eric W. Biederman <[email protected]>
This commit is contained in:
parent
29b4817d40
commit
bcac25a58b
9 changed files with 68 additions and 0 deletions
|
|
@ -165,10 +165,16 @@ static int ipcns_install(struct nsproxy *nsproxy, struct ns_common *new)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static struct user_namespace *ipcns_owner(struct ns_common *ns)
|
||||
{
|
||||
return to_ipc_ns(ns)->user_ns;
|
||||
}
|
||||
|
||||
const struct proc_ns_operations ipcns_operations = {
|
||||
.name = "ipc",
|
||||
.type = CLONE_NEWIPC,
|
||||
.get = ipcns_get,
|
||||
.put = ipcns_put,
|
||||
.install = ipcns_install,
|
||||
.owner = ipcns_owner,
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue