Re: [PATCH] pidns: Limit kill -1 and cap_set_all

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Eric W. Biederman <ebiederm@...>
Cc: Linus Torvalds <torvalds@...>, <linux-kernel@...>, Linux Containers <containers@...>, Andrew Morton <akpm@...>, Oleg Nesterov <oleg@...>, Pavel Emelyanov <xemul@...>, Sukadev Bhattiprolu [imap] <sukadev@...>
Date: Monday, October 29, 2007 - 12:02 pm

On Fri, 2007-10-26 at 14:37 -0600, Eric W. Biederman wrote:

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

-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] proc: Fix proc_kill_inodes to kill dentries on all p..., Eric W. Biederman, (Fri Oct 26, 1:48 pm)
[PATCH] proc: Simplify and correct proc_flush_task, Eric W. Biederman, (Fri Oct 26, 3:43 pm)
[PATCH] pidns: Limit kill -1 and cap_set_all, Eric W. Biederman, (Fri Oct 26, 4:37 pm)
Re: [PATCH] pidns: Limit kill -1 and cap_set_all, Dave Hansen, (Mon Oct 29, 12:02 pm)
Re: [PATCH] pidns: Limit kill -1 and cap_set_all, Eric W. Biederman, (Mon Oct 29, 1:59 pm)
Re: [PATCH] pidns: Limit kill -1 and cap_set_all, Dave Hansen, (Mon Oct 29, 2:07 pm)
Re: [PATCH] pidns: Limit kill -1 and cap_set_all, Kirill Korotaev, (Mon Oct 29, 4:38 am)
Re: [PATCH] pidns: Limit kill -1 and cap_set_all, Eric W. Biederman, (Mon Oct 29, 2:07 pm)
Re: [PATCH] proc: Fix proc_kill_inodes to kill dentries on a..., Eric W. Biederman, (Fri Oct 26, 2:36 pm)