Messages in this thread | | | Date | Mon, 5 Oct 2009 13:50:46 +0200 (CEST) | From | Thomas Gleixner <> | Subject | Re: futex question |
| |
On Mon, 5 Oct 2009, Ingo Molnar wrote: > * Peter Zijlstra <a.p.zijlstra@chello.nl> wrote: > > > diff --git a/fs/exec.c b/fs/exec.c > > index d49be6b..0812ba6 100644 > > --- a/fs/exec.c > > +++ b/fs/exec.c > > @@ -1295,6 +1295,22 @@ int do_execve(char * filename, > > bool clear_in_exec; > > int retval; > > > > + retval = -EWOULDBLOCK; > > +#ifdef CONFIG_FUTEX > > + if (unlikely(current->robust_list)) > > + goto out_ret; > > +#ifdef CONFIG_COMPAT > > + if (unlikely(current->compat_robust_list)) > > + goto out_ret; > > +#endif > > + spin_lock_irq(¤t->pi_lock); > > + if (!list_empty(¤t->pi_state_list)) { > > + spin_unlock_irq(¤t->pi_lock); > > + goto out_ret; > > + } > > + spin_unlock_irq(¤t->pi_lock); > > +#endif > > i suspect this should have the form of: > > retval = can_exec_robust_futexes(); > if (retval) > goto out_ret
Yes.
> retval = unshare_files(&displaced); > if (retval) > goto out_ret; > > ... > > but ... shouldnt we just do what exec normally does and zap any state > that shouldnt be carried over into the new context - instead of denying > the exec? Am i missing something?
We want to check whether the robust list is empty. If it's not empty then we deny the exec instead of silently releasing the futexes or just ignoring the robust list entirely. Same applies for the pi waiters list.
Thanks,
tglx
| |