Commit 27cf625a authored by ian@well-typed.com's avatar ian@well-typed.com
Browse files

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.
parent 75ed401f
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment