From: Dave Hansen <haveblue@us.ibm.com>
To: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
linux-kernel@vger.kernel.org,
Linux Containers <containers@lists.osdl.org>,
Andrew Morton <akpm@linux-foundation.org>,
Oleg Nesterov <oleg@tv-sign.ru>,
Pavel Emelyanov <xemul@openvz.org>,
"Sukadev Bhattiprolu [imap]" <sukadev@us.ibm.com>
Subject: Re: [PATCH] pidns: Limit kill -1 and cap_set_all
Date: Mon, 29 Oct 2007 09:02:18 -0700 [thread overview]
Message-ID: <1193673738.24087.176.camel@localhost> (raw)
In-Reply-To: <m1k5p9zk6b.fsf_-_@ebiederm.dsl.xmission.com>
On Fri, 2007-10-26 at 14:37 -0600, Eric W. Biederman wrote:
>
> +static int pid_in_pid_ns(struct pid *pid, struct pid_namespace *ns)
> +{
> + return pid && (ns->level <= pid->level) &&
> + pid->numbers[ns->level].ns == ns;
> +}
Could we blow this out a little bit? (I think the blown-out version
lends itself to being better commented, and easier to read.) Also, can
we think of any better name for this? It seems a bit funky that:
pid_in_pid_ns(mypid, &init_pid_ns);
would _ever_ return 0. So, it isn't truly a test for belonging *in* a
namespace, but having that namespace be the lowest level one. I think
Suka toyed with calling it an "active" or "primary" pid namespace. That
differentiated mere membership in a pid namespace from the one that
actually molds that pid's view of the world.
static int pid_in_pid_ns(struct pid *pid, struct pid_namespace *ns)
{
if (!pid)
return 0;
if (ns->level > pid->level)
return 0;
if (pid->numbers[ns->level].ns != ns)
return 0;
return 1;
}
-- Dave
next prev parent reply other threads:[~2007-10-29 16:02 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-26 17:48 [PATCH] proc: Fix proc_kill_inodes to kill dentries on all proc superblocks Eric W. Biederman
2007-10-26 18:06 ` Linus Torvalds
2007-10-26 18:36 ` Eric W. Biederman
2007-10-26 19:43 ` [PATCH] proc: Simplify and correct proc_flush_task Eric W. Biederman
2007-10-26 20:37 ` [PATCH] pidns: Limit kill -1 and cap_set_all Eric W. Biederman
2007-10-29 8:38 ` Kirill Korotaev
2007-10-29 18:07 ` Eric W. Biederman
2007-10-29 16:02 ` Dave Hansen [this message]
2007-10-29 17:59 ` Eric W. Biederman
2007-10-29 18:07 ` Dave Hansen
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=1193673738.24087.176.camel@localhost \
--to=haveblue@us.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=containers@lists.osdl.org \
--cc=ebiederm@xmission.com \
--cc=linux-kernel@vger.kernel.org \
--cc=oleg@tv-sign.ru \
--cc=sukadev@us.ibm.com \
--cc=torvalds@linux-foundation.org \
--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