Is Safe Haskell intended to allow segfaults?

Mikhail Glushenkov mikhail.glushenkov at gmail.com
Tue Aug 9 00:46:10 UTC 2016


Hi,

On 9 August 2016 at 01:32, David Terei <davidterei at gmail.com> wrote:
> I imagine in Java, that I can construct an invalid pointer in foreign
> code, and then cause segfaults without the Java code having any
> issues. Just guessing at this, so very interested to know how it's
> prevented if I can't.

Yes, this can be done with JNI, see e.g. [1]. Additionally, by using
sun.misc.Unsafe [2], one can cause segfaults even from pure Java.

[1] https://www.cs.princeton.edu/~appel/papers/safejni.pdf
[2] http://www.inf.usi.ch/faculty/lanza/Downloads/Mast2015a.pdf


More information about the ghc-devs mailing list