1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-28 00:21:52 +03:00

Don't deadlock in __dl_iterate_phdr while (un)loading objects.

This commit is contained in:
Andreas Schwab
2010-05-03 08:08:28 -07:00
committed by Ulrich Drepper
parent c739ec3d81
commit 5a2a1d7504
8 changed files with 39 additions and 4 deletions

View File

@ -93,6 +93,9 @@ _dl_new_object (char *realname, const char *libname, int type,
new->l_scope = new->l_scope_mem;
new->l_scope_max = sizeof (new->l_scope_mem) / sizeof (new->l_scope_mem[0]);
/* We modify the list of loaded objects. */
__rtld_lock_lock_recursive (GL(dl_load_write_lock));
/* Counter for the scopes we have to handle. */
idx = 0;
@ -114,6 +117,8 @@ _dl_new_object (char *realname, const char *libname, int type,
new->l_serial = GL(dl_load_adds);
++GL(dl_load_adds);
__rtld_lock_unlock_recursive (GL(dl_load_write_lock));
/* If we have no loader the new object acts as it. */
if (loader == NULL)
loader = new;