16 #include <linux/slab.h>
17 #include <linux/export.h>
21 #include <linux/utsname.h>
34 #if defined(CONFIG_POSIX_MQUEUE) || defined(CONFIG_SYSVIPC)
44 static inline struct nsproxy *create_nsproxy(
void)
59 static struct nsproxy *create_new_namespaces(
unsigned long flags,
62 struct nsproxy *new_nsp;
65 new_nsp = create_nsproxy();
70 if (IS_ERR(new_nsp->
mnt_ns)) {
71 err = PTR_ERR(new_nsp->
mnt_ns);
76 if (IS_ERR(new_nsp->
uts_ns)) {
77 err = PTR_ERR(new_nsp->
uts_ns);
82 if (IS_ERR(new_nsp->
ipc_ns)) {
83 err = PTR_ERR(new_nsp->
ipc_ns);
88 if (IS_ERR(new_nsp->
pid_ns)) {
89 err = PTR_ERR(new_nsp->
pid_ns);
94 if (IS_ERR(new_nsp->
net_ns)) {
95 err = PTR_ERR(new_nsp->
net_ns);
109 put_uts_ns(new_nsp->
uts_ns);
124 struct nsproxy *old_ns = tsk->
nsproxy;
125 struct nsproxy *new_ns;
154 new_ns = create_new_namespaces(flags, tsk, tsk->
fs);
155 if (IS_ERR(new_ns)) {
156 err = PTR_ERR(new_ns);
186 struct nsproxy **new_nsp,
struct fs_struct *new_fs)
197 *new_nsp = create_new_namespaces(unshare_flags,
current,
198 new_fs ? new_fs :
current->fs);
199 if (IS_ERR(*new_nsp)) {
200 err = PTR_ERR(*new_nsp);
239 struct nsproxy *new_nsproxy;
249 return PTR_ERR(file);
252 ei = PROC_I(file->f_dentry->d_inode);
254 if (nstype && (ops->
type != nstype))
257 new_nsproxy = create_new_namespaces(0, tsk, tsk->
fs);
258 if (IS_ERR(new_nsproxy)) {
259 err = PTR_ERR(new_nsproxy);