From c26313e48918ad80552b1e1f074e38fd240bb45c Mon Sep 17 00:00:00 2001 From: EulerOSWander <314264452@qq.com> Date: Mon, 19 Jun 2023 09:04:20 +0000 Subject: [PATCH] revert: fix BUG at criu/pstree.c:452 Signed-off-by: EulerOSWander <314264452@qq.com> --- criu.spec | 6 +- revert-fix-BUG-at-criu-pstree.c-452.patch | 90 +++++++++++++++++++++++ 2 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 revert-fix-BUG-at-criu-pstree.c-452.patch diff --git a/criu.spec b/criu.spec index 7a9df1b..ff4fe1f 100644 --- a/criu.spec +++ b/criu.spec @@ -1,6 +1,6 @@ Name: criu Version: 3.16.1 -Release: 8 +Release: 9 Provides: crtools = %{version}-%{release} Obsoletes: crtools <= 1.0-2 Summary: A tool of Checkpoint/Restore in User-space @@ -17,6 +17,7 @@ Obsoletes: %{name}-libs < %{version}-%{release} Patch1: 0001-criu-dump-and-restore-cpu-affinity-of-each-thread.patch Patch2: 0002-mm-add-pin-memory-method-for-criu.patch +Patch3: revert-fix-BUG-at-criu-pstree.c-452.patch Patch1000: 1000-backport-page-pipe-fix-limiting-a-pipe-size.patch Patch1001: 1001-backport-tty-fix-the-null-pointer-of-get_tty_driver.patch @@ -104,6 +105,9 @@ chmod 0755 %{buildroot}/run/%{name}/ %doc %{_mandir}/man1/{compel.1*,crit.1*,criu-ns.1*} %changelog +* Mon Jun 19 2023 hewenliang <314264452@qq.com> - 3.16.1-9 +- revert: fix BUG at criu/pstree.c:452 + * Mon Jun 19 2023 hewenliang <314264452@qq.com> - 3.16.1-8 - revert "rseq c/r support" diff --git a/revert-fix-BUG-at-criu-pstree.c-452.patch b/revert-fix-BUG-at-criu-pstree.c-452.patch new file mode 100644 index 0000000..077e35b --- /dev/null +++ b/revert-fix-BUG-at-criu-pstree.c-452.patch @@ -0,0 +1,90 @@ +Subject: [PATCH 1/1] revert: fix BUG at criu/pstree.c:452 + +Not all the process which is dumped by criu is session leader, the +enhancing verification is annoying, because it causes many problems in +some testcases. Therefore, revert this bugfix. + +If the bugfix is resumed, using `setsid` to start process is necessary, +and using `stdbuf -oL` to redirect standard output at the same time. + +This bug detail sees #1332. + +Revert "pstree: don't change sid/gid-s if current sid/gid is the same" +This reverts commit 90e03b1a1142ca40fb78de9eb04944ab51d06eeb. + +Revert "pstree: check for pid collision before switching to new sid/gid" +This reverts commit 7e6a1a7011b404fbf0108b062bda118e9a696b60. +--- + criu/pstree.c | 37 ++++++++++--------------------------- + 1 file changed, 10 insertions(+), 27 deletions(-) + +diff --git a/criu/pstree.c b/criu/pstree.c +index d5080e515..bf09c761c 100644 +--- a/criu/pstree.c ++++ b/criu/pstree.c +@@ -340,7 +340,6 @@ static int prepare_pstree_for_shell_job(pid_t pid) + pid_t current_gid = getpgid(pid); + + struct pstree_item *pi; +- struct pid *tmp; + + pid_t old_sid; + pid_t old_gid; +@@ -348,7 +347,6 @@ static int prepare_pstree_for_shell_job(pid_t pid) + if (!opts.shell_job) + return 0; + +- /* root_item is a session leader */ + if (root_item->sid == vpid(root_item)) + return 0; + +@@ -370,37 +368,22 @@ static int prepare_pstree_for_shell_job(pid_t pid) + */ + + old_sid = root_item->sid; +- if (old_sid != current_sid) { +- pr_info("Migrating process tree (SID %d->%d)\n", old_sid, current_sid); + +- tmp = pstree_pid_by_virt(current_sid); +- if (tmp) { +- pr_err("Current sid %d intersects with pid (%d) in images\n", current_sid, tmp->state); +- return -1; +- } ++ pr_info("Migrating process tree (SID %d->%d)\n", ++ old_sid, current_sid); + +- for_each_pstree_item(pi) { +- if (pi->sid == old_sid) +- pi->sid = current_sid; +- } +- +- if (lookup_create_item(current_sid) == NULL) +- return -1; ++ for_each_pstree_item(pi) { ++ if (pi->sid == old_sid) ++ pi->sid = current_sid; + } + +- /* root_item is a group leader */ +- if (root_item->pgid == vpid(root_item)) +- return 0; +- + old_gid = root_item->pgid; +- if (old_gid != current_gid) { +- pr_info("Migrating process tree (GID %d->%d)\n", old_gid, current_gid); +- +- tmp = pstree_pid_by_virt(current_gid); +- if (tmp) { +- pr_err("Current gid %d intersects with pid (%d) in images\n", current_gid, tmp->state); ++ if (old_gid != vpid(root_item)) { ++ if (lookup_create_item(current_sid) == NULL) + return -1; +- } ++ ++ pr_info("Migrating process tree (GID %d->%d)\n", ++ old_gid, current_gid); + + for_each_pstree_item(pi) { + if (pi->pgid == old_gid) +-- +2.35.1 \ No newline at end of file -- Gitee