about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-07-07 07:41:02 +0000
committerUlrich Drepper <drepper@redhat.com>2004-07-07 07:41:02 +0000
commit8e5aaad9daee699404f00c79100dfd88781eedf5 (patch)
tree7de7e0dd00268b2960178cb21fb081735813df51
parente782376c013a8ef486e625b50895d78879a9141f (diff)
downloadglibc-8e5aaad9daee699404f00c79100dfd88781eedf5.tar.gz
glibc-8e5aaad9daee699404f00c79100dfd88781eedf5.tar.xz
glibc-8e5aaad9daee699404f00c79100dfd88781eedf5.zip
Update.
2004-07-07  Ulrich Drepper  <drepper@redhat.com>

	* elf/dl-fini.c (_dl_fini): Move the unlock of the ld.so lock
	before the loop running the destructors.
-rw-r--r--ChangeLog5
-rw-r--r--elf/dl-fini.c10
-rw-r--r--nptl/ChangeLog6
-rw-r--r--nptl/Makefile9
4 files changed, 26 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index d147626c91..ad9b857c83 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2004-07-07  Ulrich Drepper  <drepper@redhat.com>
+
+	* elf/dl-fini.c (_dl_fini): Move the unlock of the ld.so lock
+	before the loop running the destructors.
+
 2004-05-18  Andreas Schwab  <schwab@suse.de>
 
 	* elf/dl-load.c (_dl_map_object_from_fd): Use the end address of
diff --git a/elf/dl-fini.c b/elf/dl-fini.c
index c34ee8ea1e..ca1cb8c476 100644
--- a/elf/dl-fini.c
+++ b/elf/dl-fini.c
@@ -126,6 +126,14 @@ _dl_fini (void)
 	}
     }
 
+  /* We do not rely on the linked list of loaded object anymore from
+     this point on.  We have our own list here (maps).  The various
+     members of this list cannot vanish since the open count is too
+     high and will be decremented in this loop.  So we release the
+     lock so that some code which might be called from a destructor
+     can directly or indirectly access the lock.  */
+  __rtld_lock_unlock_recursive (GL(dl_load_lock));
+
   /* 'maps' now contains the objects in the right order.  Now call the
      destructors.  We have to process this array from the front.  */
   for (i = 0; i < GL(dl_nloaded); ++i)
@@ -171,8 +179,6 @@ _dl_fini (void)
       --l->l_opencount;
     }
 
-  __rtld_lock_unlock_recursive (GL(dl_load_lock));
-
   if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_STATISTICS, 0))
     _dl_debug_printf ("\nruntime linker statistics:\n"
 		      "           final number of relocations: %lu\n"
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index f96550a979..5fdf2a612d 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,9 @@
+2004-07-07  Ulrich Drepper  <drepper@redhat.com>
+
+	* Makefile: Add rules to build and run tst-fini1.
+	* tst-fini1.c: New file.
+	* tst-fini1mod.c: New file.
+
 2004-07-05  Ulrich Drepper  <drepper@redhat.com>
 
 	* sysdeps/unix/sysv/linux/i386/sysdep-cancel.h: Define NO_CANCELLATION
diff --git a/nptl/Makefile b/nptl/Makefile
index 56dd08939f..a723e8b884 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -263,7 +263,8 @@ tests += tst-cancelx2 tst-cancelx3 tst-cancelx4 tst-cancelx5 \
 	 tst-oncex3 tst-oncex4
 endif
 ifeq ($(build-shared),yes)
-tests += tst-atfork2 tst-tls3 tst-tls4 tst-tls5 tst-_res1
+tests += tst-atfork2 tst-tls3 tst-tls4 tst-tls5 tst-_res1 tst-fini1
+tests-nolibpthread += tst-fini1
 ifeq ($(have-z-execstack),yes)
 tests += tst-execstack
 endif
@@ -272,7 +273,7 @@ endif
 modules-names = tst-atfork2mod tst-tls3mod tst-tls4moda tst-tls4modb \
 		tst-tls5mod tst-tls5moda tst-tls5modb tst-tls5modc \
 		tst-tls5modd tst-tls5mode tst-tls5modf \
-		tst-_res1mod1 tst-_res1mod2 tst-execstack-mod
+		tst-_res1mod1 tst-_res1mod2 tst-execstack-mod tst-fini1mod
 extra-objs += $(addsuffix .os,$(strip $(modules-names))) tst-cleanup4aux.o
 test-extras += $(modules-names)
 test-modules = $(addprefix $(objpfx),$(addsuffix .so,$(modules-names)))
@@ -450,6 +451,8 @@ endif
 
 $(objpfx)tst-dlsym1: $(libdl) $(shared-thread-library)
 
+$(objpfx)tst-fini1: $(shared-thread-library) $(objpfx)tst-fini1mod.so
+
 ifeq (yes,$(build-shared))
 $(objpfx)tst-cond11: $(common-objpfx)rt/librt.so
 $(objpfx)tst-cond19: $(common-objpfx)rt/librt.so
@@ -579,6 +582,8 @@ $(objpfx)tst-execstack: $(libdl)
 $(objpfx)tst-execstack.out: $(objpfx)tst-execstack-mod.so
 LDFLAGS-tst-execstack = -Wl,-z,noexecstack
 
+$(objpfx)tst-fini1mod.so: $(shared-thread-library)
+
 # The tests here better do not run in parallel
 ifneq ($(filter %tests,$(MAKECMDGOALS)),)
 .NOTPARALLEL: