diff options
author | Waldemar Brodkorb <wbx@uclibc-ng.org> | 2018-04-17 20:19:06 +0100 |
---|---|---|
committer | Waldemar Brodkorb <wbx@uclibc-ng.org> | 2018-04-17 20:19:06 +0100 |
commit | 35105679b9a900d58dadd0852e679c235f8176ba (patch) | |
tree | efdb327c0a09565412ddadb7e3e102080179dc43 /ldso/libdl/libdl.c | |
parent | eb560ac797e67c116f56c7f921dece3057ec81de (diff) |
libdl: fix problem with unmapping
The munmap was still called with broken length, as sometimes
start was empty. This finally solves segfaults when running
php -m with ldap module activated.
Diffstat (limited to 'ldso/libdl/libdl.c')
-rw-r--r-- | ldso/libdl/libdl.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/ldso/libdl/libdl.c b/ldso/libdl/libdl.c index 3829e736d..ebf6ae329 100644 --- a/ldso/libdl/libdl.c +++ b/ldso/libdl/libdl.c @@ -856,8 +856,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; } @@ -964,8 +962,11 @@ static int do_dlclose(void *vhandle, int need_fini) } #endif + start = tpnt->mapaddr; + _dl_if_debug_print("unmapping before alignment: %s start: '%p' end: '%p'\n", tpnt->libname, start, end); end = (end + ADDR_ALIGN) & PAGE_ALIGN; start = start & ~ADDR_ALIGN; + _dl_if_debug_print("unmapping: %s start: '%p' end: '%p'\n", tpnt->libname, start, end); DL_LIB_UNMAP (tpnt, end - start); /* Free elements in RTLD_LOCAL scope list */ for (runp = tpnt->rtld_local; runp; runp = tmp) { |