[CRIU] [crtools-bot] ptrace: Send signals with final state explicitly

Cyrill Gorcunov gorcunov at openvz.org
Fri Feb 3 05:54:26 EST 2012


The commit is pushed to "master" and will appear on git://github.com/cyrillos/crtools.git
--------------->
commit 06cc19511aaeb871bc9367579619a1670bc7ed29
Author: Pavel Emelyanov <xemul at parallels.com>
Date:   Fri Feb 3 14:49:57 2012 +0400

    ptrace: Send signals with final state explicitly
    
    According to Oleg the PTRACE_KILL doesn't and was-not-supposed-to work.
    Thus, kill tasks to final state explicitly and just detach from them.
    
    Signed-off-by: Pavel Emelyanov <xemul at parallels.com>
    Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 ptrace.c |   15 +++++++--------
 1 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/ptrace.c b/ptrace.c
index 7b1b128..8a44d81 100644
--- a/ptrace.c
+++ b/ptrace.c
@@ -21,15 +21,14 @@
 
 int unseize_task(pid_t pid, enum cr_task_state st)
 {
-	if (st == CR_TASK_STOP)
-		return ptrace(PTRACE_DETACH, pid, NULL, NULL);
-	else if (st == CR_TASK_KILL) {
+	if (st == CR_TASK_KILL)
 		kill(pid, SIGKILL);
-		return ptrace(PTRACE_KILL, pid, NULL, NULL);
-	} else {
-		BUG_ON(1);
-		return -1;
-	}
+	else if (st == CR_TASK_STOP)
+		kill(pid, SIGSTOP);
+	else
+		pr_err("Unknown final state %d\n", st);
+
+	return ptrace(PTRACE_DETACH, pid, NULL, NULL);
 }
 
 /*


More information about the CRIU mailing list