[Devel] [PATCH RHEL7 COMMIT] ms/exit: reparent: fix the dead-parent PR_SET_CHILD_SUBREAPER reparenting
Konstantin Khorenko
khorenko at virtuozzo.com
Mon Jun 20 21:12:50 MSK 2022
The commit is pushed to "branch-rh7-3.10.0-1160.62.1.vz7.187.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1160.62.1.vz7.187.5
------>
commit dae63ac53617b26ca1b5e0d8bbb4c0f3a15dd205
Author: Oleg Nesterov <oleg at redhat.com>
Date: Wed Jun 15 17:54:21 2022 +0300
ms/exit: reparent: fix the dead-parent PR_SET_CHILD_SUBREAPER reparenting
The ->has_child_subreaper code in find_new_reaper() finds alive "thread"
but returns another "reaper" thread which can be dead.
Signed-off-by: Oleg Nesterov <oleg at redhat.com>
Cc: Aaron Tomlin <atomlin at redhat.com>
Cc: "Eric W. Biederman" <ebiederm at xmission.com>
Cc: Kay Sievers <kay at vrfy.org>
Cc: Lennart Poettering <lennart at poettering.net>
Cc: Sterling Alexander <stalexan at redhat.com>
Signed-off-by: Andrew Morton <akpm at linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
(cherry picked from ms commit 8a1296aea4a319b33c3367ff3805835e949a229f)
Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
=================
Patchset description:
vz7: fix child-reaper reparenting
Forth patch is needed as kernel can reparent process to a dead thread
which is wrong.
Third patch is needed as kernel could reparent process from father from
one pidns to process from different pidns, which creates configurations
not supported by CRIU. Found it when reproducing problem from CRIU
mainstream issue in VZ7 ct.
https://github.com/checkpoint-restore/criu/issues/1914
First and Second are just to make it apply cleaner.
Oleg Nesterov (4):
exit: reparent: fix the cross-namespace PR_SET_CHILD_SUBREAPER
reparenting
exit: reparent: document the ->has_child_subreaper checks
exit: fix the setns() && PR_SET_CHILD_SUBREAPER interaction
exit: reparent: fix the dead-parent PR_SET_CHILD_SUBREAPER reparenting
---
kernel/exit.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/exit.c b/kernel/exit.c
index 4ba3a108d449..be276aaecaeb 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -662,7 +662,7 @@ static struct task_struct *find_new_reaper(struct task_struct *father)
thread = reaper;
do {
if (!(thread->flags & PF_EXITING))
- return reaper;
+ return thread;
} while_each_thread(reaper, thread);
}
}
More information about the Devel
mailing list