1 diff -Nurb linux-2.6.22-600/kernel/fork.c linux-2.6.22-601/kernel/fork.c
2 --- linux-2.6.22-600/kernel/fork.c 2008-03-28 11:22:20.000000000 -0600
3 +++ linux-2.6.22-601/kernel/fork.c 2008-03-28 11:22:25.000000000 -0600
5 /* Return -EINVAL for all unsupported flags */
7 if (unshare_flags & ~(CLONE_THREAD|CLONE_FS|CLONE_NEWNS|CLONE_SIGHAND|
8 - CLONE_VM|CLONE_FILES|CLONE_SYSVSEM|
9 + CLONE_VM|CLONE_FILES|CLONE_SYSVSEM|CLONE_NEWNET|
10 CLONE_NEWUTS|CLONE_NEWIPC|CLONE_NEWUSER))
13 diff -Nurb linux-2.6.22-600/kernel/nsproxy.c linux-2.6.22-601/kernel/nsproxy.c
14 --- linux-2.6.22-600/kernel/nsproxy.c 2008-03-28 11:22:23.000000000 -0600
15 +++ linux-2.6.22-601/kernel/nsproxy.c 2008-03-28 11:22:25.000000000 -0600
20 - ns = kmemdup(orig, sizeof(struct nsproxy), GFP_KERNEL);
22 + ns = kmem_cache_alloc(nsproxy_cachep, GFP_KERNEL);
24 + memcpy(ns, orig, sizeof(struct nsproxy));
25 atomic_set(&ns->count, 1);
26 vxdprintk(VXD_CBIT(space, 2), "clone_nsproxy(%p[%u] = %p[1]",
27 orig, atomic_read(&orig->count), ns);
28 atomic_inc(&vs_global_nsproxy);
34 return ERR_PTR(-ENOMEM);
36 new_nsp->mnt_ns = copy_mnt_ns(flags, orig->mnt_ns, new_fs);
37 - if (IS_ERR(new_nsp->mnt_ns))
38 + if (IS_ERR(new_nsp->mnt_ns)) {
39 + err = PTR_ERR(new_nsp->mnt_ns);
43 new_nsp->uts_ns = copy_utsname(flags, orig->uts_ns);
44 - if (IS_ERR(new_nsp->uts_ns))
45 + if (IS_ERR(new_nsp->uts_ns)) {
46 + err = PTR_ERR(new_nsp->uts_ns);
50 new_nsp->ipc_ns = copy_ipcs(flags, orig->ipc_ns);
51 - if (IS_ERR(new_nsp->ipc_ns))
52 + if (IS_ERR(new_nsp->ipc_ns)) {
53 + err = PTR_ERR(new_nsp->ipc_ns);
57 new_nsp->pid_ns = copy_pid_ns(flags, orig->pid_ns);
58 - if (IS_ERR(new_nsp->pid_ns))
59 + if (IS_ERR(new_nsp->pid_ns)) {
60 + err = PTR_ERR(new_nsp->pid_ns);
64 new_nsp->user_ns = copy_user_ns(flags, orig->user_ns);
65 - if (IS_ERR(new_nsp->user_ns))
66 + if (IS_ERR(new_nsp->user_ns)) {
67 + err = PTR_ERR(new_nsp->user_ns);
71 new_nsp->net_ns = copy_net_ns(flags, orig->net_ns);
72 - if (IS_ERR(new_nsp->net_ns))
73 + if (IS_ERR(new_nsp->net_ns)) {
74 + err = PTR_ERR(new_nsp->net_ns);
82 put_user_ns(new_nsp->user_ns);
83 - if (new_nsp->net_ns)
84 - put_net(new_nsp->net_ns);
87 put_pid_ns(new_nsp->pid_ns);
89 get_ipc_ns(ns->ipc_ns);
91 get_pid_ns(ns->pid_ns);
93 + get_net(ns->net_ns);
98 put_ipc_ns(ns->ipc_ns);
100 put_pid_ns(ns->pid_ns);
102 + put_net(ns->net_ns);
103 atomic_dec(&vs_global_nsproxy);
105 + kmem_cache_free(nsproxy_cachep, ns);
109 diff -Nurb linux-2.6.22-600/kernel/vserver/space.c linux-2.6.22-601/kernel/vserver/space.c
110 --- linux-2.6.22-600/kernel/vserver/space.c 2008-03-28 11:22:23.000000000 -0600
111 +++ linux-2.6.22-601/kernel/vserver/space.c 2008-03-28 11:22:25.000000000 -0600
113 #include <linux/utsname.h>
114 #include <linux/nsproxy.h>
115 #include <linux/err.h>
116 +#include <net/net_namespace.h>
117 #include <asm/uaccess.h>
119 #include <linux/vs_context.h>
121 struct mnt_namespace *old_ns;
122 struct uts_namespace *old_uts;
123 struct ipc_namespace *old_ipc;
124 + struct net *old_net;
125 struct nsproxy *nsproxy;
127 nsproxy = copy_nsproxy(old_nsproxy);
132 + if (mask & CLONE_NEWNET) {
133 + old_net = nsproxy->net_ns;
134 + nsproxy->net_ns = new_nsproxy->net_ns;
135 + if (nsproxy->net_ns) {
136 + get_net(nsproxy->net_ns);
137 + printk(KERN_ALERT "Cloning network namespace\n");