diff options
author | Egbert Eich <eich@suse.de> | 2004-04-02 17:25:21 +0000 |
---|---|---|
committer | Egbert Eich <eich@suse.de> | 2004-04-02 17:25:21 +0000 |
commit | 0f8d2fd7d0c6ff169abed9b07ac63b57d80b8811 (patch) | |
tree | 8e29fba5cb8d3580810322e37edca030f25971e5 | |
parent | cbf1017a8870a8194e67f7fd9ffffab18cbc270b (diff) |
69. Mark PLT table executable on OSes that don't allow to execute dataXORG-RELEASE-1-TM-MERGE
areas by default (Bugzilla 395, John Dennis).
-rw-r--r-- | hw/xfree86/loader/elfloader.c | 12 |
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); |