This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v2] [BZ #17977] Fix potential hanging of gethostbyaddr_r/gethostbyname_r


On Mon, Jun 22, 2015 at 02:32:52PM +0300, Dmitry V. Levin wrote:
> 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.

Looks good to me.

Thanks,
Siddhesh


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]