diff options
author | Andreas Schwab <schwab@redhat.com> | 2010-05-03 08:08:28 -0700 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2010-05-03 08:08:28 -0700 |
commit | 5a2a1d75043138e696222ced4560de2fb90b8024 (patch) | |
tree | 76c2da1388b8787ebabb9e61cf27d7510d1f5a7b /elf/dl-object.c | |
parent | c739ec3d81a34a87d8ae1276eab4f5880afc3476 (diff) | |
download | glibc-5a2a1d75043138e696222ced4560de2fb90b8024.tar glibc-5a2a1d75043138e696222ced4560de2fb90b8024.tar.gz glibc-5a2a1d75043138e696222ced4560de2fb90b8024.tar.bz2 glibc-5a2a1d75043138e696222ced4560de2fb90b8024.zip |
Don't deadlock in __dl_iterate_phdr while (un)loading objects.
Diffstat (limited to 'elf/dl-object.c')
-rw-r--r-- | elf/dl-object.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/elf/dl-object.c b/elf/dl-object.c index 788e2c07b9..22a163560b 100644 --- a/elf/dl-object.c +++ b/elf/dl-object.c @@ -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; |