public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] gentoo commit in src/patchsets/glibc/2.13: 0059_all_glibc-2.13-dlclose-search-reset.patch README.history
@ 2011-07-13  6:04 Mike Frysinger (vapier)
  0 siblings, 0 replies; only message in thread
From: Mike Frysinger (vapier) @ 2011-07-13  6:04 UTC (permalink / raw
  To: gentoo-commits

vapier      11/07/13 06:04:16

  Modified:             README.history
  Added:                0059_all_glibc-2.13-dlclose-search-reset.patch
  Log:
  add patch from redhat for dlclose weirdness #364077

Revision  Changes    Path
1.23                 src/patchsets/glibc/2.13/README.history

file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/glibc/2.13/README.history?rev=1.23&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/glibc/2.13/README.history?rev=1.23&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/glibc/2.13/README.history?r1=1.22&r2=1.23

Index: README.history
===================================================================
RCS file: /var/cvsroot/gentoo/src/patchsets/glibc/2.13/README.history,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- README.history	5 Jul 2011 06:00:04 -0000	1.22
+++ README.history	13 Jul 2011 06:04:16 -0000	1.23
@@ -1,3 +1,6 @@
+8		[pending]
+	+ 0059_all_glibc-2.13-dlclose-search-reset.patch
+
 7		05.07.2011
 	+ 0043_all_glibc-2.12-broken-tls-init.patch
 	+ 0045_all_glibc-2.13-canonical-getaddrinfo.patch



1.1                  src/patchsets/glibc/2.13/0059_all_glibc-2.13-dlclose-search-reset.patch

file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/glibc/2.13/0059_all_glibc-2.13-dlclose-search-reset.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/glibc/2.13/0059_all_glibc-2.13-dlclose-search-reset.patch?rev=1.1&content-type=text/plain

Index: 0059_all_glibc-2.13-dlclose-search-reset.patch
===================================================================
https://bugs.gentoo.org/364077
http://sourceware.org/ml/libc-hacker/2010-05/msg00007.html
https://bugzilla.redhat.com/show_bug.cgi?id=593675

this was added to mainline's master branch by accident here:
	commit: a3d731d344988f0badcd38397e412bc994682d97
	date: Sun Jun 27 19:39:01 2010 -0700
but then reverted on purpose here:
	commit: d85f8ff66711fd3b1c5753330499c7403fa46d81
	date: Sun Jun 27 19:52:51 2010 -0700

no reasoning can be found as to why this isn't in mainline, but it's
certainly still a problem for Gentoo users.

From 2f811bf88bed4a6c0dec8778847ba441736d509d Mon Sep 17 00:00:00 2001
From: Andreas Schwab <schwab@redhat.com>
Date: Wed, 26 May 2010 18:28:59 +0200
Subject: [PATCH] Fix scope handling during dl_close

This fixes redhat bug 593675.

2010-06-28  Andreas Schwab  <schwab@redhat.com>

	* elf/Makefile: Add rules to build and run unload8 test.
	* elf/unload8.c: New file.
	* elf/unload8mod1.c: New file.
	* elf/unload8mod1x.c: New file.
	* elf/unload8mod2.c: New file.
	* elf/unload8mod3.c: New file.

	* elf/dl-close.c (_dl_close_worker): Reset private search list if
	it wasn't used.

---
 ChangeLog          |   12 ++++++++++++
 elf/Makefile       |   10 +++++++++-
 elf/dl-close.c     |    7 +++++++
 elf/unload8.c      |   33 +++++++++++++++++++++++++++++++++
 elf/unload8mod1.c  |    7 +++++++
 elf/unload8mod1x.c |    1 +
 elf/unload8mod2.c  |    7 +++++++
 elf/unload8mod3.c  |   27 +++++++++++++++++++++++++++
 8 files changed, 103 insertions(+), 1 deletions(-)
 create mode 100644 elf/unload8.c
 create mode 100644 elf/unload8mod1.c
 create mode 100644 elf/unload8mod1x.c
 create mode 100644 elf/unload8mod2.c
 create mode 100644 elf/unload8mod3.c

diff --git a/elf/Makefile b/elf/Makefile
index 59e835f..65b6deb 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -90,6 +90,7 @@ distribute	:= rtld-Rules \
 		   unload4mod1.c unload4mod2.c unload4mod3.c unload4mod4.c \
 		   unload6mod1.c unload6mod2.c unload6mod3.c \
 		   unload7mod1.c unload7mod2.c \
+		   unload8mod1.c unload8mod1x.c unload8mod2.c unload8mod3.c \
 		   tst-audit1.c tst-audit2.c tst-audit3.c tst-audit4.c \
 		   tst-auditmod1.c tst-auditmod3a.c tst-auditmod3b.c \
 		   tst-auditmod4a.c tst-auditmod4b.c \
@@ -199,7 +200,7 @@ tests += loadtest restest1 preloadtest loadfail multiload origtest resolvfail \
 	 tst-align tst-align2 $(tests-execstack-$(have-z-execstack)) \
 	 tst-dlmodcount tst-dlopenrpath tst-deep1 \
 	 tst-dlmopen1 tst-dlmopen2 tst-dlmopen3 \
-	 unload3 unload4 unload5 unload6 unload7 tst-global1 order2 \
+	 unload3 unload4 unload5 unload6 unload7 unload8 tst-global1 order2 \
 	 tst-audit1 tst-audit2 \
 	 tst-stackguard1 tst-addr1 tst-thrlock \
 	 tst-unique1 tst-unique2 \
@@ -247,6 +248,7 @@ modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \
 		unload4mod1 unload4mod2 unload4mod3 unload4mod4 \
 		unload6mod1 unload6mod2 unload6mod3 \
 		unload7mod1 unload7mod2 \
+		unload8mod1 unload8mod1x unload8mod2 unload8mod3 \
 		order2mod1 order2mod2 order2mod3 order2mod4 \
 		tst-unique1mod1 tst-unique1mod2 \
 		tst-unique2mod1 tst-unique2mod2 \
@@ -522,6 +524,9 @@ $(objpfx)unload6mod2.so: $(libdl)
 $(objpfx)unload6mod3.so: $(libdl)
 $(objpfx)unload7mod1.so: $(libdl)
 $(objpfx)unload7mod2.so: $(objpfx)unload7mod1.so
+$(objpfx)unload8mod1.so: $(objpfx)unload8mod2.so
+$(objpfx)unload8mod2.so: $(objpfx)unload8mod3.so
+$(objpfx)unload8mod3.so: $(libdl)
 $(objpfx)tst-initordera2.so: $(objpfx)tst-initordera1.so
 $(objpfx)tst-initorderb2.so: $(objpfx)tst-initorderb1.so $(objpfx)tst-initordera2.so
 $(objpfx)tst-initordera3.so: $(objpfx)tst-initorderb2.so $(objpfx)tst-initorderb1.so
@@ -823,6 +828,9 @@ $(objpfx)unload7: $(libdl)
 $(objpfx)unload7.out: $(objpfx)unload7mod1.so $(objpfx)unload7mod2.so
 unload7-ENV = MALLOC_PERTURB_=85
 
+$(objpfx)unload8: $(libdl)
+$(objpfx)unload8.out: $(objpfx)unload8mod1.so $(objpfx)unload8mod1x.so
+
 ifdef libdl
 $(objpfx)tst-tls9-static: $(common-objpfx)dlfcn/libdl.a
 $(objpfx)tst-tls9-static.out: $(objpfx)tst-tlsmod5.so $(objpfx)tst-tlsmod6.so
diff --git a/elf/dl-close.c b/elf/dl-close.c
index 700e765..f47d5f8 100644
--- a/elf/dl-close.c
+++ b/elf/dl-close.c
@@ -421,6 +421,13 @@ _dl_close_worker (struct link_map *map)
 
 	      imap->l_scope_max = new_size;
 	    }
