Skip to content

Instantly share code, notes, and snippets.

@m6w6
Created February 24, 2022 08:52
Show Gist options
  • Save m6w6/8decef356231e2cc0ffdedcfb9dcfb9b to your computer and use it in GitHub Desktop.
Save m6w6/8decef356231e2cc0ffdedcfb9dcfb9b to your computer and use it in GitHub Desktop.
diff --git a/ext/pcre/pcre2lib/sljit/sljitExecAllocator.c b/ext/pcre/pcre2lib/sljit/sljitExecAllocator.c
index 6e5bf78e45..7c773f40fc 100644
--- a/ext/pcre/pcre2lib/sljit/sljitExecAllocator.c
+++ b/ext/pcre/pcre2lib/sljit/sljitExecAllocator.c
@@ -175,7 +175,7 @@ static SLJIT_INLINE void* alloc_chunk(sljit_uw size)
#endif
#ifdef MAP_ANON
- flags |= MAP_ANON | SLJIT_MAP_JIT;
+ flags |= MAP_ANON | SLJIT_MAP_JIT | MAP_JIT;
#else /* !MAP_ANON */
if (SLJIT_UNLIKELY((dev_zero < 0) && open_dev_zero()))
return NULL;
@@ -187,10 +187,12 @@ static SLJIT_INLINE void* alloc_chunk(sljit_uw size)
if (retval == MAP_FAILED)
return NULL;
+#if !(defined(__APPLE__) && defined(__arm64__))
if (mprotect(retval, size, PROT_READ | PROT_WRITE | PROT_EXEC) < 0) {
munmap(retval, size);
return NULL;
}
+#endif
SLJIT_UPDATE_WX_FLAGS(retval, (uint8_t *)retval + size, 0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment