summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ldso/ldso/dl-startup.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/ldso/ldso/dl-startup.c b/ldso/ldso/dl-startup.c
index 9b6ef76c6..f97619af3 100644
--- a/ldso/ldso/dl-startup.c
+++ b/ldso/ldso/dl-startup.c
@@ -383,7 +383,8 @@ found_got:
* it to us rx.
*/
Elf32_Addr mpa = (ppnt->p_vaddr + app_tpnt->loadaddr) & ~(_dl_pagesize - 1);
- if(_dl_mprotect(mpa, ppnt->p_memsz, PROT_READ | PROT_WRITE | PROT_EXEC)) {
+ Elf32_Word mps = ((ppnt->p_vaddr + app_tpnt->loadaddr) - mpa) + ppnt->p_memsz;
+ if(_dl_mprotect(mpa, mps, PROT_READ | PROT_WRITE | PROT_EXEC)) {
SEND_STDERR("Couldn't mprotect .dynamic segment to rwx.\n");
_dl_exit(0);
}