Skip to content

Commit 21a6758

Browse files
Snorchrst0git
authored andcommitted
cr-restore/shstk: Make arch_shstk_unlock use correct pid
In a simple case where the parent process and the child one are in one pid namespace we can safely use vpid(item) to prace the child. But, for the cases where the child is a pid namespace init, or the child is put into external pid namespace, the parent and the child have different pid namespaces and using pid vpid(item) (which e.g. for init will always be 1 here) to ptrace the child process is inorrect. Let's use the pid reported to us from clone as it's always the right pid of the child from the parent's point of view. Fixes: 7dd5830 ("restore: add infrastructure to enable shadow stack") Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
1 parent 07af330 commit 21a6758

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

criu/cr-restore.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1238,7 +1238,7 @@ static inline int fork_with_pid(struct pstree_item *item)
12381238
pr_debug("PID: real %d virt %d\n", item->pid->real, vpid(item));
12391239
}
12401240

1241-
arch_shstk_unlock(item, ca.core, pid);
1241+
arch_shstk_unlock(item, ca.core, ret);
12421242

12431243
err_unlock:
12441244
if (!(ca.clone_flags & CLONE_NEWPID))

0 commit comments

Comments
 (0)