diff -NurpP linux-3.0-rc2-vs2.3.1-pre1.1/include/linux/ipc_namespace.h linux-3.0-rc2-vs2.3.1-pre1.4/include/linux/ipc_namespace.h --- linux-3.0-rc2-vs2.3.1-pre1.1/include/linux/ipc_namespace.h 2011-05-22 16:17:55.000000000 +0200 +++ linux-3.0-rc2-vs2.3.1-pre1.4/include/linux/ipc_namespace.h 2011-06-13 14:09:44.000000000 +0200 @@ -94,7 +94,8 @@ static inline int mq_init_ns(struct ipc_ #if defined(CONFIG_IPC_NS) extern struct ipc_namespace *copy_ipcs(unsigned long flags, - struct task_struct *tsk); + struct ipc_namespace *old_ns, + struct user_namespace *user_ns); static inline struct ipc_namespace *get_ipc_ns(struct ipc_namespace *ns) { if (ns) @@ -105,12 +106,13 @@ static inline struct ipc_namespace *get_ extern void put_ipc_ns(struct ipc_namespace *ns); #else static inline struct ipc_namespace *copy_ipcs(unsigned long flags, - struct task_struct *tsk) + struct ipc_namespace *old_ns, + struct user_namespace *user_ns) { if (flags & CLONE_NEWIPC) return ERR_PTR(-EINVAL); - return tsk->nsproxy->ipc_ns; + return old_ns; } static inline struct ipc_namespace *get_ipc_ns(struct ipc_namespace *ns) diff -NurpP linux-3.0-rc2-vs2.3.1-pre1.1/include/linux/utsname.h linux-3.0-rc2-vs2.3.1-pre1.4/include/linux/utsname.h --- linux-3.0-rc2-vs2.3.1-pre1.1/include/linux/utsname.h 2011-05-22 16:17:58.000000000 +0200 +++ linux-3.0-rc2-vs2.3.1-pre1.4/include/linux/utsname.h 2011-06-13 14:36:48.000000000 +0200 @@ -54,7 +54,8 @@ static inline void get_uts_ns(struct uts } extern struct uts_namespace *copy_utsname(unsigned long flags, - struct task_struct *tsk); + struct uts_namespace *old_ns, + struct user_namespace *user_ns); extern void free_uts_ns(struct kref *kref); static inline void put_uts_ns(struct uts_namespace *ns) @@ -71,12 +72,13 @@ static inline void put_uts_ns(struct uts } static inline struct uts_namespace *copy_utsname(unsigned long flags, - struct task_struct *tsk) + struct uts_namespace *old_ns, + struct user_namespace *user_ns) { if (flags & CLONE_NEWUTS) return ERR_PTR(-EINVAL); - return tsk->nsproxy->uts_ns; + return old_ns; } #endif diff -NurpP linux-3.0-rc2-vs2.3.1-pre1.1/ipc/namespace.c linux-3.0-rc2-vs2.3.1-pre1.4/ipc/namespace.c --- linux-3.0-rc2-vs2.3.1-pre1.1/ipc/namespace.c 2011-06-10 22:17:16.000000000 +0200 +++ linux-3.0-rc2-vs2.3.1-pre1.4/ipc/namespace.c 2011-06-13 14:09:44.000000000 +0200 @@ -18,8 +18,7 @@ #include "util.h" -static struct ipc_namespace *create_ipc_ns(struct task_struct *tsk, - struct ipc_namespace *old_ns) +static struct ipc_namespace *create_ipc_ns(struct user_namespace *user_ns) { struct ipc_namespace *ns; int err; @@ -48,19 +47,18 @@ static struct ipc_namespace *create_ipc_ ipcns_notify(IPCNS_CREATED); register_ipcns_notifier(ns); - ns->user_ns = get_user_ns(task_cred_xxx(tsk, user)->user_ns); + ns->user_ns = get_user_ns(user_ns); return ns; } struct ipc_namespace *copy_ipcs(unsigned long flags, - struct task_struct *tsk) + struct ipc_namespace *old_ns, + struct user_namespace *user_ns) { - struct ipc_namespace *ns = tsk->nsproxy->ipc_ns; - if (!(flags & CLONE_NEWIPC)) - return get_ipc_ns(ns); - return create_ipc_ns(tsk, ns); + return get_ipc_ns(old_ns); + return create_ipc_ns(user_ns); } /* diff -NurpP linux-3.0-rc2-vs2.3.1-pre1.1/kernel/nsproxy.c linux-3.0-rc2-vs2.3.1-pre1.4/kernel/nsproxy.c --- linux-3.0-rc2-vs2.3.1-pre1.1/kernel/nsproxy.c 2011-06-10 22:11:24.000000000 +0200 +++ linux-3.0-rc2-vs2.3.1-pre1.4/kernel/nsproxy.c 2011-06-13 14:09:44.000000000 +0200 @@ -61,8 +61,11 @@ static inline struct nsproxy *create_nsp * Return the newly created nsproxy. Do not attach this to the task, * leave it to the caller to do proper locking and attach it to task. */ -static struct nsproxy *create_new_namespaces(unsigned long flags, - struct task_struct *tsk, struct fs_struct *new_fs) +static struct nsproxy *unshare_namespaces(unsigned long flags, + struct nsproxy *orig, + struct fs_struct *new_fs, + struct user_namespace *new_user, + struct pid_namespace *new_pid) { struct nsproxy *new_nsp; int err; @@ -71,31 +74,31 @@ static struct nsproxy *create_new_namesp if (!new_nsp) return ERR_PTR(-ENOMEM); - new_nsp->mnt_ns = copy_mnt_ns(flags, tsk->nsproxy->mnt_ns, new_fs); + new_nsp->mnt_ns = copy_mnt_ns(flags, orig->mnt_ns, new_fs); if (IS_ERR(new_nsp->mnt_ns)) { err = PTR_ERR(new_nsp->mnt_ns); goto out_ns; } - new_nsp->uts_ns = copy_utsname(flags, tsk); + new_nsp->uts_ns = copy_utsname(flags, orig->uts_ns, new_user); if (IS_ERR(new_nsp->uts_ns)) { err = PTR_ERR(new_nsp->uts_ns); goto out_uts; } - new_nsp->ipc_ns = copy_ipcs(flags, tsk); + new_nsp->ipc_ns = copy_ipcs(flags, orig->ipc_ns, new_user); if (IS_ERR(new_nsp->ipc_ns)) { err = PTR_ERR(new_nsp->ipc_ns); goto out_ipc; } - new_nsp->pid_ns = copy_pid_ns(flags, task_active_pid_ns(tsk)); + new_nsp->pid_ns = copy_pid_ns(flags, new_pid); if (IS_ERR(new_nsp->pid_ns)) { err = PTR_ERR(new_nsp->pid_ns); goto out_pid; } - new_nsp->net_ns = copy_net_ns(flags, tsk->nsproxy->net_ns); + new_nsp->net_ns = copy_net_ns(flags, orig->net_ns); if (IS_ERR(new_nsp->net_ns)) { err = PTR_ERR(new_nsp->net_ns); goto out_net; @@ -120,10 +123,12 @@ out_ns: return ERR_PTR(err); } -static struct nsproxy *create_new_namespaces(int flags, struct task_struct *tsk, - struct fs_struct *new_fs) +static struct nsproxy *create_new_namespaces(unsigned long flags, + struct task_struct *tsk, struct fs_struct *new_fs) { - return unshare_namespaces(flags, tsk->nsproxy, new_fs); + return unshare_namespaces(flags, tsk->nsproxy, + new_fs, task_cred_xxx(tsk, user)->user_ns, + task_active_pid_ns(tsk)); } /* diff -NurpP linux-3.0-rc2-vs2.3.1-pre1.1/kernel/utsname.c linux-3.0-rc2-vs2.3.1-pre1.4/kernel/utsname.c --- linux-3.0-rc2-vs2.3.1-pre1.1/kernel/utsname.c 2011-06-10 22:23:17.000000000 +0200 +++ linux-3.0-rc2-vs2.3.1-pre1.4/kernel/utsname.c 2011-06-13 14:09:44.000000000 +0200 @@ -35,8 +35,8 @@ static struct uts_namespace *create_uts_ * @old_ns: namespace to clone * Return NULL on error (failure to kmalloc), new ns otherwise */ -static struct uts_namespace *clone_uts_ns(struct task_struct *tsk, - struct uts_namespace *old_ns) +static struct uts_namespace *clone_uts_ns(struct uts_namespace *old_ns, + struct user_namespace *old_user) { struct uts_namespace *ns; @@ -46,7 +46,7 @@ static struct uts_namespace *clone_uts_n down_read(&uts_sem); memcpy(&ns->name, &old_ns->name, sizeof(ns->name)); - ns->user_ns = get_user_ns(task_cred_xxx(tsk, user)->user_ns); + ns->user_ns = get_user_ns(old_user); up_read(&uts_sem); return ns; } @@ -58,9 +58,9 @@ static struct uts_namespace *clone_uts_n * versa. */ struct uts_namespace *copy_utsname(unsigned long flags, - struct task_struct *tsk) + struct uts_namespace *old_ns, + struct user_namespace *user_ns) { - struct uts_namespace *old_ns = tsk->nsproxy->uts_ns; struct uts_namespace *new_ns; BUG_ON(!old_ns); @@ -69,7 +69,7 @@ struct uts_namespace *copy_utsname(unsig if (!(flags & CLONE_NEWUTS)) return old_ns; - new_ns = clone_uts_ns(tsk, old_ns); + new_ns = clone_uts_ns(old_ns, user_ns); put_uts_ns(old_ns); return new_ns;