summaryrefslogtreecommitdiff
path: root/rts
diff options
context:
space:
mode:
authorPHO <pho@cielonegro.org>2020-01-18 21:30:54 +0900
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-01-25 05:23:01 -0500
commit8b726534fa4764ad423eff9bdfb04305f330a00f (patch)
tree4cb7d8c69014a136f759229bf158e0ebd62cdcd1 /rts
parent6e2d9ee25bce06ae51d2f1cf8df4f7422106a383 (diff)
downloadhaskell-8b726534fa4764ad423eff9bdfb04305f330a00f.tar.gz
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.
Diffstat (limited to 'rts')
-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 9609ba8aec..6bcd11df5a 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)
{