|
Message-ID: <20150520145642.GX17573@brightrain.aerifal.cx> Date: Wed, 20 May 2015 10:56:42 -0400 From: Rich Felker <dalias@...c.org> To: musl@...ts.openwall.com Subject: Re: trouble spots for atomic access On Wed, May 20, 2015 at 01:05:19PM +0200, Szabolcs Nagy wrote: > * Jens Gustedt <jens.gustedt@...ia.fr> [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 This sounds promising, but I'm still a bit worried about making the change. I wonder if there's other data that could support the safety of doing it. Rich
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.