[Git][ghc/ghc][wip/T16779] rts/linker: Only mprotect GOT after it is filled
Ben Gamari
gitlab at gitlab.haskell.org
Sat Jun 8 19:37:53 UTC 2019
Ben Gamari pushed to branch wip/T16779 at Glasgow Haskell Compiler / GHC
Commits:
e04f6328 by Ben Gamari at 2019-06-08T19:37:45Z
rts/linker: Only mprotect GOT after it is filled
This fixes a regression, introduced by 67c422ca, where we mprotect'd the
global offset table (GOT) region to PROT_READ before we had finished
filling it, resulting in a linker crash.
Fixes #16779.
- - - - -
1 changed file:
- rts/linker/elf_got.c
Changes:
=====================================
rts/linker/elf_got.c
=====================================
@@ -64,8 +64,6 @@ makeGot(ObjectCode * oc) {
symTab->symbols[i].got_addr
= (uint8_t *)oc->info->got_start
+ (slot++ * sizeof(void*));
- if(mprotect(mem, oc->info->got_size, PROT_READ) != 0) {
- sysErrorBelch("unable to protect memory");
}
}
return EXIT_SUCCESS;
@@ -115,6 +113,11 @@ fillGot(ObjectCode * oc) {
}
}
}
+
+ // We are done initializing the GOT; freeze it.
+ if(mprotect(oc->info->got_start, oc->info->got_size, PROT_READ) != 0) {
+ sysErrorBelch("unable to protect memory");
+ }
return EXIT_SUCCESS;
}
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/commit/e04f6328a66361592a60003b8a2e3ea1a6659579
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/commit/e04f6328a66361592a60003b8a2e3ea1a6659579
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20190608/2cc34d56/attachment-0001.html>
More information about the ghc-commits
mailing list