summaryrefslogtreecommitdiff
path: root/rts/Adjustor.c
diff options
context:
space:
mode:
authorIan Lynagh <ian@well-typed.com>2013-04-09 13:53:28 +0100
committerIan Lynagh <ian@well-typed.com>2013-04-09 14:02:48 +0100
commit27cf625ab871f34434d9fe86cecf85a31f73f0e5 (patch)
treeaad30c36489af7d9c3f824407ddaf6cdc0a31184 /rts/Adjustor.c
parent75ed401fecd487a1daa8f372e616750c5a6832bd (diff)
downloadhaskell-27cf625ab871f34434d9fe86cecf85a31f73f0e5.tar.gz
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.
Diffstat (limited to 'rts/Adjustor.c')
-rw-r--r--rts/Adjustor.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/rts/Adjustor.c b/rts/Adjustor.c
index 1a0bc28d4e..fbf95df936 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;