[CRIU] [PATCH 2/2] ptrace: wait when queued SIGSTOP signals will be handled

Andrey Vagin avagin at openvz.org
Sun Nov 15 04:08:14 PST 2015


From: Andrew Vagin <avagin at virtuozzo.com>

SIGSTOP can't be blocked, so we need to wait when it will be handled.

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

diff --git a/ptrace.c b/ptrace.c
index b28824b..af85c05 100644
--- a/ptrace.c
+++ b/ptrace.c
@@ -190,6 +190,29 @@ try_again:
 		goto err;
 	}
 
+	if (cr.sigpnd & (1 << (SIGSTOP - 1))) {
+		/*
+		 * SIGSTOP can't be blocked, so we need
+		 * to wait when it will be handled.
+		 */
+		pr_debug("SIGSTOP is queued\n");
+
+		ret = ptrace(PTRACE_CONT, pid, 0, 0);
+		if (ret) {
+			pr_perror("Unable to start process");
+			goto err;
+		}
+
+		ret = wait4(pid, &status, __WALL, NULL);
+		if (ret) {
+			pr_perror("Unable to wait %d", pid);
+			goto err;
+		}
+
+		(*creds)->state = 'T';
+		return TASK_STOPPED;
+	}
+
 	if (cr.seccomp_mode != SECCOMP_MODE_DISABLED && suspend_seccomp(pid) < 0)
 		goto err;
 
-- 
2.4.3



More information about the CRIU mailing list