[CRIU] [PATCH 19/22] dump: fill sigblock mask immediately after getting it

Andrey Vagin avagin at openvz.org
Wed May 8 09:28:46 EDT 2013


It will be used for constructing sigframe for parasite threads

Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
 cr-dump.c          | 12 ++----------
 parasite-syscall.c | 10 ++++++++++
 2 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/cr-dump.c b/cr-dump.c
index dd39400..3e3bca3 100644
--- a/cr-dump.c
+++ b/cr-dump.c
@@ -627,7 +627,6 @@ static int dump_task_core_all(struct parasite_ctl *ctl,
 		struct vm_area_list *vma_area_list,
 		const struct cr_fdset *cr_fdset)
 {
-	k_rtsigset_t *sig_blocked = &ctl->threads[0].sig_blocked;
 	int fd_core = fdset_fd(cr_fdset, CR_FD_CORE);
 	int ret = -1;
 	pid_t pid = ctl->pid.real;
@@ -652,8 +651,6 @@ static int dump_task_core_all(struct parasite_ctl *ctl,
 
 	strncpy((char *)core->tc->comm, stat->comm, TASK_COMM_LEN);
 	core->tc->flags = stat->flags;
-	BUILD_BUG_ON(sizeof(core->tc->blk_sigset) != sizeof(k_rtsigset_t));
-	memcpy(&core->tc->blk_sigset, sig_blocked, sizeof(k_rtsigset_t));
 
 	core->tc->task_state = TASK_ALIVE;
 	core->tc->exit_code = 0;
@@ -1070,8 +1067,7 @@ static int collect_file_locks(const struct cr_options *opts)
 }
 
 static int dump_task_thread(struct parasite_ctl *parasite_ctl,
-			    struct pid *tid, CoreEntry *core,
-			    k_rtsigset_t *sig_blocked)
+			    struct pid *tid, CoreEntry *core)
 {
 	int ret = -1, fd_core;
 	pid_t pid = tid->real;
@@ -1090,9 +1086,6 @@ static int dump_task_thread(struct parasite_ctl *parasite_ctl,
 		goto err;
 	}
 
-	core->thread_core->has_blk_sigset = true;
-	memcpy(&core->thread_core->blk_sigset, sig_blocked, sizeof(*sig_blocked));
-
 	ret = dump_sched_info(pid, core->thread_core);
 	if (ret)
 		goto err;
@@ -1205,8 +1198,7 @@ static int dump_task_threads(struct parasite_ctl *parasite_ctl,
 			item->threads[i].virt = item->pid.virt;
 			continue;
 		}
-		if (dump_task_thread(parasite_ctl, &item->threads[i], item->core[i],
-					&parasite_ctl->threads[i].sig_blocked))
+		if (dump_task_thread(parasite_ctl, &item->threads[i], item->core[i]))
 			return -1;
 	}
 
diff --git a/parasite-syscall.c b/parasite-syscall.c
index bbf17aa..27e8a30 100644
--- a/parasite-syscall.c
+++ b/parasite-syscall.c
@@ -700,6 +700,7 @@ static int block_signals(struct pstree_item *item, struct parasite_ctl *ctl)
 	ksigfillset(&blockall);
 
 	for (i = 0; i < item->nr_threads; i++) {
+		CoreEntry *core = item->core[i];
 		k_rtsigset_t *mask = &ctl->threads[i].sig_blocked;
 		pid_t tid = item->threads[i].real;
 
@@ -714,6 +715,15 @@ static int block_signals(struct pstree_item *item, struct parasite_ctl *ctl)
 			break;
 		}
 		ctl->threads[i].use_sig_blocked = true;
+
+		if (core->tc) {
+			BUILD_BUG_ON(sizeof(core->tc->blk_sigset) != sizeof(k_rtsigset_t));
+			memcpy(&core->tc->blk_sigset, mask, sizeof(k_rtsigset_t));
+		}
+
+		core->thread_core->has_blk_sigset = true;
+		memcpy(&core->thread_core->blk_sigset, mask, sizeof(k_rtsigset_t));
+
 	}
 
 	return ret;
-- 
1.8.2



More information about the CRIU mailing list