public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Fix LD_TRACE_PRELINKING
@ 2005-02-12 22:28 Jakub Jelinek
  0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2005-02-12 22:28 UTC (permalink / raw)
  To: Ulrich Drepper; +Cc: Glibc hackers

Hi!

Without this patch LD_TRACE_PRELINKING doesn't report conflicts caused by
ld.so relocations (malloc, free, etc.).
This causes that prelinked binaries use ld.so's own malloc/free, which is
in itself bad, but especially bad when e.g. ld.so malloces something and
libc.so attempts to free it or the other way around.

2005-02-12  Jakub Jelinek  <jakub@redhat.com>

	* elf/rtld.c (dlmain): If LD_TRACE_PRELINKING, clear l_relocated flag
	before relocating ld.so again.

--- libc/elf/rtld.c.jj	2005-02-11 15:22:21.000000000 +0100
+++ libc/elf/rtld.c	2005-02-12 10:50:50.000000000 +0100
@@ -1919,10 +1919,13 @@ ERROR: ld.so: object '%s' from %s cannot
 
 	      if ((GLRO(dl_debug_mask) & DL_DEBUG_PRELINK)
 		  && GL(dl_rtld_map).l_opencount > 1)
-		_dl_relocate_object (&GL(dl_rtld_map), main_map->l_scope,
-				     0, 0);
-	    }
-
+		{
+		  /* Mark the link map as not yet relocated again.  */
+		  GL(dl_rtld_map).l_relocated = 0;
+		  _dl_relocate_object (&GL(dl_rtld_map), main_map->l_scope,
+				       0, 0);
+		}
+            }
 #define VERNEEDTAG (DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGIDX (DT_VERNEED))
 	  if (version_info)
 	    {

	Jakub

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

only message in thread, other threads:[~2005-02-12 22:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-12 22:28 [PATCH] Fix LD_TRACE_PRELINKING Jakub Jelinek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).