summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPHO <pho@cielonegro.org>2020-01-18 12:30:54 (GMT)
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-01-25 10:23:01 (GMT)
commit8b726534fa4764ad423eff9bdfb04305f330a00f (patch)
tree4cb7d8c69014a136f759229bf158e0ebd62cdcd1
parent6e2d9ee25bce06ae51d2f1cf8df4f7422106a383 (diff)
downloadghc-8b726534fa4764ad423eff9bdfb04305f330a00f.zip
ghc-8b726534fa4764ad423eff9bdfb04305f330a00f.tar.gz
ghc-8b726534fa4764ad423eff9bdfb04305f330a00f.tar.bz2
Fix rts allocateExec() on NetBSD
Similar to SELinux, NetBSD "PaX mprotect" prohibits marking a page mapping both writable and executable at the same time. Use libffi which knows how to work around it.
-rw-r--r--rts/sm/Storage.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/rts/sm/Storage.c b/rts/sm/Storage.c
index 9609ba8..6bcd11d 100644
--- a/rts/sm/Storage.c
+++ b/rts/sm/Storage.c
@@ -1595,11 +1595,12 @@ void flushExec (W_ len, AdjustorExecutable exec_addr)
#endif
}
-#if defined(linux_HOST_OS)
+#if defined(linux_HOST_OS) || defined(netbsd_HOST_OS)
// On Linux we need to use libffi for allocating executable memory,
// because it knows how to work around the restrictions put in place
-// by SELinux.
+// by SELinux. The same goes for NetBSD where it is prohibited to
+// mark a page mapping both writable and executable at the same time.
AdjustorWritable allocateExec (W_ bytes, AdjustorExecutable *exec_ret)
{