lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Sun, 15 Jul 2007 16:17:50 +0400
From:	Oleg Nesterov <oleg@...sign.ru>
To:	Sukadev Bhattiprolu <sukadev@...ibm.com>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	"Eric W. Biederman" <ebiederm@...ssion.com>,
	Cedric Le Goater <clg@...ibm.com>,
	Dave Hansen <haveblue@...ibm.com>,
	Serge Hallyn <serue@...ibm.com>,
	Herbert Poetzel <herbert@...hfloor.at>,
	Pavel Emelianov <xemul@...nvz.org>,
	Linux Containers <containers@...ts.osdl.org>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/5] Use task_pid() to find leader's pid

Sukadev Bhattiprolu wrote:
>
> Use task_pid() to get leader's pid since find_pid() cannot be used
> after detach_pid(). See comments in the code below for more details.
>
> ...
>
> +		 * Note: With multiple pid namespaces, active pid namespace of
> +		 * 	 a process is stored in its struct pid. The detach_pid
> +		 * 	 below frees the struct pid, so we will have no notion
> +		 * 	 of an active pid namespace until we complete the
> +		 * 	 subsequent attach_pid(). Which means - calls like
> +		 * 	 find_pid()/pid_to_nr() return NULL and cannot be used
> +		 * 	 between the detach_pid() and attach_pid() calls.

I think both the changelog and the comment are confusing,

>  		detach_pid(tsk, PIDTYPE_PID);
>  		tsk->pid = leader->pid;
> -		attach_pid(tsk, PIDTYPE_PID,  find_pid(tsk->pid));
> +		attach_pid(tsk, PIDTYPE_PID,  task_pid(leader));

because the change itself looks like an obvious performance fix, even
we don't use multiple pid namespaces. I don't think it is good idea to
add a fat comment which doesn't match the current reality, and find_pid()
should be avoided anyway.

Stupid question: why do we need to put the pid namespace into the struct
pid? Isn't it better if the user of the struct pid should know its ns?
For example, if /proc does put_pid(), that pid should be from the active
namespace.

Sukadev, could you cc me if you do that kind of changes?

Oleg.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