[CRIU] [PATCH] pstree_item: Keep has_seccomp field on rst_info tail

Pavel Emelyanov xemul at parallels.com
Thu Jun 25 07:57:15 PDT 2015


Signed-off-by: Pavel Emelyanov <xemul at parallels.com>
---
 cr-restore.c       | 4 ++--
 include/pstree.h   | 6 ------
 include/rst_info.h | 7 +++++++
 3 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/cr-restore.c b/cr-restore.c
index 31980bc..f695fbc 100644
--- a/cr-restore.c
+++ b/cr-restore.c
@@ -1056,7 +1056,7 @@ static inline int fork_with_pid(struct pstree_item *item)
 
 		item->state = ca.core->tc->task_state;
 		rsti(item)->cg_set = ca.core->tc->cg_set;
-		item->has_seccomp = ca.core->tc->seccomp_mode != SECCOMP_MODE_DISABLED;
+		rsti(item)->has_seccomp = ca.core->tc->seccomp_mode != SECCOMP_MODE_DISABLED;
 
 		if (item->state == TASK_DEAD)
 			rsti(item->parent)->nr_zombies++;
@@ -1687,7 +1687,7 @@ static void finalize_restore(int status)
 		 * doing an munmap in the process, which may be blocked by
 		 * seccomp and cause the task to be killed.
 		 */
-		if (item->has_seccomp && suspend_seccomp(pid) < 0)
+		if (rsti(item)->has_seccomp && suspend_seccomp(pid) < 0)
 			pr_err("failed to suspend seccomp, restore will probably fail...\n");
 
 		ctl = parasite_prep_ctl(pid, NULL);
diff --git a/include/pstree.h b/include/pstree.h
index 7583315..a09e956 100644
--- a/include/pstree.h
+++ b/include/pstree.h
@@ -24,12 +24,6 @@ struct pstree_item {
 
 	int			state;		/* TASK_XXX constants */
 
-	/*
-	 * On restore, we set this flag when process has seccomp filters so
-	 * that we know to suspend them before we unmap the restorer blob.
-	 */
-	bool			has_seccomp;
-
 	int			nr_threads;	/* number of threads */
 	struct pid		*threads;	/* array of threads */
 	CoreEntry		**core;
diff --git a/include/rst_info.h b/include/rst_info.h
index d850761..5fab162 100644
--- a/include/rst_info.h
+++ b/include/rst_info.h
@@ -58,6 +58,13 @@ struct rst_info {
 	bool			has_umask;
 	u32			umask;
 
+	/*
+	 * We set this flag when process has seccomp filters
+	 * so that we know to suspend them before we unmap the
+	 * restorer blob.
+	 */
+	bool			has_seccomp;
+
 	void			*breakpoint;
 };
 
-- 
1.9.3



More information about the CRIU mailing list