This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH Fix incorrect double-checked locking related to _res_hconf.initialized. [BZ #20477]
- From: Florian Weimer <fweimer at redhat dot com>
- To: Torvald Riegel <triegel at redhat dot com>
- Cc: GLIBC Devel <libc-alpha at sourceware dot org>
- Date: Wed, 17 Aug 2016 14:47:30 +0200
- Subject: Re: [PATCH Fix incorrect double-checked locking related to _res_hconf.initialized. [BZ #20477]
- Authentication-results: sourceware.org; auth=none
- References: <1471436135.14544.96.camel@localhost.localdomain>
On 08/17/2016 02:15 PM, Torvald Riegel wrote:
_res_hconf.initialized was not suitable for use in a multi-threaded
environment due to the lack of atomics and memory barriers. Use of it
was also unnecessary because _res_hconf_init did the right thing by
using __libc_once. This patch fixes the glibc-internal uses by just
calling _res_hconf_init unconditionally, and switches to a release MO
atomic store for _res_hconf.initialized to fix the glibc side of the
synchronization problem (which will maintain backward compatibility, but
cannot fix the lack of acquire MO on any glibc-external loads).
[BZ #20477]
* resolv/res_hconf.c (do_init): Use atomic access.
* resolv/res_hconf.h: Add comments.
* nscd/aicache.c (addhstaiX): Call _res_hconf_init unconditionally.
* nss/getXXbyYY_r.c (REENTRANT_NAME): Likewise.
* sysdeps/posix/getaddrinfo.c (gaih_inet): Likewise.
Looks good to me. Please commit.
Thanks,
Florian