From: Oleg Nesterov <oleg@tv-sign.ru>
To: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Sukadev Bhattiprolu <sukadev@us.ibm.com>,
Cedric Le Goater <clg@fr.ibm.com>,
Dave Hansen <haveblue@us.ibm.com>,
Serge Hallyn <serue@us.ibm.com>,
containers@lists.osdl.org,
Andrew Morton <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org
Subject: Re: + remove-the-likelypid-check-in-copy_process.patch added to -mm tree
Date: Sat, 17 Mar 2007 20:17:47 +0300 [thread overview]
Message-ID: <20070317171747.GA134@tv-sign.ru> (raw)
In-Reply-To: <m1fy83ls75.fsf@ebiederm.dsl.xmission.com>
On 03/17, Eric W. Biederman wrote:
>
> Oleg Nesterov <oleg@tv-sign.ru> writes:
>
> > On 03/17, Oleg Nesterov wrote:
> >>
> >> > Well the initial kernel process does not have a struct pid so when
> >> > it's children start doing:
> >> > attach_pid(p, PIDTYPE_PGID, task_group(p));
> >> > attach_pid(p, PIDTYPE_SID, task_session(p));
> >> > We will get an oops.
> >>
> >> So far this is the only reason to have init_struct_pid. Because the
> >> boot CPU (swapper) forks, right?
> >
> > Damn. I am afraid I was not clear again :) Not init_struct_pid, but
> >
> > + .pids = { \
> > + [PIDTYPE_PID] = INIT_PID_LINK(PIDTYPE_PID), \
> > + [PIDTYPE_PGID] = INIT_PID_LINK(PIDTYPE_PGID), \
> > + [PIDTYPE_SID] = INIT_PID_LINK(PIDTYPE_SID), \
> > + }, \
> >
> > for INIT_TASK().
> >
> >> > So a dummy unhashed struct pid was added for the idle threads.
> >> > Allowing several special cases in the code to be removed.
> >> >
> >> > With that chance the previous special case to force the idle thread
> >> > init session 1 pgrp 1 no longer works because attach_pid no longer
> >> > looks at the pid value but instead at the struct pid pointers.
> >> >
> >> > So we had to add the __set_special_pids() to continue to keep init
> >> > in session 1 pgrp 1. Since /sbin/init calls setsid() that our setting
> >> > the sid and the pgrp may not be strictly necessary. Still is better
> >> > to not take any chances.
> >>
> >> Yes, yes, I see. But my (very unclear, sorry) question was: shouldn't we
> >> change INIT_SIGNALS then? /sbin/init inherits ->pgrp == ->_session == 1,
> >> in that case __set_special_pids(1,1) does nothing.
> >
> > ... and thus /sbin/init remains attached to the .pids above, no?
>
> The problem is that we dynamically allocate the struct pid for
> pid_t == 1 when we fork init.
>
> Which means we don't have access to it at compile time so we can
> no longer make INIT_SIGNALS set ->gprp == ->session == 1.
Yes! I meant we should change INIT_SIGNALS(), currently it does
#define INIT_SIGNALS(sig) {
...
.pgrp = 1,
{ .__session = 1},
and this confuses (I think) set_special_pids(1,1) above. Because
__set_special_pids() still deals with pid_t, not "struct pid".
Unless I missed something, we should kill these 2 initializations
above.
Oleg.
next prev parent reply other threads:[~2007-03-17 17:14 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-16 17:02 + remove-the-likelypid-check-in-copy_process.patch added to -mm tree Oleg Nesterov
2007-03-16 18:27 ` Eric W. Biederman
2007-03-17 13:02 ` Oleg Nesterov
2007-03-17 14:04 ` Eric W. Biederman
2007-03-17 15:09 ` Oleg Nesterov
2007-03-17 15:24 ` Oleg Nesterov
2007-03-17 17:01 ` Eric W. Biederman
2007-03-17 17:17 ` Oleg Nesterov [this message]
2007-03-17 18:54 ` Eric W. Biederman
2007-03-18 6:50 ` sukadev
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=20070317171747.GA134@tv-sign.ru \
--to=oleg@tv-sign.ru \
--cc=akpm@linux-foundation.org \
--cc=clg@fr.ibm.com \
--cc=containers@lists.osdl.org \
--cc=ebiederm@xmission.com \
--cc=haveblue@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=serue@us.ibm.com \
--cc=sukadev@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