Skip to content

Commit

Permalink
Fix segfaults on SELinux machines; fixes #7629
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Ian Lynagh committed Apr 9, 2013
1 parent 75ed401 commit 27cf625
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion rts/Adjustor.c
Expand Up @@ -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;

Expand Down

0 comments on commit 27cf625

Please sign in to comment.