diff options
| author | Eric W. Biederman <ebiederm@xmission.com> | 2012-07-26 07:02:49 -0400 |
|---|---|---|
| committer | Eric W. Biederman <ebiederm@xmission.com> | 2012-11-20 07:17:43 -0500 |
| commit | bcf58e725ddc45d31addbc6627d4f0edccc824c1 (patch) | |
| tree | e6dff2fbed40f26d8c45f78e23a7476527573bf1 /ipc | |
| parent | 142e1d1d5f088e7a38659daca6e84a730967774a (diff) | |
userns: Make create_new_namespaces take a user_ns parameter
Modify create_new_namespaces to explicitly take a user namespace
parameter, instead of implicitly through the task_struct.
This allows an implementation of unshare(CLONE_NEWUSER) where
the new user namespace is not stored onto the current task_struct
until after all of the namespaces are created.
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.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/ipc/namespace.c b/ipc/namespace.c index 6ed33c05cb66..72c868277793 100644 --- a/ipc/namespace.c +++ b/ipc/namespace.c | |||
| @@ -16,7 +16,7 @@ | |||
| 16 | 16 | ||
| 17 | #include "util.h" | 17 | #include "util.h" |
| 18 | 18 | ||
| 19 | static struct ipc_namespace *create_ipc_ns(struct task_struct *tsk, | 19 | static struct ipc_namespace *create_ipc_ns(struct user_namespace *user_ns, |
| 20 | struct ipc_namespace *old_ns) | 20 | struct ipc_namespace *old_ns) |
| 21 | { | 21 | { |
| 22 | struct ipc_namespace *ns; | 22 | struct ipc_namespace *ns; |
| @@ -46,19 +46,17 @@ static struct ipc_namespace *create_ipc_ns(struct task_struct *tsk, | |||
| 46 | ipcns_notify(IPCNS_CREATED); | 46 | ipcns_notify(IPCNS_CREATED); |
| 47 | register_ipcns_notifier(ns); | 47 | register_ipcns_notifier(ns); |
| 48 | 48 | ||
| 49 | ns->user_ns = get_user_ns(task_cred_xxx(tsk, user_ns)); | 49 | ns->user_ns = get_user_ns(user_ns); |
| 50 | 50 | ||
| 51 | return ns; | 51 | return ns; |
| 52 | } | 52 | } |
| 53 | 53 | ||
| 54 | struct ipc_namespace *copy_ipcs(unsigned long flags, | 54 | struct ipc_namespace *copy_ipcs(unsigned long flags, |
| 55 | struct task_struct *tsk) | 55 | struct user_namespace *user_ns, struct ipc_namespace *ns) |
| 56 | { | 56 | { |
| 57 | struct ipc_namespace *ns = tsk->nsproxy->ipc_ns; | ||
| 58 | |||
| 59 | if (!(flags & CLONE_NEWIPC)) | 57 | if (!(flags & CLONE_NEWIPC)) |
| 60 | return get_ipc_ns(ns); | 58 | return get_ipc_ns(ns); |
| 61 | return create_ipc_ns(tsk, ns); | 59 | return create_ipc_ns(user_ns, ns); |
| 62 | } | 60 | } |
| 63 | 61 | ||
| 64 | /* | 62 | /* |
