setExecutable introduces W|X mappings
The setExecutable
utility in rts/posix/OSMem.c
introduces writable/executable mappings, which are strongly discouraged (and sometimes even disallowed) on modern machines. Unfortunately, fixing this will require a bit of refactoring. setExecutable
appears to be used on platforms from allocateExec
, which allocates executable memory. However the use-sites appear to expect the returned mapping to be writable as well. We will need to rearrange this interface into two pieces:
-
allocateExec
, which allocates readable/writable mapping. -
finalizeExec
, which finalizes remaps a mapping returned byallocateExec
as readable/executable.