aboutsummaryrefslogtreecommitdiff
path: root/kernel/exit.c
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@redhat.com>2014-12-10 15:55:08 -0800
committerMoyster <oysterized@gmail.com>2019-05-02 18:27:05 +0200
commit5e0dbc3de354e611df4c74f28bbd16f96d013539 (patch)
tree518ae9727e9a3fbea2534df2ccef4d337f1e9118 /kernel/exit.c
parent38b5fc54686dd479f58152ef99ec7bc62ab3214b (diff)
exit: reparent: document the ->has_child_subreaper checks
Swap the "init_task" and same_thread_group() checks. This way it is more simple to document these checks and we can remove the link to the previous discussion on lkml. Change-Id: Ie062e114468bb4922193d1e14265f49fb96f24ad Signed-off-by: Oleg Nesterov <oleg@redhat.com> Cc: Aaron Tomlin <atomlin@redhat.com> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Cc: Kay Sievers <kay@vrfy.org> Cc: Lennart Poettering <lennart@poettering.net> Cc: Sterling Alexander <stalexan@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/exit.c')
-rw-r--r--kernel/exit.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/kernel/exit.c b/kernel/exit.c
index b3f31e8fb..edf774890 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -498,18 +498,16 @@ static struct task_struct *find_new_reaper(struct task_struct *father)
if (father->signal->has_child_subreaper) {
struct task_struct *reaper;
-
/*
- * Find the first ancestor marked as child_subreaper.
- * Note that the code below checks same_thread_group(reaper,
- * pid_ns->child_reaper). This is what we need to DTRT in a
- * PID namespace. However we still need the check above, see
- * http://marc.info/?l=linux-kernel&m=131385460420380
+ * Find the first ->is_child_subreaper ancestor in our pid_ns.
+ * We start from father to ensure we can not look into another
+ * namespace, this is safe because all its threads are dead.
*/
for (reaper = father;
- reaper != &init_task;
+ !same_thread_group(reaper, pid_ns->child_reaper);
reaper = reaper->real_parent) {
- if (same_thread_group(reaper, pid_ns->child_reaper))
+ /* call_usermodehelper() descendants need this check */
+ if (reaper == &init_task)
break;
if (!reaper->signal->is_child_subreaper)
continue;