SOURCES: delta-rkill_debug-feat01.diff (NEW), delta-rkill-fix02.di...

baggins baggins at pld-linux.org
Tue Oct 4 19:51:49 CEST 2005


Author: baggins                      Date: Tue Oct  4 17:51:49 2005 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- fixes for vs2.0.1pre2

---- Files affected:
SOURCES:
   delta-rkill_debug-feat01.diff (NONE -> 1.1)  (NEW), delta-rkill-fix02.diff (NONE -> 1.1)  (NEW), delta-ppc-fix01.diff (NONE -> 1.1)  (NEW), delta-rkill-fix01.diff (NONE -> 1.1)  (NEW), delta-rkill-feat01.diff (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/delta-rkill_debug-feat01.diff
diff -u /dev/null SOURCES/delta-rkill_debug-feat01.diff:1.1
--- /dev/null	Tue Oct  4 19:51:49 2005
+++ SOURCES/delta-rkill_debug-feat01.diff	Tue Oct  4 19:51:44 2005
@@ -0,0 +1,36 @@
+diff -NurpP --minimal linux-2.6.13.1-vs2.1.0-rc2.1b/kernel/vserver/helper.c linux-2.6.13.1-vs2.1.0-rc2.2/kernel/vserver/helper.c
+--- linux-2.6.13.1-vs2.1.0-rc2.1b/kernel/vserver/helper.c	2005-09-28 03:10:59 +0200
++++ linux-2.6.13.1-vs2.1.0-rc2.2/kernel/vserver/helper.c	2005-09-28 03:06:41 +0200
+@@ -105,6 +105,9 @@ long vs_reboot(unsigned int cmd, void * 
+ 	struct vx_info *vxi = current->vx_info;
+ 	long ret = 0;
+ 
++	vxdprintk(VXD_CBIT(misc, 5),
++		"vs_reboot(%p[#%d],%d)",
++		vxi, vxi?vxi->vx_id:0, cmd);
+ 	if (vx_info_flags(vxi, VXF_REBOOT_KILL, 0)) {
+ 		switch (cmd) {
+ 		case LINUX_REBOOT_CMD_RESTART:
+diff -NurpP --minimal linux-2.6.13.1-vs2.1.0-rc2.1b/kernel/vserver/signal.c linux-2.6.13.1-vs2.1.0-rc2.2/kernel/vserver/signal.c
+--- linux-2.6.13.1-vs2.1.0-rc2.1b/kernel/vserver/signal.c	2005-09-16 01:19:15 +0200
++++ linux-2.6.13.1-vs2.1.0-rc2.2/kernel/vserver/signal.c	2005-09-28 03:06:06 +0200
+@@ -26,6 +26,9 @@ int vx_info_kill(struct vx_info *vxi, in
+ 	unsigned long priv = 0;
+ 
+ 	retval = -ESRCH;
++	vxdprintk(VXD_CBIT(misc, 4),
++		"vx_info_kill(%p[#%d],%d,%d)*",
++		vxi, vxi->vx_id, pid, sig);
+ 	read_lock(&tasklist_lock);
+ 	switch (pid) {
+ 	case  0:
+@@ -61,6 +64,9 @@ int vx_info_kill(struct vx_info *vxi, in
+ 		break;
+ 	}
+ 	read_unlock(&tasklist_lock);
++	vxdprintk(VXD_CBIT(misc, 4),
++		"vx_info_kill(%p[#%d],%d,%d) = %d",
++		vxi, vxi->vx_id, pid, sig, retval);
+ 	return retval;
+ }
+ 

================================================================
Index: SOURCES/delta-rkill-fix02.diff
diff -u /dev/null SOURCES/delta-rkill-fix02.diff:1.1
--- /dev/null	Tue Oct  4 19:51:49 2005
+++ SOURCES/delta-rkill-fix02.diff	Tue Oct  4 19:51:44 2005
@@ -0,0 +1,25 @@
+--- ./kernel/vserver/helper.c	2005-09-14 23:08:50 +0200
++++ ./kernel/vserver/helper.c	2005-09-28 02:11:32 +0200
+@@ -103,12 +103,18 @@ long vs_reboot_helper(struct vx_info *vx
+ long vs_reboot(unsigned int cmd, void * arg)
+ {
+ 	struct vx_info *vxi = current->vx_info;
+-	long ret;
++	long ret = 0;
+ 
+ 	if (vx_info_flags(vxi, VXF_REBOOT_KILL, 0)) {
+-		vx_info_kill(vxi, 0, SIGKILL);
+-		vx_info_kill(vxi, 1, SIGKILL);
+-		return 0;
++		switch (cmd) {
++		case LINUX_REBOOT_CMD_RESTART:
++		case LINUX_REBOOT_CMD_HALT:
++		case LINUX_REBOOT_CMD_POWER_OFF:
++			vx_info_kill(vxi, 0, SIGKILL);
++			vx_info_kill(vxi, 1, SIGKILL);
++		default:
++			break;
++		}
+ 	} else {
+ 		ret = vs_reboot_helper(vxi, cmd, arg);
+ 	}

================================================================
Index: SOURCES/delta-ppc-fix01.diff
diff -u /dev/null SOURCES/delta-ppc-fix01.diff:1.1
--- /dev/null	Tue Oct  4 19:51:49 2005
+++ SOURCES/delta-ppc-fix01.diff	Tue Oct  4 19:51:44 2005
@@ -0,0 +1,28 @@
+diff -NurpP --minimal linux-2.6.13.1-vs2.1.0-rc2.2/arch/ppc/kernel/misc.S linux-2.6.13.1-vs2.1.0-rc2.3/arch/ppc/kernel/misc.S
+--- linux-2.6.13.1-vs2.1.0-rc2.2/arch/ppc/kernel/misc.S	2005-09-15 03:51:33 +0200
++++ linux-2.6.13.1-vs2.1.0-rc2.3/arch/ppc/kernel/misc.S	2005-09-29 16:56:40 +0200
+@@ -1134,8 +1134,8 @@ _GLOBAL(kernel_thread)
+ 	stw	r31,12(r1)
+ 	mr	r30,r3		/* function */
+ 	mr	r31,r4		/* argument */
+-	ori	r3,r5,CLONE_VM|CLONE_KTHREAD	/* flags */
+-	oris	r3,r3,CLONE_UNTRACED>>16
++	ori	r3,r5,CLONE_VM	/* flags */
++	oris	r3,r3,(CLONE_UNTRACED|CLONE_KTHREAD)>>16
+ 	li	r4,0		/* new sp (unused) */
+ 	li	r0,__NR_clone
+ 	sc
+diff -NurpP --minimal linux-2.6.13.1-vs2.1.0-rc2.2/arch/ppc64/kernel/misc.S linux-2.6.13.1-vs2.1.0-rc2.3/arch/ppc64/kernel/misc.S
+--- linux-2.6.13.1-vs2.1.0-rc2.2/arch/ppc64/kernel/misc.S	2005-09-15 03:48:14 +0200
++++ linux-2.6.13.1-vs2.1.0-rc2.3/arch/ppc64/kernel/misc.S	2005-09-29 16:56:31 +0200
+@@ -658,8 +658,8 @@ _GLOBAL(kernel_thread)
+ 	stdu	r1,-STACK_FRAME_OVERHEAD(r1)
+ 	mr	r29,r3
+ 	mr	r30,r4
+-	ori	r3,r5,(CLONE_VM|CLONE_KTHREAD)	/* flags */
+-	oris	r3,r3,(CLONE_UNTRACED>>16)
++	ori	r3,r5,CLONE_VM	/* flags */
++	oris	r3,r3,(CLONE_UNTRACED|CLONE_KTHREAD)>>16
+ 	li	r4,0		/* new sp (unused) */
+ 	li	r0,__NR_clone
+ 	sc

================================================================
Index: SOURCES/delta-rkill-fix01.diff
diff -u /dev/null SOURCES/delta-rkill-fix01.diff:1.1
--- /dev/null	Tue Oct  4 19:51:49 2005
+++ SOURCES/delta-rkill-fix01.diff	Tue Oct  4 19:51:44 2005
@@ -0,0 +1,25 @@
+--- linux-2.6.13-rc7-vs2.1.0-pre5/kernel/vserver/helper.c	2005-08-26 04:06:10 +0200
++++ linux-2.6.13.1-vs2.1.0-rc2.1/kernel/vserver/helper.c	2005-09-14 23:08:50 +0200
+@@ -16,6 +16,7 @@
+ #include <linux/reboot.h>
+ #include <linux/vs_context.h>
+ #include <linux/vs_network.h>
++#include <linux/vserver/signal_cmd.h>
+ 
+ #include <asm/uaccess.h>
+ #include <asm/unistd.h>
+@@ -106,11 +107,12 @@ long vs_reboot(unsigned int cmd, void * 
+ 
+ 	if (vx_info_flags(vxi, VXF_REBOOT_KILL, 0)) {
+ 		vx_info_kill(vxi, 0, SIGKILL);
+-
++		vx_info_kill(vxi, 1, SIGKILL);
++		return 0;
+ 	} else {
+ 		ret = vs_reboot_helper(vxi, cmd, arg);
+ 	}
+-	return ret;
++	return ret;
+ }
+ 
+ 

================================================================
Index: SOURCES/delta-rkill-feat01.diff
diff -u /dev/null SOURCES/delta-rkill-feat01.diff:1.1
--- /dev/null	Tue Oct  4 19:51:49 2005
+++ SOURCES/delta-rkill-feat01.diff	Tue Oct  4 19:51:44 2005
@@ -0,0 +1,189 @@
+--- linux-2.6.13-rc7-vs2.1.0-pre4/include/linux/vserver/context.h	2005-08-24 20:59:58 +0200
++++ linux-2.6.13-rc7-vs2.1.0-pre5/include/linux/vserver/context.h	2005-08-26 01:23:45 +0200
+@@ -36,7 +36,8 @@
+ #define VXF_STATE_SETUP		(1ULL<<32)
+ #define VXF_STATE_INIT		(1ULL<<33)
+ 
+-#define VXF_STATE_HELPER	(1ULL<<36)
++#define VXF_SC_HELPER		(1ULL<<36)
++#define VXF_REBOOT_KILL		(1ULL<<37)
+ 
+ #define VXF_FORK_RSS		(1ULL<<48)
+ #define VXF_PROLIFIC		(1ULL<<49)
+only in patch2:
+unchanged:
+--- linux-2.6.13-rc7-vs2.1.0-pre4/include/linux/vserver/network.h	2005-08-24 20:59:58 +0200
++++ linux-2.6.13-rc7-vs2.1.0-pre5/include/linux/vserver/network.h	2005-08-26 01:26:23 +0200
+@@ -15,7 +15,7 @@
+ 
+ #define NXF_STATE_SETUP		(1ULL<<32)
+ 
+-#define NXF_STATE_HELPER	(1ULL<<36)
++#define NXF_SC_HELPER		(1ULL<<36)
+ 
+ #define NXF_ONE_TIME		(0x0001ULL<<32)
+ 
+only in patch2:
+unchanged:
+--- linux-2.6.13-rc7-vs2.1.0-pre4/kernel/vserver/helper.c	2005-08-24 20:59:58 +0200
++++ linux-2.6.13-rc7-vs2.1.0-pre5/kernel/vserver/helper.c	2005-08-26 04:06:10 +0200
+@@ -52,7 +52,7 @@ int do_vshelper(char *name, char *argv[]
+  *      envp [*] = type-specific parameters
+  */
+ 
+-long vs_reboot(unsigned int cmd, void * arg)
++long vs_reboot_helper(struct vx_info *vxi, int cmd, void *arg)
+ {
+ 	char id_buf[8], cmd_buf[16];
+ 	char uid_buf[16], pid_buf[16];
+@@ -63,7 +63,7 @@ long vs_reboot(unsigned int cmd, void * 
+ 			"PATH=/sbin:/usr/sbin:/bin:/usr/bin",
+ 			uid_buf, pid_buf, cmd_buf, 0};
+ 
+-	snprintf(id_buf, sizeof(id_buf)-1, "%d", vx_current_xid());
++	snprintf(id_buf, sizeof(id_buf)-1, "%d", vxi->vx_id);
+ 
+ 	snprintf(cmd_buf, sizeof(cmd_buf)-1, "VS_CMD=%08x", cmd);
+ 	snprintf(uid_buf, sizeof(uid_buf)-1, "VS_UID=%d", current->uid);
+@@ -99,6 +99,21 @@ long vs_reboot(unsigned int cmd, void * 
+ }
+ 
+ 
++long vs_reboot(unsigned int cmd, void * arg)
++{
++	struct vx_info *vxi = current->vx_info;
++	long ret;
++
++	if (vx_info_flags(vxi, VXF_REBOOT_KILL, 0)) {
++		vx_info_kill(vxi, 0, SIGKILL);
++
++	} else {
++		ret = vs_reboot_helper(vxi, cmd, arg);
++	}
++	return ret;
++}
++
++
+ /*
+  *      argv [0] = vshelper_path;
+  *      argv [1] = action: "startup", "shutdown"
+@@ -114,7 +129,7 @@ long vs_state_change(struct vx_info *vxi
+ 	char *envp[] = {"HOME=/", "TERM=linux",
+ 			"PATH=/sbin:/usr/sbin:/bin:/usr/bin", cmd_buf, 0};
+ 
+-	if (!vx_info_flags(vxi, VXF_STATE_HELPER, 0))
++	if (!vx_info_flags(vxi, VXF_SC_HELPER, 0))
+ 		return 0;
+ 
+ 	snprintf(id_buf, sizeof(id_buf)-1, "%d", vxi->vx_id);
+@@ -151,7 +166,7 @@ long vs_net_change(struct nx_info *nxi, 
+ 	char *envp[] = {"HOME=/", "TERM=linux",
+ 			"PATH=/sbin:/usr/sbin:/bin:/usr/bin", cmd_buf, 0};
+ 
+-	if (!nx_info_flags(nxi, NXF_STATE_HELPER, 0))
++	if (!nx_info_flags(nxi, NXF_SC_HELPER, 0))
+ 		return 0;
+ 
+ 	snprintf(id_buf, sizeof(id_buf)-1, "%d", nxi->nx_id);
+only in patch2:
+unchanged:
+--- linux-2.6.13-rc7-vs2.1.0-pre4/kernel/vserver/signal.c	2005-08-24 20:59:58 +0200
++++ linux-2.6.13-rc7-vs2.1.0-pre5/kernel/vserver/signal.c	2005-08-26 03:28:14 +0200
+@@ -19,37 +19,26 @@
+ #include <linux/vserver/signal_cmd.h>
+ 
+ 
+-int vc_ctx_kill(uint32_t id, void __user *data)
++int vx_info_kill(struct vx_info *vxi, int pid, int sig)
+ {
+ 	int retval, count=0;
+-	struct vcmd_ctx_kill_v0 vc_data;
+ 	struct task_struct *p;
+-	struct vx_info *vxi;
+ 	unsigned long priv = 0;
+ 
+-	if (!vx_check(0, VX_ADMIN))
+-		return -ENOSYS;
+-	if (copy_from_user (&vc_data, data, sizeof(vc_data)))
+-		return -EFAULT;
+-
+-	vxi = locate_vx_info(id);
+-	if (!vxi)
+-		return -ESRCH;
+-
+ 	retval = -ESRCH;
+ 	read_lock(&tasklist_lock);
+-	switch (vc_data.pid) {
++	switch (pid) {
+ 	case  0:
+ 		priv = 1;
+ 	case -1:
+ 		for_each_process(p) {
+ 			int err = 0;
+ 
+-			if (vx_task_xid(p) != id || p->pid <= 1 ||
+-				(vc_data.pid && vxi->vx_initpid == p->pid))
++			if (vx_task_xid(p) != vxi->vx_id || p->pid <= 1 ||
++				(pid && vxi->vx_initpid == p->pid))
+ 				continue;
+ 
+-			err = group_send_sig_info(vc_data.sig, (void*)priv, p);
++			err = group_send_sig_info(sig, (void*)priv, p);
+ 			++count;
+ 			if (err != -EPERM)
+ 				retval = err;
+@@ -58,20 +47,39 @@ int vc_ctx_kill(uint32_t id, void __user
+ 
+ 	case 1:
+ 		if (vxi->vx_initpid) {
+-			vc_data.pid = vxi->vx_initpid;
++			pid = vxi->vx_initpid;
+ 			priv = 1;
+ 		}
+ 		/* fallthrough */
+ 	default:
+-		p = find_task_by_real_pid(vc_data.pid);
++		p = find_task_by_real_pid(pid);
+ 		if (p) {
+-			if ((id == -1) || (vx_task_xid(p) == id))
+-				retval = group_send_sig_info(vc_data.sig,
++			if (vx_task_xid(p) == vxi->vx_id)
++				retval = group_send_sig_info(sig,
+ 					(void*)priv, p);
+ 		}
+ 		break;
+ 	}
+ 	read_unlock(&tasklist_lock);
++	return retval;
++}
++
++int vc_ctx_kill(uint32_t id, void __user *data)
++{
++	int retval;
++	struct vcmd_ctx_kill_v0 vc_data;
++	struct vx_info *vxi;
++
++	if (!vx_check(0, VX_ADMIN))
++		return -ENOSYS;
++	if (copy_from_user (&vc_data, data, sizeof(vc_data)))
++		return -EFAULT;
++
++	vxi = locate_vx_info(id);
++	if (!vxi)
++		return -ESRCH;
++
++	retval = vx_info_kill(vxi, vc_data.pid, vc_data.sig);
+ 	put_vx_info(vxi);
+ 	return retval;
+ }
+diff -NurpP --minimal linux-2.6.13.2/include/linux/vserver/signal_cmd.h linux-2.6.13.2-vs2.0.1-pre2/include/linux/vserver/signal_cmd.h
+--- linux-2.6.13.2/include/linux/vserver/signal_cmd.h	1970-01-01 01:00:00 +0100
++++ linux-2.6.13.2-vs2.0.1-pre2/include/linux/vserver/signal_cmd.h	2005-09-26 16:14:25 +0200
+@@ -17,6 +17,7 @@
+ 
+ #ifdef	__KERNEL__
+ 
++extern int vx_info_kill(struct vx_info *vxi, int pid, int sig);
+ extern int vc_ctx_kill(uint32_t, void __user *);
+ extern int vc_wait_exit(uint32_t, void __user *);
+ 
================================================================



More information about the pld-cvs-commit mailing list