[RESEND,v1,53/55] pid: Check for equality of getpid() of child to last_level_pid

Submitted by Kirill Tkhai on March 24, 2017, 3:17 p.m.

Details

Message ID 149036864140.23093.145043696339869654.stgit@localhost.localdomain
State New
Series "Nested pid namespaces support"
Headers show

Commit Message

Kirill Tkhai March 24, 2017, 3:17 p.m.
Make the sanity check working in case of mutli-level pids.

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
---
 criu/cr-restore.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/criu/cr-restore.c b/criu/cr-restore.c
index b6040a53..bb5abd70 100644
--- a/criu/cr-restore.c
+++ b/criu/cr-restore.c
@@ -1429,9 +1429,11 @@  static int restore_task_with_children(void *_arg)
 			goto err;
 	}
 
+
 	pid = getpid();
-	if (vpid(current) != pid) {
-		pr_err("Pid %d do not match expected %d\n", pid, vpid(current));
+	if (last_level_pid(current->pid) != pid) {
+		pr_err("Pid %d do not match expected %d (task %d)\n",
+			pid, last_level_pid(current->pid), vpid(current));
 		set_task_cr_err(EEXIST);
 		goto err;
 	}