[CRIU] [PATCH] criu: don't abort criu in lookup_create_item()

Andrei Vagin avagin at openvz.org
Tue Jul 18 01:19:35 MSK 2017


From: Andrei Vagin <avagin at virtuozzo.com>

Currently lookup_create_item() calls BUG_ON(), if it meets a thread.
We don't expect to meet a thread there, but if images contain incorrect
data, we can be in this situation in open_remap_dead_process().

(gdb) bt

Signed-off-by: Andrei Vagin <avagin at virtuozzo.com>
---
 criu/pstree.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/criu/pstree.c b/criu/pstree.c
index 9ae1912..3fca758 100644
--- a/criu/pstree.c
+++ b/criu/pstree.c
@@ -612,7 +612,11 @@ struct pstree_item *lookup_create_item(pid_t *pid, int level, uint32_t ns_id)
 	node = lookup_create_pid(pid, level, NULL, ns_id);
 	if (!node)
 		return NULL;
-	BUG_ON(node->state == TASK_THREAD);
+
+	if (node->state == TASK_THREAD) {
+		pr_err("The %d node is used for a thread\n", *pid);
+		return NULL;
+	}
 
 	return node->item;
 }
-- 
2.9.4



More information about the CRIU mailing list