[CRIU] [PATCH] ptrace: send SIGSTOP to restore the stopped state

Andrew Vagin avagin at virtuozzo.com
Wed Nov 25 00:41:45 PST 2015


If a task was in a stopped state before we started to trace it,
its state is restored on detach.
If SIGSTOP was in a queue, we need to send it bedore detaching.
SIGSTOP doesn't affect states of stopped tasks, so we can send it
to all stopped tasks

Reported-by: Mr Jenkins
Signed-off-by: Andrew Vagin <avagin at virtuozzo.com>
---
 ptrace.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/ptrace.c b/ptrace.c
index 5a5fe5b..180bb75 100644
--- a/ptrace.c
+++ b/ptrace.c
@@ -31,11 +31,10 @@ int unseize_task(pid_t pid, int orig_st, int st)
 		kill(pid, SIGKILL);
 		return 0;
 	} else if (st == TASK_STOPPED) {
-		if (orig_st == TASK_ALIVE)
-			kill(pid, SIGSTOP);
-		/* PTRACE_SEIZE will restore state of other tasks */
+		kill(pid, SIGSTOP);
 	} else if (st == TASK_ALIVE) {
-		/* do nothing */ ;
+		if (orig_st == TASK_STOPPED)
+			kill(pid, SIGSTOP);
 	} else
 		pr_err("Unknown final state %d\n", st);
 
-- 
2.4.3



More information about the CRIU mailing list