summaryrefslogtreecommitdiff
path: root/nss
diff options
context:
space:
mode:
authorSzabolcs Nagy <szabolcs.nagy@arm.com>2021-09-15 15:16:19 +0100
committerAndreas K. Hüttel <dilfridge@gentoo.org>2021-10-29 18:39:34 +0200
commit5ae4a1bf95bc2e508cc9fe9e2b914f8573542c58 (patch)
tree38572e54f83571f7d6516edaf1fb0271e7de26f2 /nss
parenttimex: Use 64-bit fields on 32-bit TIMESIZE=64 systems (BZ #28469) (diff)
downloadglibc-5ae4a1bf95bc2e508cc9fe9e2b914f8573542c58.tar.gz
glibc-5ae4a1bf95bc2e508cc9fe9e2b914f8573542c58.tar.bz2
glibc-5ae4a1bf95bc2e508cc9fe9e2b914f8573542c58.zip
elf: Avoid deadlock between pthread_create and ctors [BZ #28357]
The fix for bug 19329 caused a regression such that pthread_create can deadlock when concurrent ctors from dlopen are waiting for it to finish. Use a new GL(dl_load_tls_lock) in pthread_create that is not taken around ctors in dlopen. The new lock is also used in __tls_get_addr instead of GL(dl_load_lock). The new lock is held in _dl_open_worker and _dl_close_worker around most of the logic before/after the init/fini routines. When init/fini routines are running then TLS is in a consistent, usable state. In _dl_open_worker the new lock requires catching and reraising dlopen failures that happen in the critical section. The new lock is reinitialized in a fork child, to keep the existing behaviour and it is kept recursive in case malloc interposition or TLS access from signal handlers can retake it. It is not obvious if this is necessary or helps, but avoids changing the preexisting behaviour. The new lock may be more appropriate for dl_iterate_phdr too than GL(dl_load_write_lock), since TLS state of an incompletely loaded module may be accessed. If the new lock can replace the old one, that can be a separate change. Fixes bug 28357. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> (cherry picked from commit 83b5323261bb72313bffcf37476c1b8f0847c736) (cherry picked from commit 024a7640ab9ecea80e527f4e4d7f7a1868e952c5)
Diffstat (limited to 'nss')
0 files changed, 0 insertions, 0 deletions