mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Szabolcs Nagy <nsz@port70.net>
To: musl@lists.openwall.com
Subject: Re: trouble spots for atomic access
Date: Wed, 20 May 2015 13:05:19 +0200	[thread overview]
Message-ID: <20150520110518.GG11258@port70.net> (raw)
In-Reply-To: <1432075664.22607.12.camel@inria.fr>

* Jens Gustedt <jens.gustedt@inria.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


  parent reply	other threads:[~2015-05-20 11:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-19 13:57 Jens Gustedt
2015-05-19 22:07 ` Rich Felker
2015-05-19 22:47   ` Jens Gustedt
2015-05-19 23:15     ` Rich Felker
2015-05-20  7:02       ` Jens Gustedt
2015-05-20 14:55         ` Rich Felker
2015-05-20 11:05     ` Szabolcs Nagy [this message]
2015-05-20 14:56       ` Rich Felker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150520110518.GG11258@port70.net \
    --to=nsz@port70.net \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).