Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 08 Aug 2014 11:20:27 +0200
From: Jens Gustedt <>
Subject: Re: Explaining cond var destroy [Re: C threads, v3.0]


Am Donnerstag, den 07.08.2014, 13:25 -0400 schrieb Rich Felker:
> Most futex operations (including wait) access an object for read. Some
> rarely-used ones write to an object too. Wake does neither. Wake is
> purely an operation on the address/futex-waitqueue-object. This
> property is not just a side effect but absolutely necessary in order
> for futex to be useful, since you _always_ perform the futex wake
> after releasing (and thereby potentially allowing destruction) of the
> object.

I agree with almost all what you are saying, in particular the
facts, ;) and your statement is a good summary of what I learned with
our discussion.

I don't agree with your appreciation of these facts, though.

In particular the "(and thereby potentially allowing destruction)"
bothers me a lot, and I don't think that *doing* this with control
structures is desirable.

I think it is possible to have control structures that guarantee that
no wake (or any other futex operation) is done on an address that
isn't a valid address of a life object. I also think if only done for
non-shared structures (such as for C threads) that such a design can
be relatively simple, and with much less implicit state than what the
current musl implementation does, in particular for pthread_cond_t.

Such an implementation should by design avoid late wakes from the
kernel for addresses that are recycled for new control objects. (It
can't inhibit them since other userspace tools might still have the
late wake problem.)

I am currently debugging such a C thread implementation, and I'll come
back to you once I have something to show.

Thanks in particular to you, Rich, for your patience.


:: INRIA Nancy Grand Est ::: AlGorille ::: ICube/ICPS :::
:: ::::::::::::::: office Strasbourg : +33 368854536   ::
:: :::::::::::::::::::::: gsm France : +33 651400183   ::
:: ::::::::::::::: gsm international : +49 15737185122 ::
:: ::

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.