This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix LD_TRACE_PRELINKING


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]