ldso: fix dlsym hang when reloading DSOs
commitbc5949fd4f8cddf4eee74492c86a8a72f4dee0e7
authorLeonid Lisovskiy <lly.dev@gmail.com>
Mon, 20 Jun 2016 17:29:45 +0000 (20 20:29 +0300)
committerWaldemar Brodkorb <wbx@uclibc-ng.org>
Wed, 22 Jun 2016 06:02:51 +0000 (22 08:02 +0200)
tree68cf04f3eade770ecd41bfb782bc5e9f51acbe94
parent0bc1394750885d4e4b2064aff6c48dd542c6f4b8
ldso: fix dlsym hang when reloading DSOs

It can happen under certain cases that the DSO had refcount 0,
but was already loaded. (NODELETE flag is set, or it is pulled
in via both NEEDED dependency and explicit dlopen()).

Add extra reference count for NODELETE objects, this will
ensure that the reference count never drops below one.

It is improved version of
 http://lists.busybox.net/pipermail/uclibc/2013-June/047826.html

Signed-off-by: Leonid Lisovskiy <lly.dev@gmail.com>
ldso/ldso/dl-elf.c
ldso/libdl/libdl.c
test/dlopen/Makefile.in
test/dlopen/nodelete1.c [new file with mode: 0644]