aboutsummaryrefslogtreecommitdiff
path: root/elf/dl-close.c
diff options
context:
space:
mode:
Diffstat (limited to 'elf/dl-close.c')
-rw-r--r--elf/dl-close.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/elf/dl-close.c b/elf/dl-close.c
index b73a7ad..700e765 100644
--- a/elf/dl-close.c
+++ b/elf/dl-close.c
@@ -507,6 +507,9 @@ _dl_close_worker (struct link_map *map)
size_t tls_free_end;
tls_free_start = tls_free_end = NO_TLS_OFFSET;
+ /* We modify the list of loaded objects. */
+ __rtld_lock_lock_recursive (GL(dl_load_write_lock));
+
/* Check each element of the search list to see if all references to
it are gone. */
for (unsigned int i = first_loaded; i < nloaded; ++i)
@@ -665,6 +668,8 @@ _dl_close_worker (struct link_map *map)
}
}
+ __rtld_lock_unlock_recursive (GL(dl_load_write_lock));
+
/* If we removed any object which uses TLS bump the generation counter. */
if (any_tls)
{