[CRIU] [crtools-bot for Pavel Emelyanov ] parasite: Check for unexpected signals delivery

Cyrill Gorcunov gorcunov at openvz.org
Thu Mar 1 10:31:20 EST 2012


The commit is pushed to "master" and will appear on git://github.com/cyrillos/crtools.git
------>
commit 3ab9285f0fcd6257a9055c97de6ca816427325cd
Author: Pavel Emelyanov <xemul at parallels.com>
Date:   Thu Mar 1 19:01:05 2012 +0400

    parasite: Check for unexpected signals delivery
    
    Signals shouldn't come to parasite after we've blocked them.
    
    Signed-off-by: Pavel Emelyanov <xemul at parallels.com>
    Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 include/parasite-syscall.h |    3 ++-
 parasite-syscall.c         |    9 +++++++++
 2 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/include/parasite-syscall.h b/include/parasite-syscall.h
index 43032ea..5ae1554 100644
--- a/include/parasite-syscall.h
+++ b/include/parasite-syscall.h
@@ -22,7 +22,8 @@ struct parasite_ctl {
 	user_regs_struct_t	regs_orig;				/* original registers */
 	unsigned long		syscall_ip;				/* entry point of infection */
 	u8			code_orig[BUILTIN_SYSCALL_SIZE];
-	unsigned long		status;
+
+	int			signals_blocked;
 
 	void *			addr_cmd;				/* addr for command */
 	void *			addr_args;				/* address for arguments */
diff --git a/parasite-syscall.c b/parasite-syscall.c
index a570d70..131974b 100644
--- a/parasite-syscall.c
+++ b/parasite-syscall.c
@@ -124,6 +124,11 @@ retry_signal:
 		pr_debug("** delivering signal %d si_code=%d\n",
 			 siginfo.si_signo, siginfo.si_code);
 
+		if (ctl->signals_blocked) {
+			pr_err("Unexpected %d task interruption, aborting\n", pid);
+			goto err;
+		}
+
 		/* FIXME: jerr(siginfo.si_code > 0, err_restore); */
 
 		/*
@@ -614,6 +619,8 @@ int parasite_cure_seized(struct parasite_ctl *ctl)
 	int ret = 0;
 
 	if (ctl->parasite_ip) {
+		ctl->signals_blocked = 0;
+
 		if (parasite_execute(PARASITE_CMD_FINI, ctl, &args, sizeof(args))) {
 			pr_err("Can't finalize parasite (pid: %d) task\n", ctl->pid);
 			ret = -1;
@@ -738,6 +745,8 @@ struct parasite_ctl *parasite_infect_seized(pid_t pid, struct list_head *vma_are
 		goto err_restore;
 	}
 
+	ctl->signals_blocked = 1;
+
 	ret = parasite_set_logfd(ctl, pid);
 	if (ret) {
 		pr_err("%d: Can't set a logging descriptor\n", pid);


More information about the CRIU mailing list