diff options
author | Ambrose Feinstein <ambrose@google.com> | 2021-07-15 13:53:47 -0700 |
---|---|---|
committer | Fangrui Song <i@maskray.me> | 2021-08-27 17:26:07 -0700 |
commit | 22d31aef9ef4cad63fa5cc2e92e3cde403b97948 (patch) | |
tree | 31ec9d44dc3bfb91a7ba331f3af5d80f1fb72c21 | |
parent | 282bbfc364e9f0c5a0b006da377af6828e2048d8 (diff) | |
download | glibc-22d31aef9ef4cad63fa5cc2e92e3cde403b97948.zip glibc-22d31aef9ef4cad63fa5cc2e92e3cde403b97948.tar.gz glibc-22d31aef9ef4cad63fa5cc2e92e3cde403b97948.tar.bz2 |
Fix bug where ld.so hashtable would retain strings passed to dlopen().
-rw-r--r-- | elf/dl-load.c | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/elf/dl-load.c b/elf/dl-load.c index 1ae72aa..957f1b9 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; } |