Re: [patch 09/12] futex: Provide state handling for exec() as well

From: Thomas Gleixner
Date: Thu Nov 07 2019 - 04:54:48 EST


On Thu, 7 Nov 2019, Peter Zijlstra wrote:
> On Wed, Nov 06, 2019 at 10:55:43PM +0100, Thomas Gleixner wrote:
>
> > +static void futex_cleanup_end(struct task_struct *tsk, int state)
> > +{
> > + /*
> > + * Lockless store. The only side effect is that an observer might
> > + * take another loop until it becomes visible.
> > + */
> > + tsk->futex_state = state;
>
> As I mentioned yesterday, paranoia would've made me write this as
> smp_store_release(), also to avoid it creaping back into the locked
> region.
>
> That is, the comment above deals with it being visible late, but it
> could be visible early.
>
> At the same time, if this is a release, what does it pair with. The
> obvious place would be the load in handle_exit_race() but that didn't
> want to make sense last night -- and I'm not sure it wants to make more
> sense today.

Right. I couldn't come up with any sensible argument either.

Thanks,

tglx