Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 20 May 2015 13:05:19 +0200
From: Szabolcs Nagy <>
Subject: Re: trouble spots for atomic access

* Jens Gustedt <> [2015-05-20 00:47:44 +0200]:
> Am Dienstag, den 19.05.2015, 18:07 -0400 schrieb Rich Felker:
> > On Tue, May 19, 2015 at 03:57:00PM +0200, Jens Gustedt wrote:
> > >  - pthread_once_t should always be volatile
> > >  - pthread_spinlock_t should always be volatile
> > 
> > These are C++ ABI changes. I'd like to make the change but I'm
> > concerned it might break things.
> Both are broken as they are now, if you fall into a compiler that
> "knows" that the object itself isn't volatile qualified, and by that
> excuse takes the liberty to optimize out loads. For both types there
> is one point where there is a cast to (volatile int*) followed by a
> load, that might not do what we want.
> (For pthread_once_t, this on line 43 in pthread_once.c)
> I think the safest would be to make the data types volatile. If that
> is not possible, do the load with some new function "a_load_rel" that
> is guaranteed to be volatile, atomic and with memory_order relaxed.

fwiw i scanned a significant portion of debian packages with nm -CD
for volatile int* usage and didnt find any case that was related to
posix types (a few libraries dealing with atomics had their own
volatile int*)

(found 6553 packages with c++ dependencies in stable, scanned them all)

so changing the types wouldnt break too many musl binaries i think

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.