[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20110814174516.GB2381@redhat.com>
Date: Sun, 14 Aug 2011 19:45:16 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: NeilBrown <neilb@...e.de>
Cc: paulmck@...ux.vnet.ibm.com, Ben Blum <bblum@...rew.cmu.edu>,
Paul Menage <menage@...gle.com>,
Li Zefan <lizf@...fujitsu.com>,
containers@...ts.linux-foundation.org,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: Possible race between cgroup_attach_proc and de_thread, and
questionable code in de_thread.
On 07/28, NeilBrown wrote:
>
> +/* Thread group leader can change, so stop loop when we see one
> + * even if it isn't 'g' */
> #define while_each_thread(g, t) \
> - while ((t = next_thread(t)) != g)
> + while ((t = next_thread(t)) != g && !thread_group_leader(t))
This assumes that while_each_thread(g, t) always uses g == group_leader.
> @@ -70,8 +70,13 @@ static void __unhash_process(struct task_struct *p, bool group_dead)
> list_del_rcu(&p->tasks);
> list_del_init(&p->sibling);
> __this_cpu_dec(process_counts);
> - }
> - list_del_rcu(&p->thread_group);
> + } else
> + /* only remove members from the thread group.
> + * The thread group leader must stay so that
> + * while_each_thread() uses can see the end of
> + * the list and stop.
> + */
> + list_del_rcu(&p->thread_group);
Hmm... this looks obvously wrong. This leaves the dead thread on
the list.
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