public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Oleg Nesterov <oleg@redhat.com>
Cc: Valdis.Kletnieks@vt.edu, Kay Sievers <kay.sievers@vrfy.org>,
	linux-kernel@vger.kernel.org,
	Lennart Poettering <lennart@poettering.net>
Subject: Re: [PATCH] prctl: add PR_{SET,GET}_CHILD_SUBREAPER to allow simple process supervision
Date: Fri, 13 Jan 2012 16:35:58 -0800	[thread overview]
Message-ID: <20120113163558.a662e7c5.akpm@linux-foundation.org> (raw)
In-Reply-To: <20120109150701.GB1777@redhat.com>

On Mon, 9 Jan 2012 16:07:01 +0100
Oleg Nesterov <oleg@redhat.com> wrote:

> > > +		/* find the first ancestor marked as child_subreaper */
> > > +		for (reaper = father->real_parent;
> > > +		     reaper != &init_task;
> > > +		     reaper = reaper->real_parent) {
> >
> > I admit being insufficiently caffienated - does this DTRT in a PID namespace? That
> > &init_task looks fishy to me...
> 
> Probably this needs a comment. Initially I was confused too.
> 
> 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

In light of Kay's haughty silence, I did this:

--- a/kernel/exit.c~prctl-add-pr_setget_child_subreaper-to-allow-simple-process-supervision-fix-fix
+++ a/kernel/exit.c
@@ -724,7 +724,13 @@ static struct task_struct *find_new_reap
 	} else if (father->signal->has_child_subreaper) {
 		struct task_struct *reaper;
 
-		/* find the first ancestor marked as child_subreaper */
+		/*
+		 * 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
+		 */
 		for (reaper = father->real_parent;
 		     reaper != &init_task;
 		     reaper = reaper->real_parent) {
_

I'm not a fan of URLs-in-comments, but that email was too gnarly to be
condensed into a sane comment.


  reply	other threads:[~2012-01-14  0:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-07 15:56 [PATCH] prctl: add PR_{SET,GET}_CHILD_SUBREAPER to allow simple process supervision Kay Sievers
2012-01-07 16:13 ` Valdis.Kletnieks
2012-01-09 15:07   ` Oleg Nesterov
2012-01-14  0:35     ` Andrew Morton [this message]
2012-01-14 13:59       ` Kay Sievers
2012-04-23 22:36 ` Michael Kerrisk
2013-01-10 22:48   ` Michael Kerrisk (man-pages)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120113163558.a662e7c5.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=Valdis.Kletnieks@vt.edu \
    --cc=kay.sievers@vrfy.org \
    --cc=lennart@poettering.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleg@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox