Snow Leopard GHC

Simon Marlow marlowsd at gmail.com
Fri Sep 25 04:26:09 EDT 2009


On 24/09/2009 23:54, Barney Stratford wrote:
> Only limited success with GHCi, I'm afraid. The problem seems to be that
> Snow Leopard is much stricter about security than Leopard was. (Caveat -
> I don't really know what I'm talking about.) In particular, I don't
> think it will let you execute code outside of the __TEXT segment, which
> is exactly what GHCi tries to do - hence the bus errors.

We had similar problems with SELinux, which we worked around by using 
libffi to allocate our memory; it handles the multiple-mmapping trick 
that you need to do to avoid having memory that is both writable and 
executable.  You might need to enable this for Darwin too: look in 
rts/sm/Storage.c:allocateExec(), and change the #ifdef so that the 
libffi version is used for darwin too.

> I've tried just letting the dynamic linker (dyld) sort everything out
> for us, but this failed because not all symbols are dynamically linked,
> and the statically linked ones are invisible to it.
>
> One change that will be necessary in any case: towards the end of
> rts/Linker.c, change
> case X86_64_RELOC_SIGNED:
> ASSERT(reloc->r_pcrel);
> thing += value - baseValue;
> break;
>
> to
>
> case X86_64_RELOC_SIGNED:
> case X86_64_RELOC_SIGNED_1:
> case X86_64_RELOC_SIGNED_2:
> case X86_64_RELOC_SIGNED_4:
> ASSERT(reloc->r_pcrel);
> thing += value - baseValue;
> break;

Manuel, maybe you could validate and push this one?

Cheers,
	Simon


More information about the Glasgow-haskell-users mailing list