public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Ulrich Drepper <drepper@redhat.com>
Cc: Glibc hackers <libc-hacker@sources.redhat.com>
Subject: [PATCH] Fix LD_TRACE_PRELINKING
Date: Sat, 12 Feb 2005 22:28:00 -0000	[thread overview]
Message-ID: <20050212222824.GL4777@sunsite.mff.cuni.cz> (raw)

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

                 reply	other threads:[~2005-02-12 22:28 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050212222824.GL4777@sunsite.mff.cuni.cz \
    --to=jakub@redhat.com \
    --cc=drepper@redhat.com \
    --cc=libc-hacker@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).