about summary refs log tree commit diff
path: root/resolv/tst-inet_ntop.c
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/tst-inet_ntop.c
parent47852c972d1ad80d8b38d9e94507b27df0ede421 (diff)
downloadglibc-b57525f1a376149840f740a31535681c07152ba4.tar.gz
glibc-b57525f1a376149840f740a31535681c07152ba4.tar.xz
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/tst-inet_ntop.c')
0 files changed, 0 insertions, 0 deletions