linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kay Sievers <kay.sievers@vrfy.org>
To: Scott James Remnant <scott@netsplit.com>
Cc: Lennart Poettering <lennart@poettering.net>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] exit: PR_SET_ANCHOR for marking processes as reapers for child processes
Date: Mon, 20 Dec 2010 15:51:15 +0100	[thread overview]
Message-ID: <AANLkTim1KYjRDR2vF2RE-VJ-8ML9ewcQbW4PuxB13DPP@mail.gmail.com> (raw)
In-Reply-To: <AANLkTik052sWOtqNyVdg6g6+cvo-NE-TBdSGdmmp_7en@mail.gmail.com>

On Mon, Dec 20, 2010 at 15:26, Scott James Remnant <scott@netsplit.com> wrote:
> On Tue, Feb 2, 2010 at 12:04 PM, Lennart Poettering
> <lennart@poettering.net> wrote:
>
>> Right now, if a process dies all its children are reparented to init.
>> This logic has good uses, i.e. for double forking when daemonizing.
>> However it also allows child processes to "escape" their parents, which
>> is a problem for software like session managers (such as gnome-session)
>> or other process supervisors.
>>
>> This patch adds a simple flag for each process that marks it as an
>> "anchor" process for all its children and grandchildren. If a child of
>> such an anchor dies all its children will not be reparented to init, but
>> instead to this anchor, escaping this anchor process is not possible. A
>> task with this flag set hence acts is little "sub-init".
>>
> Why can't you simply begin a new pid namespace with the session
> manager or other process supervisor?

We do not want to disconnect users from the system. Too much stuff
depends on that for good reasons.

This is only about a "user init" process, which is a much softer
concept which better fits into our current setups. It is not really
about disconnecting the user from the system, by putting him in a
"container".

The systems view from the management/administration perspective, with
users with their own pids, would really get far to complicated, I
think.

> That way the session
> manager/process supervisor is for all intents and purposes an init
> daemon, so shouldn't be surprised about getting SIGCHLD.

That shouldn't be a problem.

> More to the point, it means that as far as the processes themselves
> are concerned, they're being reparented to pid 1 just as they were
> before, so you wouldn't be breaking any assumptions there either.

For now, I don't think that this will break anything. Stuff that
really expects to have ppid() ==  1 should be fixed anyway.

> You could use the existing init daemon to create these pid namespaces
> when it spawns the session manager.

We already use the existing init daemon for that. :)

This is mainly about 'prettifying ps'. The cgroups already provide us
with all the needed information, it would be just nice to localize
SIGCHLD handling to the "user init", where the signal belongs to.

Kay

  reply	other threads:[~2010-12-20 14:58 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-02 12:04 [PATCH] exit: PR_SET_ANCHOR for marking processes as reapers for child processes Lennart Poettering
2010-02-03  8:24 ` KOSAKI Motohiro
2010-02-03  9:53   ` Lennart Poettering
2010-02-03 15:31 ` Américo Wang
2010-02-03 17:49   ` Lennart Poettering
2010-02-05  9:54     ` Américo Wang
2010-02-11 10:21       ` Kay Sievers
2010-02-04 15:42 ` Kay Sievers
2010-02-04 20:59   ` Kay Sievers
2010-03-04 14:08 ` Oleg Nesterov
2010-03-04 22:14   ` Roland McGrath
2010-03-05 18:51     ` Kay Sievers
2010-03-05 19:18       ` Roland McGrath
2010-03-06  0:24         ` Lennart Poettering
2010-03-09  0:45           ` Ray Lee
2010-03-09 13:19             ` Oleg Nesterov
2010-03-06  0:20     ` Lennart Poettering
2010-03-08 23:11       ` Roland McGrath
2010-03-05  4:47   ` KOSAKI Motohiro
2010-03-05 18:55     ` Kay Sievers
2010-03-06  0:16   ` Lennart Poettering
2010-03-11  4:14     ` Eric W. Biederman
2010-03-11  7:56       ` KOSAKI Motohiro
2010-12-20 14:26 ` Scott James Remnant
2010-12-20 14:51   ` Kay Sievers [this message]
2010-12-21  9:56   ` Lennart Poettering
2010-12-21 12:05     ` Scott James Remnant
2010-12-23 15:44       ` Lennart Poettering
2010-12-23 16:00         ` Scott James Remnant

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=AANLkTim1KYjRDR2vF2RE-VJ-8ML9ewcQbW4PuxB13DPP@mail.gmail.com \
    --to=kay.sievers@vrfy.org \
    --cc=lennart@poettering.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=scott@netsplit.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;
as well as URLs for NNTP newsgroup(s).