[CRIU] [PATCH 12/13] restore: Add restoration of the blocked threads signals from the image

Cyrill Gorcunov gorcunov at openvz.org
Wed Nov 7 11:28:13 EST 2012


On Wed, Nov 07, 2012 at 05:36:40PM +0400, Pavel Emelyanov wrote:
> > +	if (args->has_blk_sigset)
> > +		sigframe->uc.uc_sigmask.sig[0] = args->blk_sigset;
> > +
> >  	restore_sched_info(&args->sp);
> >  
> >  	return restore_gpregs(sigframe, &args->gpregs);
> 
> I've already commented it.

ok, so i think better to stick to restore_thread_common then,
since we will need it to extend in future and the code is
shared between all threads including the leaer, hm?
---
From: Cyrill Gorcunov <gorcunov at openvz.org>
Date: Sun, 4 Nov 2012 21:29:37 +0400
Subject: [PATCH] restore: Add restoration of the blocked threads signals from
 the image

To unify the code for both thread leader and regular threads
we move blocked signals for thread leader into threads argument
area and use restore_thread_common() helper.

Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 cr-restore.c       |    5 ++++-
 include/restorer.h |    4 +++-
 restorer.c         |    8 +++-----
 3 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/cr-restore.c b/cr-restore.c
index 5ff0099..7a0ef7e 100644
--- a/cr-restore.c
+++ b/cr-restore.c
@@ -1481,7 +1481,8 @@ static int sigreturn_restore(pid_t pid, CoreEntry *core, struct list_head *tgt_v
 	task_args->t.clear_tid_addr	= core->thread_info->clear_tid_addr;
 	task_args->ids			= *core->ids;
 	task_args->t.gpregs		= *core->thread_info->gpregs;
-	task_args->blk_sigset		= core->tc->blk_sigset;
+	task_args->t.blk_sigset		= core->tc->blk_sigset;
+	task_args->t.has_blk_sigset	= true;
 
 	if (core->thread_core) {
 		task_args->t.has_futex		= true;
@@ -1558,6 +1559,8 @@ static int sigreturn_restore(pid_t pid, CoreEntry *core, struct list_head *tgt_v
 			thread_args[i].has_futex	= true;
 			thread_args[i].futex_rla	= core->thread_core->futex_rla;
 			thread_args[i].futex_rla_len	= core->thread_core->futex_rla_len;
+			thread_args[i].has_blk_sigset	= core->thread_core->has_blk_sigset;
+			thread_args[i].blk_sigset	= core->thread_core->blk_sigset;
 
 			ret = prep_sched_info(&thread_args[i].sp, core->thread_core);
 			if (ret)
diff --git a/include/restorer.h b/include/restorer.h
index 11750e4..b12fc2a 100644
--- a/include/restorer.h
+++ b/include/restorer.h
@@ -76,6 +76,9 @@ struct thread_restore_args {
 	u64				futex_rla;
 	u32				futex_rla_len;
 
+	bool				has_blk_sigset;
+	u64				blk_sigset;
+
 	struct rst_sched_param		sp;
 
 	struct task_restore_core_args	*ta;
@@ -112,7 +115,6 @@ struct task_restore_core_args {
 	MmEntry				mm;
 	u64				mm_saved_auxv[AT_VECTOR_SIZE];
 	u32				mm_saved_auxv_size;
-	u64				blk_sigset;
 	char				comm[TASK_COMM_LEN];
 	TaskKobjIdsEntry		ids;
 
diff --git a/restorer.c b/restorer.c
index 7d3cef5..7b2d3ef 100644
--- a/restorer.c
+++ b/restorer.c
@@ -199,6 +199,9 @@ static int restore_thread_common(struct rt_sigframe *sigframe,
 		}
 	}
 
+	if (args->has_blk_sigset)
+		sigframe->uc.uc_sigmask.sig[0] = args->blk_sigset;
+
 	restore_sched_info(&args->sp);
 
 	return restore_gpregs(sigframe, &args->gpregs);
@@ -498,11 +501,6 @@ long __export_restore_task(struct task_restore_core_args *args)
 		goto core_restore_end;
 
 	/*
-	 * Blocked signals.
-	 */
-	rt_sigframe->uc.uc_sigmask.sig[0] = args->blk_sigset;
-
-	/*
 	 * Threads restoration. This requires some more comments. This
 	 * restorer routine and thread restorer routine has the following
 	 * memory map, prepared by a caller code.
-- 
1.7.7.6



More information about the CRIU mailing list