summaryrefslogtreecommitdiff
path: root/hw/xfree86/loader/elfloader.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/xfree86/loader/elfloader.c')
-rw-r--r--hw/xfree86/loader/elfloader.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/hw/xfree86/loader/elfloader.c b/hw/xfree86/loader/elfloader.c
index 482ac3f01..9664b33a8 100644
--- a/hw/xfree86/loader/elfloader.c
+++ b/hw/xfree86/loader/elfloader.c
@@ -1096,6 +1096,18 @@ ELFCreatePLT(ELFModulePtr elffile)
ErrorF("ELFCreatePLT() Unable to allocate memory!!!!\n");
return;
}
+# if defined(linux) || defined(__OpenBSD__)
+ {
+ unsigned long page_size = getpagesize();
+ unsigned long round;
+
+ round = (unsigned long)elffile->plt & (page_size - 1);
+ mprotect(elffile->plt - round,
+ (elffile->pltsize + round + page_size - 1) & ~(page_size - 1),
+ PROT_READ | PROT_WRITE | PROT_EXEC);
+ }
+# endif
+
elffile->sections[elffile->pltndx].sh_size = elffile->pltsize;
# ifdef ELFDEBUG
ELFDEBUG("ELFCreatePLT: PLT address %lx\n", elffile->plt);