[CRIU] [PATCH 03/10] pstree: add id intersection bug_on to prepare_pstree_for_shell_job

Pavel Tikhomirov ptikhomirov at virtuozzo.com
Tue Jul 4 12:08:02 MSK 2017


What if we replace ids in pstree to some new id, which we already
have in tree, that can leed to unexpected behaviour.

Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
---
 criu/pstree.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/criu/pstree.c b/criu/pstree.c
index e712dd3..b4d993f 100644
--- a/criu/pstree.c
+++ b/criu/pstree.c
@@ -488,8 +488,10 @@ static int prepare_pstree_for_shell_job(void)
 		old_gid, current_gid, old_sid, current_sid);
 
 	for_each_pstree_item(pi) {
+		BUG_ON(vpgid(pi) == current_gid);
 		if (vpgid(pi) == old_gid)
 			vpgid(pi) = current_gid;
+		BUG_ON(vsid(pi) == current_sid);
 		if (vsid(pi) == old_sid)
 			vsid(pi) = current_sid;
 	}
-- 
2.9.4



More information about the CRIU mailing list