+	  else if (new_list != NULL)
+	    {
+	      /* We didn't change the scope array, so reset the search
+		 list.  */
+	      imap->l_searchlist.r_list = NULL;
+	      imap->l_searchlist.r_nlist = 0;
+	    }
 
 	  /* The loader is gone, so mark the object as not having one.
 	     Note: l_idx != IDX_STILL_USED -> object will be removed.  */
diff --git a/elf/unload8.c b/elf/unload8.c
new file mode 100644
index 0000000..f984a38
--- /dev/null
+++ b/elf/unload8.c
@@ -0,0 +1,33 @@
+#include <dlfcn.h>
+#include <stdio.h>
+
+int
+main (void)
+{
+  void *h = dlopen ("$ORIGIN/unload8mod1.so", RTLD_LAZY);
+  if (h == NULL)
+    {
+      puts ("dlopen unload8mod1.so failed");
+      return 1;
+    }
+
+  void *h2 = dlopen ("$ORIGIN/unload8mod1x.so", RTLD_LAZY);
+  if (h2 == NULL)
+    {
+      puts ("dlopen unload8mod1x.so failed");
+      return 1;
+    }
+  dlclose (h2);
+
+  int (*mod1) (void) = dlsym (h, "mod1");
+  if (mod1 == NULL)
+    {
+      puts ("dlsym failed");
+      return 1;
+    }
+
+  mod1 ();
+  dlclose (h);
+
+  return 0;
+}
diff --git a/elf/unload8mod1.c b/elf/unload8mod1.c
new file mode 100644
index 0000000..fe7e81c
--- /dev/null
+++ b/elf/unload8mod1.c
@@ -0,0 +1,7 @@
+extern void mod2 (void);
+
+void
+mod1 (void)
+{
+  mod2 ();
+}
diff --git a/elf/unload8mod1x.c b/elf/unload8mod1x.c
new file mode 100644
index 0000000..835b634
--- /dev/null
+++ b/elf/unload8mod1x.c
@@ -0,0 +1 @@
+int mod1x;
diff --git a/elf/unload8mod2.c b/elf/unload8mod2.c
new file mode 100644
index 0000000..2fd8b67
--- /dev/null
+++ b/elf/unload8mod2.c
@@ -0,0 +1,7 @@
+extern void mod3 (void);
+
+void
+mod2 (void)
+{
+  mod3 ();
+}
diff --git a/elf/unload8mod3.c b/elf/unload8mod3.c
new file mode 100644
index 0000000..d49e22b
--- /dev/null
+++ b/elf/unload8mod3.c
@@ -0,0 +1,27 @@
+#include <dlfcn.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+void
+mod3_fini2 (void)
+{
+}
+
+void
+mod3_fini (void)
+{
+  mod3_fini2 ();
+}
+
+void
+mod3 (void)
+{
+  void *h = dlopen ("$ORIGIN/unload8mod2.so", RTLD_LAZY);
+  if (h == NULL)
+    {
+      puts ("dlopen unload8mod2.so failed");
+      exit (1);
+    }
+
+  atexit (mod3_fini);
+}
-- 
1.7.6







^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2011-07-13  6:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-13  6:04 [gentoo-commits] gentoo commit in src/patchsets/glibc/2.13: 0059_all_glibc-2.13-dlclose-search-reset.patch README.history Mike Frysinger (vapier)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox