lkml.org 
[lkml]   [2012]   [Jan]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [BUG] TASK_DEAD task is able to be woken up in special condition
On 01/17, Ingo Molnar wrote:
>
> * Yasunori Goto <y-goto@jp.fujitsu.com> wrote:
>
> > --- linux-3.2.orig/kernel/exit.c
> > +++ linux-3.2/kernel/exit.c
> > @@ -1038,6 +1038,22 @@ NORET_TYPE void do_exit(long code)
> >
> > preempt_disable();
> > exit_rcu();
> > +
> > + /*
> > + * The setting of TASK_RUNNING by try_to_wake_up() may be delayed
> > + * when the following two conditions become true.
> > + * - There is race condition of mmap_sem (It is acquired by
> > + * exit_mm()), and
> > + * - SMI occurs before setting TASK_RUNINNG.
> > + * (or hypervisor of virtual machine switches to other guest)
> > + * As a result, we may become TASK_RUNNING after becoming TASK_DEAD
> > + *
> > + * To avoid it, we have to wait for releasing tsk->pi_lock which
> > + * is held by try_to_wake_up()
> > + */
> > + smp_mb();
> > + raw_spin_unlock_wait(&tsk->pi_lock);
>
> Hm, unlock_wait() is really nasty. Wouldnt the adoption of the
> -rt kernel's delayed task put logic solve most of these races?

How? The problem is that the exiting task can do the last schedule()
in TASK_RUNNING state, this breaks the TASK_DEAD logic in
finish_task_switch().

Oleg.



\
 
 \ /
  Last update: 2012-01-17 16:21    [W:0.174 / U:0.112 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site