summaryrefslogtreecommitdiff
diff options
authorHolger Hans Peter Freyther <[email protected]>2024-03-17 09:19:50 +0800
committerHolger Hans Peter Freyther <[email protected]>2024-03-17 09:26:18 +0800
commitbf3fd4b501c71efa86d7f91d5127cab621245a8d (patch)
tree181882748b5f12412f546da204ded62c8139d2d2
parent4ba653effd1e765b2051386ee313d9a1688f7c44 (diff)
downloadsmalltalk-master.tar.gz
mem: macos on arm64 does not allow write (and read) on executable pagesHEADmaster
On macos with apple silicon mmap with PROT_EXEC|PROT_WRITE will fail. This caused the heap code to fail. We do not expect to execute any of these pages. So let's remove this bit. The jit code will require some more changes to support RW^X on hardened systems. The change is enough to make basics of gst run on macos/arm64.
-rw-r--r--libgst/ChangeLog4
-rw-r--r--libgst/sysdep/posix/mem.c2
2 files changed, 5 insertions, 1 deletions
diff --git a/libgst/ChangeLog b/libgst/ChangeLog
index 1ce4c68f..64821314 100644
--- a/libgst/ChangeLog
+++ b/libgst/ChangeLog
@@ -1,3 +1,7 @@
+2024-03-17 Holger Hans Peter Freyther <[email protected]>
+
+ * sysdep/posix/mem.c (anon_mmap_commit): Enable W^X for our allocated memory.
+
2024-03-16 Holger Hans Peter Freyther <[email protected]>
* genbc-impl.y: Map yynerrs, yychar to local state. Map yylval to the shared state.
diff --git a/libgst/sysdep/posix/mem.c b/libgst/sysdep/posix/mem.c
index 5dc8f1cf..97ebfe69 100644
--- a/libgst/sysdep/posix/mem.c
+++ b/libgst/sysdep/posix/mem.c
@@ -225,7 +225,7 @@ PTR
anon_mmap_commit (PTR base, size_t size)
{
PTR result = mmap (base, size,
- PROT_READ | PROT_WRITE | PROT_EXEC,
+ PROT_READ | PROT_WRITE,
MAP_ANON | MAP_PRIVATE | MAP_FIXED, -1, 0);
return UNCOMMON (result == MAP_FAILED) ? NULL : result;