[MLton] reason for mprotect with PROT_EXEC ?

Matthew Fluet fluet at tti-c.org
Tue Feb 12 09:27:21 PST 2008


On Sat, 9 Feb 2008, Adam Goode wrote:
>>> The function is GC_mmapAnon_safe_protect, and it looks like it is only
>>> called once, through GC_init and initSignalStack. I doubt the signal
>>> stack needs to be executable, but I am not totally sure. Am I right that
>>> profiling is the only thing that uses the signal stack?

BTW, profiling is not the only thing that uses the signal stack.  Any SML 
program that uses MLton.Signal to install a non-default signal handler 
will end up using the alternate signal stack.

> Hmm, I will probably just patch MLton in Fedora to not PROT_EXEC. But
> this is still not perfect since if someone gives me a binary to run from
> another machine, I will have to chcon it first. Oh well, nothing's
> perfect. :-)

Another alternative would be to add another #define configuration 
parameter, say NEEDS_SIGALTSTACK_EXEC, which would be set by the various 
platform/{arch,os}.h files and used by the platform/mmap-protect.c file to 
use the appropriate flags.




More information about the MLton mailing list