From a1473f69bafdc576be8bef7367ff474eade8ce5b Mon Sep 17 00:00:00 2001 From: Kris Katterjohn <katterjohn@gmail.com> Date: Fri, 4 Oct 2019 20:50:41 -0500 Subject: [PATCH] mmapped heaps: fix for systems with W^X policies Using read/write/exec causes an error (or possibly abort) on systems with W^X policies (like OpenBSD and NetBSD have by default). Since the heap does not need to be executable, just use read/write. --- gc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gc.c b/gc.c index 0d938bdd..c3c83dfc 100644 --- a/gc.c +++ b/gc.c @@ -500,7 +500,7 @@ sexp_heap sexp_make_heap (size_t size, size_t max_size, size_t chunk_size) { sexp_free_list free, next; sexp_heap h; #if SEXP_USE_MMAP_GC - h = mmap(NULL, sexp_heap_pad_size(size), PROT_READ|PROT_WRITE|PROT_EXEC, + h = mmap(NULL, sexp_heap_pad_size(size), PROT_READ|PROT_WRITE, MAP_ANON|MAP_PRIVATE, -1, 0); if (h == MAP_FAILED) return NULL; #else