This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH v2] Fix double-checked locking in _res_hconf_reorder_addrs [BZ #19074]
- From: Torvald Riegel <triegel at redhat dot com>
- To: Florian Weimer <fweimer at redhat dot com>
- Cc: Siddhesh Poyarekar <sid at reserved-bit dot com>, GNU C Library <libc-alpha at sourceware dot org>
- Date: Thu, 08 Oct 2015 16:46:43 +0200
- Subject: Re: [PATCH v2] Fix double-checked locking in _res_hconf_reorder_addrs [BZ #19074]
- Authentication-results: sourceware.org; auth=none
- References: <5613BF47 dot 9000503 at redhat dot com> <5613D5F5 dot 7020603 at reserved-bit dot com> <5613DBB6 dot 8020109 at redhat dot com> <1444213721 dot 25110 dot 68 dot camel at localhost dot localdomain> <56152831 dot 7020707 at redhat dot com>
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.