aboutsummaryrefslogtreecommitdiff
path: root/elf/dl-close.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2006-09-19 14:42:12 +0000
committerUlrich Drepper <drepper@redhat.com>2006-09-19 14:42:12 +0000
commit1ee2ff2053aeaa43987275c3aad5e6e42716f50e (patch)
tree028c11f16cc80083734c79209a7e72f5fb7d2c48 /elf/dl-close.c
parent0466106efce2eedc4bc874280ecadd5cd931281f (diff)
downloadglibc-1ee2ff2053aeaa43987275c3aad5e6e42716f50e.tar
glibc-1ee2ff2053aeaa43987275c3aad5e6e42716f50e.tar.gz
glibc-1ee2ff2053aeaa43987275c3aad5e6e42716f50e.tar.bz2
glibc-1ee2ff2053aeaa43987275c3aad5e6e42716f50e.zip
* elf/dl-close.c (_dl_close): If dependency is not unloaded make
sure no reference to the unloaded map's search list remains in the dependency's scope. 2006-09-16 Jakub Jelinek <jakub@redhat.com> * elf/Makefile: Add rules to build and run unload7 test. * elf/unload7.c: New test. * elf/unload7mod1.c: New file. * elf/unload7mod2.c: New file.
Diffstat (limited to 'elf/dl-close.c')
-rw-r--r--elf/dl-close.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/elf/dl-close.c b/elf/dl-close.c
index 754dd678fe..6a2ad976a7 100644
--- a/elf/dl-close.c
+++ b/elf/dl-close.c
@@ -1,5 +1,5 @@
/* Close a shared object opened by `_dl_open'.
- Copyright (C) 1996-2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1996-2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -330,7 +330,7 @@ _dl_close (void *_map)
for (cnt = 0; imap->l_scope[cnt] != NULL; ++cnt)
/* This relies on l_scope[] entries being always set either
- to its own l_symbolic_searchlist address, or some other map's
+ to its own l_symbolic_searchlist address, or some map's
l_searchlist address. */
if (imap->l_scope[cnt] != &imap->l_symbolic_searchlist)
{
@@ -347,6 +347,21 @@ _dl_close (void *_map)
}
}
}
+ else
+ {
+ unsigned int cnt = 0;
+ while (imap->l_scope[cnt] != NULL)
+ {
+ if (imap->l_scope[cnt] == &map->l_searchlist)
+ {
+ while ((imap->l_scope[cnt] = imap->l_scope[cnt + 1])
+ != NULL)
+ ++cnt;
+ break;
+ }
+ ++cnt;
+ }
+ }
/* The loader is gone, so mark the object as not having one.
Note: l_idx != -1 -> object will be removed. */