diff -NurpP --minimal linux-2.6.25.11-vs2.3.0.34.13.2/include/linux/vserver/space_cmd.h linux-2.6.25.11-vs2.3.0.34.13.3/include/linux/vserver/space_cmd.h --- linux-2.6.25.11-vs2.3.0.34.13.2/include/linux/vserver/space_cmd.h 2008-04-19 15:14:52.000000000 -0400 +++ linux-2.6.25.11-vs2.3.0.34.13.3/include/linux/vserver/space_cmd.h 2008-07-15 22:53:10.000000000 -0400 @@ -8,7 +8,10 @@ #define VCMD_set_space_v0 VC_CMD(PROCALT, 3, 0) #define VCMD_set_space VC_CMD(PROCALT, 3, 1) -#define VCMD_get_space_mask VC_CMD(PROCALT, 4, 0) +#define VCMD_get_space_mask_v0 VC_CMD(PROCALT, 4, 0) + +#define VCMD_get_space_mask VC_CMD(VSPACE, 0, 1) +#define VCMD_get_space_default VC_CMD(VSPACE, 1, 0) struct vcmd_space_mask { @@ -20,7 +23,7 @@ struct vcmd_space_mask { extern int vc_enter_space(struct vx_info *, void __user *); extern int vc_set_space(struct vx_info *, void __user *); -extern int vc_get_space_mask(struct vx_info *, void __user *); +extern int vc_get_space_mask(struct vx_info *, void __user *, int); #endif /* __KERNEL__ */ #endif /* _VX_SPACE_CMD_H */ diff -NurpP --minimal linux-2.6.25.11-vs2.3.0.34.13.2/include/linux/vserver/switch.h linux-2.6.25.11-vs2.3.0.34.13.3/include/linux/vserver/switch.h --- linux-2.6.25.11-vs2.3.0.34.13.2/include/linux/vserver/switch.h 2008-07-15 22:03:53.000000000 -0400 +++ linux-2.6.25.11-vs2.3.0.34.13.3/include/linux/vserver/switch.h 2008-07-15 22:47:32.000000000 -0400 @@ -37,7 +37,7 @@ OTHER |VSTAT | | | | | | |VINFO | | | 40| 41| 42| 43| 44| 45| | 46| 47| =======+=======+=======+=======+=======+=======+=======+ +=======+=======+ - SPECIAL|EVENT | | | |FLAGS | | | | | + SPECIAL|EVENT | | | |FLAGS | | |VSPACE | | | 48| 49| 50| 51| 52| 53| | 54| 55| -------+-------+-------+-------+-------+-------+-------+ +-------+-------+ SPECIAL|DEBUG | | | |RLIMIT |SYSCALL| | |COMPAT | @@ -75,6 +75,7 @@ #define VC_CAT_EVENT 48 #define VC_CAT_FLAGS 52 +#define VC_CAT_VSPACE 54 #define VC_CAT_DEBUG 56 #define VC_CAT_RLIMIT 60 diff -NurpP --minimal linux-2.6.25.11-vs2.3.0.34.13.2/kernel/vserver/Kconfig linux-2.6.25.11-vs2.3.0.34.13.3/kernel/vserver/Kconfig --- linux-2.6.25.11-vs2.3.0.34.13.2/kernel/vserver/Kconfig 2008-07-11 03:07:10.000000000 -0400 +++ linux-2.6.25.11-vs2.3.0.34.13.3/kernel/vserver/Kconfig 2008-07-15 22:46:23.000000000 -0400 @@ -240,7 +240,6 @@ config VSERVER select NAMESPACES select UTS_NS select IPC_NS - select PID_NS select USER_NS select SYSVIPC diff -NurpP --minimal linux-2.6.25.11-vs2.3.0.34.13.2/kernel/vserver/space.c linux-2.6.25.11-vs2.3.0.34.13.3/kernel/vserver/space.c --- linux-2.6.25.11-vs2.3.0.34.13.2/kernel/vserver/space.c 2008-05-15 15:41:12.000000000 -0400 +++ linux-2.6.25.11-vs2.3.0.34.13.3/kernel/vserver/space.c 2008-07-15 23:36:41.000000000 -0400 @@ -38,14 +38,42 @@ atomic_t vs_global_pid_ns = ATOMIC_INIT( #include #include -const struct vcmd_space_mask space_mask = { - .mask = CLONE_NEWNS | + +static const struct vcmd_space_mask space_mask_v0 = { + .mask = CLONE_FS | + CLONE_NEWNS | CLONE_NEWUTS | CLONE_NEWIPC | CLONE_NEWUSER | - CLONE_FS + 0 +}; + +static const struct vcmd_space_mask space_mask = { + .mask = CLONE_FS | + CLONE_NEWNS | + CLONE_NEWUTS | + CLONE_NEWIPC | + CLONE_NEWUSER | +#ifdef CONFIG_PID_NS + CLONE_NEWPID | +#endif +#ifdef CONFIG_NET_NS + CLONE_NEWNET | +#endif + 0 }; +static const struct vcmd_space_mask default_space_mask = { + .mask = CLONE_FS | + CLONE_NEWNS | + CLONE_NEWUTS | + CLONE_NEWIPC | + CLONE_NEWUSER | +#ifdef CONFIG_PID_NS +// CLONE_NEWPID | +#endif + 0 +}; /* * build a new nsproxy mix @@ -60,9 +88,13 @@ struct nsproxy *vs_mix_nsproxy(struct ns struct mnt_namespace *old_ns; struct uts_namespace *old_uts; struct ipc_namespace *old_ipc; - struct pid_namespace *old_pid; struct user_namespace *old_user; +#ifdef CONFIG_PID_NS + struct pid_namespace *old_pid; +#endif +#ifdef CONFIG_NET_NS struct net *old_net; +#endif struct nsproxy *nsproxy; nsproxy = copy_nsproxy(old_nsproxy); @@ -101,6 +133,7 @@ struct nsproxy *vs_mix_nsproxy(struct ns } else old_user = NULL; +#ifdef CONFIG_PID_NS if (mask & CLONE_NEWPID) { old_pid = nsproxy->pid_ns; nsproxy->pid_ns = new_nsproxy->pid_ns; @@ -108,7 +141,8 @@ struct nsproxy *vs_mix_nsproxy(struct ns get_pid_ns(nsproxy->pid_ns); } else old_pid = NULL; - +#endif +#ifdef CONFIG_NET_NS if (mask & CLONE_NEWNET) { old_net = nsproxy->net_ns; nsproxy->net_ns = new_nsproxy->net_ns; @@ -116,19 +150,23 @@ struct nsproxy *vs_mix_nsproxy(struct ns get_net(nsproxy->net_ns); } else old_net = NULL; - +#endif if (old_ns) put_mnt_ns(old_ns); if (old_uts) put_uts_ns(old_uts); if (old_ipc) put_ipc_ns(old_ipc); - if (old_pid) - put_pid_ns(old_pid); if (old_user) put_user_ns(old_user); +#ifdef CONFIG_PID_NS + if (old_pid) + put_pid_ns(old_pid); +#endif +#ifdef CONFIG_NET_NS if (old_net) put_net(old_net); +#endif out: return nsproxy; } @@ -240,9 +278,10 @@ int vx_set_space(struct vx_info *vxi, un struct fs_struct *fs_vxi, *fs_cur, *fs_new; int ret; +#if 0 if (!mask) - mask = space_mask.mask; - + mask = default_space_mask.mask; +#endif if ((mask & space_mask.mask) != mask) return -EINVAL; @@ -307,9 +346,18 @@ int vc_set_space(struct vx_info *vxi, vo return vx_set_space(vxi, vc_data.mask); } -int vc_get_space_mask(struct vx_info *vxi, void __user *data) +int vc_get_space_mask(struct vx_info *vxi, void __user *data, int type) { - if (copy_to_user(data, &space_mask, sizeof(space_mask))) + const struct vcmd_space_mask *mask; + + if (type == 0) + mask = &space_mask_v0; + else if (type == 1) + mask = &space_mask; + else + mask = &default_space_mask; + + if (copy_to_user(data, mask, sizeof(struct vcmd_space_mask))) return -EFAULT; return 0; } diff -NurpP --minimal linux-2.6.25.11-vs2.3.0.34.13.2/kernel/vserver/switch.c linux-2.6.25.11-vs2.3.0.34.13.3/kernel/vserver/switch.c --- linux-2.6.25.11-vs2.3.0.34.13.2/kernel/vserver/switch.c 2008-04-29 18:40:18.000000000 -0400 +++ linux-2.6.25.11-vs2.3.0.34.13.3/kernel/vserver/switch.c 2008-07-15 23:34:13.000000000 -0400 @@ -98,8 +98,14 @@ long do_vcmd(uint32_t cmd, uint32_t id, case VCMD_set_space: return vc_set_space(vxi, data); + case VCMD_get_space_mask_v0: + return vc_get_space_mask(vxi, data, 0); + /* this is version 1 */ case VCMD_get_space_mask: - return vc_get_space_mask(vxi, data); + return vc_get_space_mask(vxi, data, 1); + + case VCMD_get_space_default: + return vc_get_space_mask(vxi, data, -1); #ifdef CONFIG_IA32_EMULATION case VCMD_get_rlimit: @@ -304,7 +310,9 @@ long do_vserver(uint32_t cmd, uint32_t i __VCMD(get_version, 0, VCA_NONE, 0); __VCMD(get_vci, 0, VCA_NONE, 0); __VCMD(get_rlimit_mask, 0, VCA_NONE, 0); + __VCMD(get_space_mask_v0,0, VCA_NONE, 0); __VCMD(get_space_mask, 0, VCA_NONE, 0); + __VCMD(get_space_default,0, VCA_NONE, 0); /* info commands */ __VCMD(task_xid, 2, VCA_NONE, 0); diff -NurpP --minimal linux-2.6.25.11-vs2.3.0.34.13.2/kernel/vserver/vci_config.h linux-2.6.25.11-vs2.3.0.34.13.3/kernel/vserver/vci_config.h --- linux-2.6.25.11-vs2.3.0.34.13.2/kernel/vserver/vci_config.h 2008-04-19 15:14:52.000000000 -0400 +++ linux-2.6.25.11-vs2.3.0.34.13.3/kernel/vserver/vci_config.h 2008-07-15 22:48:08.000000000 -0400 @@ -1,7 +1,7 @@ /* interface version */ -#define VCI_VERSION 0x00020302 +#define VCI_VERSION 0x00020303 enum {