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-prev] [day] [month] [year] [list]
Date:	Sun, 09 Jun 2013 21:07:13 -0700
From:	ebiederm@...ssion.com (Eric W. Biederman)
To:	Oleg Nesterov <oleg@...hat.com>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	Michal Hocko <mhocko@...e.cz>,
	Pavel Emelyanov <xemul@...allels.com>,
	Sergey Dyasly <dserrg@...il.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/4] de_thread: use change_pid() rather than detach_pid/attach_pid

Oleg Nesterov <oleg@...hat.com> writes:

> de_thread() can use change_pid() instead of detach + attach.
> This looks better and this ensures that, say, next_thread()
> can never see a task with ->pid == NULL.

I want to say that there I though there was a good reason something
to do with the exit logic.

However I just read through attach_pid, detach_pid, and change_pid.
And the sequence detach_pid(...); attach_pid(...)  is equiavalent
to change_pid(...);

Reviewed-by: "Eric W. Biederman" <ebiederm@...ssion.com>

> Signed-off-by: Oleg Nesterov <oleg@...hat.com>
> ---
>  fs/exec.c |    3 +--
>  1 files changed, 1 insertions(+), 2 deletions(-)
>
> diff --git a/fs/exec.c b/fs/exec.c
> index 6430195..00eaba7 100644
> --- a/fs/exec.c
> +++ b/fs/exec.c
> @@ -945,9 +945,8 @@ static int de_thread(struct task_struct *tsk)
>  		 * Note: The old leader also uses this pid until release_task
>  		 *       is called.  Odd but simple and correct.
>  		 */
> -		detach_pid(tsk, PIDTYPE_PID);
>  		tsk->pid = leader->pid;
> -		attach_pid(tsk, PIDTYPE_PID,  task_pid(leader));
> +		change_pid(tsk, PIDTYPE_PID, task_pid(leader));
>  		transfer_pid(leader, tsk, PIDTYPE_PGID);
>  		transfer_pid(leader, tsk, PIDTYPE_SID);
--
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