public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Stan Shebs <shebs@sourceware.org>
To: glibc-cvs@sourceware.org
Subject: [glibc/google/grte/v5-2.27/master] Fix bug where ld.so hashtable would retain strings passed to dlopen().
Date: Thu, 15 Jul 2021 20:54:06 +0000 (GMT)	[thread overview]
Message-ID: <20210715205406.B797A3853804@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=0ad524ba97cc582049e92ea22550169e161e307a

commit 0ad524ba97cc582049e92ea22550169e161e307a
Author: Ambrose Feinstein <ambrose@google.com>
Date:   Thu Jul 15 13:53:47 2021 -0700

    Fix bug where ld.so hashtable would retain strings passed to dlopen().

Diff:
---
 elf/dl-load.c | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/elf/dl-load.c b/elf/dl-load.c
index 1ae72aa325..957f1b9b30 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -877,6 +877,7 @@ lib_hash_addname (const char *name, struct link_map *lib)
   *p = n;
 }
 
+/* 'name' must be the exact pointer originally passed to lib_hash_addname(). */
 static void
 lib_hash_delname (const char *name, struct link_map *lib)
 {
@@ -885,8 +886,7 @@ lib_hash_delname (const char *name, struct link_map *lib)
   while (*p)
     {
       struct lib_hash_namenode *n = *p;
-      if (n->hash == hash && n->lib == lib &&
-          (n->name == name || !strcmp (n->name, name))) {
+      if (n->hash == hash && n->lib == lib && n->name == name) {
         *p = n->next;
         free (n);
         return;
@@ -1018,16 +1018,7 @@ _dl_map_object_from_fd (const char *name, const char *origname, int fd, off_t of
          Just bump its reference count and return it.  */
       __close (fd);
 
-      /* If the name is not in the list of names for this object add
-         it.  */
       free (realname);
-      if (offset == 0)
-        {
-          /* If offset!=0, foo.so/@0x<offset> should be the *only*
-             name for this object. b/20141439.  */
-          add_name_to_object (l, name);
-          lib_hash_addname (name, l);
-        }
 
       return l;
     }


             reply	other threads:[~2021-07-15 20:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-15 20:54 Stan Shebs [this message]
2021-08-28  0:39 Fangrui Song

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=20210715205406.B797A3853804@sourceware.org \
    --to=shebs@sourceware.org \
    --cc=glibc-cvs@sourceware.org \
    /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).