mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@tv-sign.ru>
To: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Andrew Morton <akpm@osdl.org>,
	linux-kernel@vger.kernel.org, Dave Hansen <haveblue@us.ibm.com>,
	Herbert Poetzl <herbert@13thfloor.at>
Subject: Re: [PATCH] pidhash:  Kill switch_exec_pids
Date: Thu, 02 Feb 2006 23:25:21 +0300	[thread overview]
Message-ID: <43E26AB1.8509A175@tv-sign.ru> (raw)
In-Reply-To: <m1r76lslhi.fsf@ebiederm.dsl.xmission.com>

Eric W. Biederman wrote:
>
> --- a/fs/exec.c
> +++ b/fs/exec.c
> @@ -699,7 +699,17 @@ static int de_thread(struct task_struct 
>  		remove_parent(current);
>  		remove_parent(leader);
>  
> -		switch_exec_pids(leader, current);
> +
> +		/* Become a process group leader with the old leader's pid.
> +		 * Note: The old leader also uses thispid until release_task
> +		 *       is called.  Odd but simple and correct.
> +		 */
> +		detach_pid(current, PIDTYPE_PID);
> +		current->pid = leader->pid;
> +		attach_pid(current, PIDTYPE_PID,  current->pid);

What happens after de_thread() unlocks tasklist_lock and before
it is taken again in release_task() ?

In that window find_task_by_pid() will return dead leader, not
the new leader of thread group. This means we can miss tkill()
or ptrace(), for example.

Oleg.

  reply	other threads:[~2006-02-02 19:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-02 17:45 Eric W. Biederman
2006-02-02 20:25 ` Oleg Nesterov [this message]
2006-02-02 20:08   ` Eric W. Biederman
2006-02-03 13:26     ` Oleg Nesterov
2006-02-03 12:59       ` Eric W. Biederman
2006-02-02 21:45 ` Andrew Morton

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=43E26AB1.8509A175@tv-sign.ru \
    --to=oleg@tv-sign.ru \
    --cc=akpm@osdl.org \
    --cc=ebiederm@xmission.com \
    --cc=haveblue@us.ibm.com \
    --cc=herbert@13thfloor.at \
    --cc=linux-kernel@vger.kernel.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®