From: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
To: Roland McGrath <roland@redhat.com>
Cc: Oleg Nesterov <oleg@redhat.com>,
"Eric W. Biederman" <ebiederm@xmission.com>,
Oren Laadan <orenl@cs.columbia.edu>,
serue@us.ibm.com, Alexey Dobriyan <adobriyan@gmail.com>,
Containers <containers@lists.linux-foundation.org>,
linux-kernel@vger.kernel.org
Subject: Re: [RFC][PATCH] Disable CLONE_PARENT for init
Date: Wed, 1 Jul 2009 17:35:20 -0700 [thread overview]
Message-ID: <20090702003520.GA26247@us.ibm.com> (raw)
In-Reply-To: <20090701215833.876DA404FD@magilla.sf.frob.com>
Roland McGrath [roland@redhat.com] wrote:
| Yeah, that's fine. Since Oleg's pointed out that there is indeed no way to
| avoid the leak in some global-init uses, it is fine to have a comment that
| says that global init problems are part of the reason to outlaw this usage.
| I just objected to a change that was really for container init but said it
| was only to fix something different.
Ok. How about this comment:
---
Disable CLONE_PARENT for init.
When global or container-init processes use CLONE_PARENT, they create a
multi-rooted process tree. Besides siblings of global init remain as
zombies on exit since they are not reaped by their parent (swapper). So
prevent global and container-inits from creating siblings.
Changelog[v3]:
- [Roland, Oleg] Simplify comment describing the change
Changelog[v2]:
- Simplify patch description based on comments from Eric Biederman
and Oleg Nesterov.
- [Oleg Nesterov] Use SIGNAL_UNKILLABLE instead of is_global_init()
Signed-off-by: Sukadev Bhattiprolu <sukadev@us.ibm.com>
Acked-by: "Eric W. Biederman" <ebiederm@xmission.com>
---
kernel/fork.c | 10 ++++++++++
1 file changed, 10 insertions(+)
Index: linux-mmotm/kernel/fork.c
===================================================================
--- linux-mmotm.orig/kernel/fork.c 2009-06-30 23:01:06.000000000 -0700
+++ linux-mmotm/kernel/fork.c 2009-07-01 17:29:09.000000000 -0700
@@ -974,6 +974,16 @@ static struct task_struct *copy_process(
if ((clone_flags & CLONE_SIGHAND) && !(clone_flags & CLONE_VM))
return ERR_PTR(-EINVAL);
+ /*
+ * Siblings of global init remain as zombies on exit since they are
+ * not reaped by their parent (swapper). To solve this and to avoid
+ * multi-rooted process trees, prevent global and container-inits
+ * from creating siblings.
+ */
+ if ((clone_flags & CLONE_PARENT) &&
+ current->signal->flags & SIGNAL_UNKILLABLE)
+ return ERR_PTR(-EINVAL);
+
retval = security_task_create(clone_flags);
if (retval)
goto fork_out;
next prev parent reply other threads:[~2009-07-02 0:39 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-01 7:31 [RFC][PATCH] Disable CLONE_PARENT for init Sukadev Bhattiprolu
2009-07-01 7:46 ` Roland McGrath
2009-07-01 8:01 ` Sukadev Bhattiprolu
2009-07-01 8:24 ` Oleg Nesterov
2009-07-01 21:48 ` Sukadev Bhattiprolu
2009-07-01 21:58 ` Roland McGrath
2009-07-02 0:35 ` Sukadev Bhattiprolu [this message]
2009-07-02 0:49 ` Roland McGrath
2009-07-02 7:58 ` Oleg Nesterov
2009-07-02 12:36 ` Oleg Nesterov
2009-07-01 23:27 ` Eric W. Biederman
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=20090702003520.GA26247@us.ibm.com \
--to=sukadev@linux.vnet.ibm.com \
--cc=adobriyan@gmail.com \
--cc=containers@lists.linux-foundation.org \
--cc=ebiederm@xmission.com \
--cc=linux-kernel@vger.kernel.org \
--cc=oleg@redhat.com \
--cc=orenl@cs.columbia.edu \
--cc=roland@redhat.com \
--cc=serue@us.ibm.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