From: ebiederm@xmission.com (Eric W. Biederman)
To: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Andrew Morton <akpm@osdl.org>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH rc1-mm] de_thread: fix deadlockable process addition
Date: Thu, 06 Apr 2006 16:58:58 -0600 [thread overview]
Message-ID: <m1acay1fbh.fsf@ebiederm.dsl.xmission.com> (raw)
In-Reply-To: <20060406220403.GA205@oleg> (Oleg Nesterov's message of "Fri, 7 Apr 2006 02:04:03 +0400")
Oleg Nesterov <oleg@tv-sign.ru> writes:
> On top of
> task-make-task-list-manipulations-rcu-safe.patch
>
> This patch
> pidhash-kill-switch_exec_pids.patch
>
> changed de_thread() so that it doesn't remove 'leader' from it's thread group.
> However de_thread() still adds current to init_task.tasks without removing
> 'leader' from this list. What if another CLONE_VM task starts do_coredump()
> after de_thread() drops tasklist_lock but before it calls release_task(leader) ?
>
> do_coredump()->zap_threads() will find this thread group twice on
> init_task.tasks
> list. And it will increment mm->core_waiters twice for the new leader (current
> in
> de_thread). So, exit_mm()->complete(mm->core_startup_done) doesn't happen, and
> we
> have a deadlock.
Ack. The evils of de_thread!
We need this to keep from seeing the same task twice in
do_each_thread.
This bug is in 2.6.17-rc1 so this code needs to go to Linus
sometime soon.
Eric
> Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
>
> --- MM/fs/exec.c~0_DET 2006-04-06 22:37:33.000000000 +0400
> +++ MM/fs/exec.c 2006-04-06 22:51:51.000000000 +0400
> @@ -713,7 +713,7 @@ static int de_thread(struct task_struct
> attach_pid(current, PIDTYPE_PID, current->pid);
> attach_pid(current, PIDTYPE_PGID, current->signal->pgrp);
> attach_pid(current, PIDTYPE_SID, current->signal->session);
> - list_add_tail_rcu(¤t->tasks, &init_task.tasks);
> + list_replace_rcu(&leader->tasks, ¤t->tasks);
>
> current->parent = current->real_parent = leader->real_parent;
> leader->parent = leader->real_parent = child_reaper;
> --- MM/kernel/exit.c~0_DET 2006-03-23 23:02:53.000000000 +0300
> +++ MM/kernel/exit.c 2006-04-06 23:01:37.000000000 +0400
> @@ -55,7 +55,9 @@ static void __unhash_process(struct task
> detach_pid(p, PIDTYPE_PGID);
> detach_pid(p, PIDTYPE_SID);
>
> - list_del_rcu(&p->tasks);
> + /* see de_thread()->list_replace_rcu() */
> + if (likely(p->tasks.prev != LIST_POISON2))
> + list_del_rcu(&p->tasks);
> __get_cpu_var(process_counts)--;
> }
> list_del_rcu(&p->thread_group);
next prev parent reply other threads:[~2006-04-06 23:00 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-06 22:04 [PATCH rc1-mm] de_thread: fix deadlockable process addition Oleg Nesterov
2006-04-06 22:58 ` Eric W. Biederman [this message]
2006-04-07 23:46 ` Oleg Nesterov
2006-04-07 22:51 ` Andrew Morton
2006-04-07 22:56 ` Andrew Morton
2006-04-08 7:55 ` Eric W. Biederman
2006-04-08 17:27 ` Oleg Nesterov
2006-04-08 16:07 ` Eric W. Biederman
2006-04-08 21:13 ` Oleg Nesterov
2006-04-08 21:23 ` Oleg Nesterov
2006-04-10 22:11 ` Eric W. Biederman
2006-04-10 23:07 ` [PATCH] de_thread: Don't confuse users do_each_thread Eric W. Biederman
2006-04-10 23:16 ` Eric W. Biederman
2006-04-10 23:52 ` Ingo Oeser
2006-04-11 6:18 ` Eric W. Biederman
2006-04-11 10:19 ` Oleg Nesterov
2006-04-11 7:25 ` Ingo Oeser
2006-04-11 7:36 ` Eric W. Biederman
2006-04-11 19:50 ` Ingo Oeser
2006-04-11 10:05 ` Oleg Nesterov
2006-04-11 5:23 ` Andrew Morton
2006-04-11 10:47 ` Oleg Nesterov
2006-04-11 6:23 ` Eric W. Biederman
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=m1acay1fbh.fsf@ebiederm.dsl.xmission.com \
--to=ebiederm@xmission.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=oleg@tv-sign.ru \
/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