[PATCH v2] Fix double-checked locking in _res_hconf_reorder_addrs [BZ #19074]
Torvald Riegel
triegel@redhat.com
Thu Oct 8 14:46:00 GMT 2015
On Wed, 2015-10-07 at 16:12 +0200, Florian Weimer wrote:
> On 10/07/2015 12:28 PM, Torvald Riegel wrote:
>
> > If you should write this page, check whether you really need the acquire
> > MO in the load in the critical section, or whether relaxed MO is
> > sufficient ;)
>
> Acquire/release is needed because the access to the actual data needs to
> be synchronized as well.
Yes, but there's the lock used for the critical section too. The
critical sections are ordered. So have a look at whether you can
actually not read from initialization done in the initializing critical
section if you read that the initialization flag has been set.
> I'm struggling with the cppmem syntax to show that. Is there a grammar
> published anywhere?
Not as far as I know. You could look at the sources of the tool
though :)
The slides of my Cauldron tutorial have a selection of what is accepted.
Modeling a lock order with a release/acquire store/load pair can be
helpful.
More information about the Libc-alpha
mailing list