aboutsummaryrefslogtreecommitdiff
path: root/sysdeps
diff options
context:
space:
mode:
authorTorvald Riegel <triegel@redhat.com>2016-08-17 13:56:11 +0200
committerTorvald Riegel <triegel@redhat.com>2016-08-18 20:53:37 +0200
commit6f9d4f595e4073807ad0e844cbb3b3d7158b76d5 (patch)
treed0064a3e11f1326fcdfcad1b239076044da9a762 /sysdeps
parentb65f0b7b2ecd144800830633a4c2719f11775572 (diff)
downloadglibc-6f9d4f595e4073807ad0e844cbb3b3d7158b76d5.zip
glibc-6f9d4f595e4073807ad0e844cbb3b3d7158b76d5.tar.gz
glibc-6f9d4f595e4073807ad0e844cbb3b3d7158b76d5.tar.bz2
Fix incorrect double-checked locking related to _res_hconf.initialized.
_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.
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/posix/getaddrinfo.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index 574ce08..09fbc83 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -816,8 +816,7 @@ gaih_inet (const char *name, const struct gaih_service *service,
nip = __nss_hosts_database;
/* Initialize configurations. */
- if (__glibc_unlikely (!_res_hconf.initialized))
- _res_hconf_init ();
+ _res_hconf_init ();
if (__res_maybe_init (&_res, 0) == -1)
no_more = 1;