aboutsummaryrefslogtreecommitdiff
path: root/resolv/Makefile
diff options
context:
space:
mode:
authorDmitry V. Levin <ldv@altlinux.org>2015-06-18 21:40:46 +0000
committerDmitry V. Levin <ldv@altlinux.org>2015-06-23 09:37:28 +0000
commitb57525f1a376149840f740a31535681c07152ba4 (patch)
treec520a3234fda67b9c99562eb1b06e090e9cc2bb5 /resolv/Makefile
parent47852c972d1ad80d8b38d9e94507b27df0ede421 (diff)
downloadglibc-b57525f1a376149840f740a31535681c07152ba4.tar
glibc-b57525f1a376149840f740a31535681c07152ba4.tar.gz
glibc-b57525f1a376149840f740a31535681c07152ba4.tar.bz2
glibc-b57525f1a376149840f740a31535681c07152ba4.zip
Fix potential hanging of gethostbyaddr_r/gethostbyname_r
When "reorder" resolver option is enabled, threads of a multi-threaded process could hang in gethostbyaddr_r, gethostbyname_r, or gethostbyname2_r. Due to a trivial bug in _res_hconf_reorder_addrs, simultaneous invocations of this function in a multi-threaded process could result to _res_hconf_reorder_addrs returning without releasing the lock it holds, causing other threads to block indefinitely while waiting for the lock that is not going to be released. [BZ #17977] * resolv/res_hconf.c (_res_hconf_reorder_addrs): Fix unlocking when initializing interface list, based on the bug analysis and the patch proposed by Eric Newton. * resolv/tst-res_hconf_reorder.c: New test. * resolv/Makefile [$(have-thread-library) = yes] (tests): Add tst-res_hconf_reorder. ($(objpfx)tst-res_hconf_reorder): Depend on $(libdl) and $(shared-thread-library). (tst-res_hconf_reorder-ENV): New variable.
Diffstat (limited to 'resolv/Makefile')
-rw-r--r--resolv/Makefile4
1 files changed, 4 insertions, 0 deletions
diff --git a/resolv/Makefile b/resolv/Makefile
index f62eea4fb8..3509d98e2d 100644
--- a/resolv/Makefile
+++ b/resolv/Makefile
@@ -39,6 +39,7 @@ extra-libs := libresolv libnss_dns
ifeq ($(have-thread-library),yes)
extra-libs += libanl
routines += gai_sigqueue
+tests += tst-res_hconf_reorder
endif
extra-libs-others = $(extra-libs)
libresolv-routines := gethnamaddr res_comp res_debug \
@@ -98,6 +99,9 @@ $(objpfx)libanl.so: $(shared-thread-library)
$(objpfx)ga_test: $(objpfx)libanl.so $(shared-thread-library)
+$(objpfx)tst-res_hconf_reorder: $(libdl) $(shared-thread-library)
+tst-res_hconf_reorder-ENV = RESOLV_REORDER=on
+
$(objpfx)tst-leaks: $(objpfx)libresolv.so
tst-leaks-ENV = MALLOC_TRACE=$(objpfx)tst-leaks.mtrace
$(objpfx)mtrace-tst-leaks.out: $(objpfx)tst-leaks.out