From: "Daniel Hokka Zakrisson" <daniel@hozac.com>
To: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: "Pavel Emelyanov" <xemul@openvz.org>,
linux-kernel@vger.kernel.org,
containers@lists.linux-foundation.org, oleg@tv-sign.ru,
akpm@linux-foundation.org
Subject: Re: [PATCH 1/2] signals: kill(-1) should only signal processes in the same namespace
Date: Thu, 17 Jul 2008 20:39:14 +0200 (CEST) [thread overview]
Message-ID: <33935.192.168.102.6.1216319954.squirrel@intranet> (raw)
In-Reply-To: <m13am8wgk6.fsf@frodo.ebiederm.org>
Eric W. Biederman wrote:
> "Daniel Hokka Zakrisson" <daniel@hozac.com> writes:
>
>> Pavel Emelyanov wrote:
>>> Daniel Hokka Zakrisson wrote:
>>>> While moving Linux-VServer to using pid namespaces, I noticed that
>>>> kill(-1) from inside a pid namespace is currently signalling every
>>>> process in the entire system, including processes that are otherwise
>>>> unreachable from the current process.
>>>
>>> This is not a "news" actually, buy anyway - thanks :)
>>
>> And yet nobody's fixed it... Kind of a critical thing, if you actually
>> want to use them, since most distribution's rc-scripts do a kill(-1,
>> SIGTERM), followed by kill(-1, SIGKILL) when halting (which, needless to
>> say, would be very bad).
>>
>>>> This patch fixes it by making sure that only processes which are in
>>>> the same pid namespace as current get signalled.
>>>
>>> This is to be done, indeed, but I do not like the proposed
>>> implementation,
>>> since you have to walk all the tasks in the system (under
>>> tasklist_lock,
>>> by the way) to search for a couple of interesting ones. Better look at
>>> how
>>> zap_pid_ns_processes works (by the way - I saw some patch doing so some
>>> time ago).
>>
>> The way zap_pid_ns_processes does it is worse, since it signals every
>> thread in the namespace rather than every thread group. So either we
>> walk
>> the global tasklist, or we create a per-namespace one. Is that what we
>> want?
>
> Can you please introduce kill_pidns_info and have both
> kill_something_info and zap_pid_ns_processes call this common
> function?
Looks like you've already done that. :-) (Referring to Sukadev's email.)
Is there any reason we don't just merge that patch?
> We want to walk the set of all pids in a pid namespace. /proc does
> this and it is the recommended idiom. If walking all of the pids in a
> pid namespace is not fast enough we can accelerate that.
>
> You are correct signalling every thread in a namespace is worse, in
> fact it is semantically incorrect. zap_pid_ns_processes gets away
> with it because it is sending SIGKILL. Therefore kill_pidns_info
> should skip sending a signal to every task that is not the
> thread_group_leader.
>
> We need to hold the tasklist_lock to prevent new processes from
> joining the list of all processes. Otherwise we could run the code
> under the rcu_read_lock.
>
> Eric
--
Daniel Hokka Zakrisson
next prev parent reply other threads:[~2008-07-17 18:39 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-17 14:55 Daniel Hokka Zakrisson
2008-07-17 15:01 ` Pavel Emelyanov
2008-07-17 15:24 ` Daniel Hokka Zakrisson
2008-07-17 15:54 ` Pavel Emelyanov
2008-07-17 17:32 ` Oleg Nesterov
2008-07-17 17:50 ` Eric W. Biederman
2008-07-17 17:45 ` Eric W. Biederman
2008-07-17 18:39 ` Daniel Hokka Zakrisson [this message]
2008-07-17 18:45 ` Eric W. Biederman
2008-07-17 18:13 ` sukadev
2008-07-17 18:44 ` Daniel Hokka Zakrisson
2008-07-17 18:46 ` Eric W. Biederman
2008-07-23 14:34 ` Oleg Nesterov
2008-07-23 16:09 ` Daniel Hokka Zakrisson
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=33935.192.168.102.6.1216319954.squirrel@intranet \
--to=daniel@hozac.com \
--cc=akpm@linux-foundation.org \
--cc=containers@lists.linux-foundation.org \
--cc=ebiederm@xmission.com \
--cc=linux-kernel@vger.kernel.org \
--cc=oleg@tv-sign.ru \
--cc=xemul@openvz.org \
/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
all inboxes | Powered by JetHome®