about summary refs log tree commit diff
path: root/elf/dl-iteratephdr.c
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@redhat.com>2010-05-03 08:08:28 -0700
committerUlrich Drepper <drepper@redhat.com>2010-05-03 08:08:28 -0700
commit5a2a1d75043138e696222ced4560de2fb90b8024 (patch)
tree76c2da1388b8787ebabb9e61cf27d7510d1f5a7b /elf/dl-iteratephdr.c
parentc739ec3d81a34a87d8ae1276eab4f5880afc3476 (diff)
downloadglibc-5a2a1d75043138e696222ced4560de2fb90b8024.tar.gz
glibc-5a2a1d75043138e696222ced4560de2fb90b8024.tar.xz
glibc-5a2a1d75043138e696222ced4560de2fb90b8024.zip
Don't deadlock in __dl_iterate_phdr while (un)loading objects.
Diffstat (limited to 'elf/dl-iteratephdr.c')
-rw-r--r--elf/dl-iteratephdr.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/elf/dl-iteratephdr.c b/elf/dl-iteratephdr.c
index 44864c1b7a..5f1c20d755 100644
--- a/elf/dl-iteratephdr.c
+++ b/elf/dl-iteratephdr.c
@@ -26,7 +26,7 @@
 static void
 cancel_handler (void *arg __attribute__((unused)))
 {
-  __rtld_lock_unlock_recursive (GL(dl_load_lock));
+  __rtld_lock_unlock_recursive (GL(dl_load_write_lock));
 }
 
 hidden_proto (__dl_iterate_phdr)
@@ -38,8 +38,8 @@ __dl_iterate_phdr (int (*callback) (struct dl_phdr_info *info,
   struct dl_phdr_info info;
   int ret = 0;
 
-  /* Make sure we are alone.  */
-  __rtld_lock_lock_recursive (GL(dl_load_lock));
+  /* Make sure nobody modifies the list of loaded objects.  */
+  __rtld_lock_lock_recursive (GL(dl_load_write_lock));
   __libc_cleanup_push (cancel_handler, 0);
 
   /* We have to determine the namespace of the caller since this determines
@@ -79,7 +79,7 @@ __dl_iterate_phdr (int (*callback) (struct dl_phdr_info *info,
 
   /* Release the lock.  */
   __libc_cleanup_pop (0);
-  __rtld_lock_unlock_recursive (GL(dl_load_lock));
+  __rtld_lock_unlock_recursive (GL(dl_load_write_lock));
 
   return ret;
 }