[CRIU] Re: Before we do the CRIU v0.1 release

Cyrill Gorcunov gorcunov at openvz.org
Fri Jul 20 06:19:57 EDT 2012


On Fri, Jul 20, 2012 at 02:11:57PM +0400, Cyrill Gorcunov wrote:
> On Fri, Jul 20, 2012 at 02:10:11PM +0400, Pavel Emelyanov wrote:
> > 
> > Need to add patch that checks for core entry tc, ti and ids being
> > non NULL for main thread.
> 
> Yeah, will add, sorry forgot about it ;)

Here we go

	Cyrill
-------------- next part --------------
>From c3a35bbe321578aea1cea6e4130064f8528fb8fa Mon Sep 17 00:00:00 2001
From: Cyrill Gorcunov <gorcunov at openvz.org>
Date: Fri, 20 Jul 2012 14:18:53 +0400
Subject: [PATCH] restore: Add test for optional PB fields in core_entry

Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 cr-restore.c |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/cr-restore.c b/cr-restore.c
index 74efc2e..65f698b 100644
--- a/cr-restore.c
+++ b/cr-restore.c
@@ -391,7 +391,7 @@ static int restore_one_zombie(int pid, int exit_code)
 	return -1;
 }
 
-static int check_core_header(int pid, CoreEntry *core)
+static int check_core(int pid, CoreEntry *core)
 {
 	int fd = -1, ret = -1;
 
@@ -403,6 +403,17 @@ static int check_core_header(int pid, CoreEntry *core)
 		pr_err("Core march mismatch %d\n", (int)core->mtype);
 		goto out;
 	}
+
+	if (!core->tc) {
+		pr_err("Core task state data missed\n");
+		goto out;
+	}
+
+	if (!core->ids && core->tc->task_state != TASK_DEAD) {
+		pr_err("Core IDS data missed for non-zombie\n");
+		goto out;
+	}
+
 	ret = 0;
 out:
 	close_safe(&fd);
@@ -427,7 +438,7 @@ static int restore_one_task(int pid)
 	if (ret < 0)
 		return -1;
 
-	if (check_core_header(pid, core)) {
+	if (check_core(pid, core)) {
 		ret = -1;
 		goto out;
 	}
-- 
1.7.7.6



More information about the CRIU mailing list