m32 allocator unconditionally mmaps a WX mapping
Mattias Kilian reports on ghc-devs that GHCi fails on OpenBSD due to m32_allocator_init trying to create a memory mapping with writable and executable access. The culprit appears to be this call-graph:
-
Linker.initDynLinkercalls -
Linker.reallyInitDynLinkercalls -
GHCi.initObjLinkercalls -
GHCi.ObjLink.initObjLinkercalls -
initLinker_calls -
m32_allocator_initwhich creates the mapping in question viammapForLinker
It's unclear exactly what calls initDynLinker but there are numerous call-sites; I suspect it's not possible to enter GHCi without passing through initDynLinker at some point.
I suspect the solution here is to teach the linker to be more deliberate in the access that it requests for its mappings (see #12657 (closed)).