From 1ee2ff2053aeaa43987275c3aad5e6e42716f50e Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Tue, 19 Sep 2006 14:42:12 +0000 Subject: * 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 * 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. --- elf/dl-close.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'elf/dl-close.c') 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. */ -- cgit v1.2.3