|
Message-ID: <1407358510.24324.328.camel@eris.loria.fr>
Date: Wed, 06 Aug 2014 22:55:10 +0200
From: Jens Gustedt <jens.gustedt@...ia.fr>
To: musl@...ts.openwall.com
Subject: Re: Explaining cond var destroy [Re: C threads, v3.0]
Am Mittwoch, den 06.08.2014, 13:32 -0400 schrieb Rich Felker:
> On Wed, Aug 06, 2014 at 06:56:56PM +0200, Jens Gustedt wrote:
> > Easy perhaps not. But the futex syscall returns some of the
> > information that is currently thrown away.
>
> Sadly it seems like a bad idea to rely on any of the information
> returned by the futex syscall, due to the possibility of spurious
> wakes coming from reuse of memory. This is discussed somewhat on glibc
> issue 13690:
>
> https://sourceware.org/bugzilla/show_bug.cgi?id=13690
that is a complicated thread, I am not sure that I captured all
aspects
> The core issue is that, when performing operations like a mutex
> unlock, we can only know if futex wake is needed _after_ the atomic
> release action has been performed, and at that point, the address on
> which the futex wake is performed may no longer be valid, or may have
> been reallocated for another use. Thus, futex wait for a new
> synchronization object can spuriously return 0.
*If* we suppose that your destroy-wait trick works (and I think it
does) such a reuse for pthread_cond_t can never happen, and thus the
futex-syscall should return the correct values. I'll try to work some
simplification from there.
> I think trying to preclude the possibility of such spurious wakes
> would require a lot more unlock/destroy synchronization than what we
> have now in cond vars.
Perhaps one could just let some spurious wakeups in some weird
situations escape to user space.
We'll see.
Jens
--
:: INRIA Nancy Grand Est ::: AlGorille ::: ICube/ICPS :::
:: ::::::::::::::: office Strasbourg : +33 368854536 ::
:: :::::::::::::::::::::: gsm France : +33 651400183 ::
:: ::::::::::::::: gsm international : +49 15737185122 ::
:: http://icube-icps.unistra.fr/index.php/Jens_Gustedt ::
Download attachment "signature.asc" of type "application/pgp-signature" (199 bytes)
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.