mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@libc.org>
To: musl@lists.openwall.com
Subject: Re: Locale change ideas
Date: Wed, 27 May 2015 16:37:38 -0400	[thread overview]
Message-ID: <20150527203738.GO17573@brightrain.aerifal.cx> (raw)
In-Reply-To: <20150527031208.GA5255@brightrain.aerifal.cx>

On Tue, May 26, 2015 at 11:12:08PM -0400, Rich Felker wrote:
> Just some ideas I want to put in writing and put out for discussion:
> 
> Implementing a static all-C locale_t object (and, if we make C locale
> byte-based, also an all-C.UTF-8 one) returned by newlocale when
> possible. This would ensure that uses of newlocale "C" for robustness

Done; see commit aeeac9ca5490d7d90fe061ab72da446c01ddf746.

> Eliminating the messages_name field from the locale struct. I don't

Done; see commit 61a3364d246e72b903da8b76c2e27a225a51351e. This also
made handling of LC_CTYPE and LC_NUMERIC uniform with the rest of the
categories rather than special-cased.

> Handling non-synchronized reads of locale categories. The cat[]

This still needs to be reviewed. There is a barrier (due to UNLOCK)
between the writes to a new __locale_map object (which is immutable
once it's written) and storing that object's address anywhere. It's
not clear to me whether any further synchronization is necessary. It's
not needed for archs with strong memory order, and I'm fairly sure it
should not be needed for archs with dependency ordering, but I'm not
sure if this covers everything. The case to worry about is where the
new object gets allocated in memory that happens to already be cached
(because it was used then freed) by another thread, and whether that
thread might read stale data after obtainin/reading the pointer to it.
Anyone know if this is a real possibility, and if there are good
mitigations without putting a barrier at the point of read? (This is
surely related to the consume-order stuff everybody is so fond of
discussing and arguing about these days... :)

Rich


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

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-27  3:12 Rich Felker
2015-05-27  3:53 ` Rich Felker
2015-05-27 20:37 ` Rich Felker [this message]

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=20150527203738.GO17573@brightrain.aerifal.cx \
    --to=dalias@libc.org \
    --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).