[commit: ghc] master: Fix segfaults on SELinux machines; fixes #7629 (27cf625)
Ian Lynagh
igloo at earth.li
Tue Apr 9 16:41:56 CEST 2013
Repository : http://darcs.haskell.org/ghc.git/
On branch : master
https://github.com/ghc/ghc/commit/27cf625ab871f34434d9fe86cecf85a31f73f0e5
>---------------------------------------------------------------
commit 27cf625ab871f34434d9fe86cecf85a31f73f0e5
Author: Ian Lynagh <ian at well-typed.com>
Date: Tue Apr 9 13:53:28 2013 +0100
Fix segfaults on SELinux machines; fixes #7629
Patch from wgmitchener.
From the ticket:
The two addresses (adjustorStub and code) contain the same memory
(double-mapped), but one is writable while the other is executable.
This is how libffi works around the SELinux restrictions. On
non-SELinux systems the code and data addresses are probably the same.
>---------------------------------------------------------------
rts/Adjustor.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/rts/Adjustor.c b/rts/Adjustor.c
index 1a0bc28..fbf95df 100644
--- a/rts/Adjustor.c
+++ b/rts/Adjustor.c
@@ -389,7 +389,7 @@ createAdjustor(int cconv, StgStablePtr hptr,
int sz = totalArgumentSize(typeString);
adjustorStub->call[0] = 0xe8;
- *(long*)&adjustorStub->call[1] = ((char*)&adjustorCode) - ((char*)adjustorStub + 5);
+ *(long*)&adjustorStub->call[1] = ((char*)&adjustorCode) - ((char*)code + 5);
adjustorStub->hptr = hptr;
adjustorStub->wptr = wptr;
More information about the ghc-commits
mailing list