summaryrefslogtreecommitdiff
path: root/ldso/libdl/libdl.c
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@openadk.org>2017-07-18 22:24:52 +0200
committerWaldemar Brodkorb <wbx@openadk.org>2017-07-20 20:11:25 +0200
commit952bb00f0b2eb576b0bf48c4f87018429a42e28d (patch)
tree72aba808da126f73e671187dc9a96cdde9cc6da1 /ldso/libdl/libdl.c
parent85c9aaf9e4410bcd367c3e5f6dab13ce9ba936f4 (diff)
Revert "libdl: fix size parameter when unmap library in dlclose"
This reverts commit 9b42da7d0558884e2a3cc9a8674ccfc752369610. This fixes a long standing bug in dlclose(). Can be seen with apache and mod_php or just by executing php -m to list all modules. Reported-by: Bernd Kuhls <bernd.kuhls@t-online.de>
Diffstat (limited to 'ldso/libdl/libdl.c')
-rw-r--r--ldso/libdl/libdl.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/ldso/libdl/libdl.c b/ldso/libdl/libdl.c
index f5b6e6092..f34f78152 100644
--- a/ldso/libdl/libdl.c
+++ b/ldso/libdl/libdl.c
@@ -790,7 +790,7 @@ static int do_dlclose(void *vhandle, int need_fini)
int (*dl_elf_fini) (void);
void (*dl_brk) (void);
struct dyn_elf *handle;
- unsigned int end = 0, start = 0xffffffff;
+ unsigned int end;
unsigned int i, j;
struct r_scope_elem *ls, *ls_next = NULL;
struct elf_resolve **handle_rlist;
@@ -867,8 +867,6 @@ static int do_dlclose(void *vhandle, int need_fini)
i < tpnt->n_phent; ppnt++, i++) {
if (ppnt->p_type != PT_LOAD)
continue;
- if (ppnt->p_vaddr < start)
- start = ppnt->p_vaddr;
if (end < ppnt->p_vaddr + ppnt->p_memsz)
end = ppnt->p_vaddr + ppnt->p_memsz;
}
@@ -975,9 +973,7 @@ static int do_dlclose(void *vhandle, int need_fini)
}
#endif
- end = (end + ADDR_ALIGN) & PAGE_ALIGN;
- start = start & ~ADDR_ALIGN;
- DL_LIB_UNMAP (tpnt, end - start);
+ DL_LIB_UNMAP (tpnt, end - tpnt->mapaddr);
/* Free elements in RTLD_LOCAL scope list */
for (runp = tpnt->rtld_local; runp; runp = tmp) {
tmp = runp->next;