diff -NurpP --minimal linux-2.6.17.8-vs2.1.1-rc29.3/include/linux/sched.h linux-2.6.17.8-vs2.1.1-rc29.3.1/include/linux/sched.h --- linux-2.6.17.8-vs2.1.1-rc29.3/include/linux/sched.h 2006-07-09 17:07:13 +0200 +++ linux-2.6.17.8-vs2.1.1-rc29.3.1/include/linux/sched.h 2006-08-22 17:34:09 +0200 @@ -793,6 +793,7 @@ struct task_struct { struct group_info *group_info; kernel_cap_t cap_effective, cap_inheritable, cap_permitted; unsigned keep_capabilities:1; + unsigned spectator:1; struct user_struct *user; #ifdef CONFIG_KEYS struct key *request_key_auth; /* assumed request_key authority */ diff -NurpP --minimal linux-2.6.17.8-vs2.1.1-rc29.3/include/linux/vs_base.h linux-2.6.17.8-vs2.1.1-rc29.3.1/include/linux/vs_base.h --- linux-2.6.17.8-vs2.1.1-rc29.3/include/linux/vs_base.h 2006-08-19 20:32:58 +0200 +++ linux-2.6.17.8-vs2.1.1-rc29.3.1/include/linux/vs_base.h 2006-08-22 18:27:20 +0200 @@ -4,11 +4,16 @@ #include "vserver/context.h" -#define vx_task_xid(t) ((t)->xid) +#define vx_task_xid(t) ((t)->xid) +#define vx_task_admin(t) (vx_task_xid(t) == 0) +#define vx_task_watch(t) ((t)->spectator) -#define vx_current_xid() vx_task_xid(current) +#define vx_current_xid() vx_task_xid(current) +#define vx_current_admin() vx_task_admin(current) +#define vx_current_watch() vx_task_watch(current) -#define vx_check(c,m) __vx_check(vx_current_xid(),c,m) +#define vx_check(c,m) \ + __vx_check(c,m,vx_current_xid(),vx_current_admin(),vx_current_watch()) #define vx_weak_check(c,m) ((m) ? vx_check(c,m) : 1) @@ -17,11 +22,12 @@ * check current context for ADMIN/WATCH and * optionally against supplied argument */ -static inline int __vx_check(xid_t cid, xid_t id, unsigned int mode) +static inline +int __vx_check(xid_t id, unsigned int mode, xid_t _cid, int _admin, int _watch) { if (mode & VX_ARG_MASK) { if ((mode & VX_IDENT) && - (id == cid)) + (id == _cid)) return 1; } if (mode & VX_ATR_MASK) { @@ -30,11 +36,11 @@ static inline int __vx_check(xid_t cid, (id <= MAX_S_CONTEXT)) return 1; if ((mode & VX_STATIC) && - (id > 2) && (id < MIN_D_CONTEXT)) + (id < MIN_D_CONTEXT)) return 1; } - return (((mode & VX_ADMIN) && (cid == 0)) || - ((mode & VX_WATCH) && (cid == 1)) || + return (((mode & VX_ADMIN) && (_admin)) || + ((mode & VX_WATCH) && (_watch)) || ((mode & VX_HOSTID) && (id == 0))); } diff -NurpP --minimal linux-2.6.17.8-vs2.1.1-rc29.3/kernel/vserver/context.c linux-2.6.17.8-vs2.1.1-rc29.3.1/kernel/vserver/context.c --- linux-2.6.17.8-vs2.1.1-rc29.3/kernel/vserver/context.c 2006-08-18 00:20:18 +0200 +++ linux-2.6.17.8-vs2.1.1-rc29.3.1/kernel/vserver/context.c 2006-08-22 18:29:32 +0200 @@ -842,7 +842,7 @@ int vc_ctx_create(uint32_t xid, void __u if ((xid > MAX_S_CONTEXT) && (xid != VX_DYNAMIC_ID)) return -EINVAL; - if (xid < 2) + if (xid < 1) return -EINVAL; new_vxi = __create_vx_info(xid); diff -NurpP --minimal linux-2.6.17.8-vs2.1.1-rc29.3/kernel/vserver/legacy.c linux-2.6.17.8-vs2.1.1-rc29.3.1/kernel/vserver/legacy.c --- linux-2.6.17.8-vs2.1.1-rc29.3/kernel/vserver/legacy.c 2006-07-09 17:07:14 +0200 +++ linux-2.6.17.8-vs2.1.1-rc29.3.1/kernel/vserver/legacy.c 2006-08-22 18:32:48 +0200 @@ -68,7 +68,7 @@ int vc_new_s_context(uint32_t ctx, void /* ugly hack for Spectator */ if (ctx == 1) { - current->xid = 1; + current->spectator = 1; return 0; } diff -NurpP --minimal linux-2.6.17.8-vs2.1.1-rc29.3/kernel/vserver/switch.c linux-2.6.17.8-vs2.1.1-rc29.3.1/kernel/vserver/switch.c --- linux-2.6.17.8-vs2.1.1-rc29.3/kernel/vserver/switch.c 2006-08-19 13:33:10 +0200 +++ linux-2.6.17.8-vs2.1.1-rc29.3.1/kernel/vserver/switch.c 2006-08-22 18:34:11 +0200 @@ -388,7 +388,7 @@ long do_vserver(uint32_t cmd, uint32_t i case VCMD_ctx_migrate_v0: case VCMD_ctx_migrate: if (id == 1) { - current->xid = 1; + current->spectator = 1; ret = 1; goto out; }