diff options
Diffstat (limited to 'deps/v8')
-rw-r--r-- | deps/v8/src/base/platform/platform-posix.cc | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/deps/v8/src/base/platform/platform-posix.cc b/deps/v8/src/base/platform/platform-posix.cc index 68d651b15f..d5624cb8ac 100644 --- a/deps/v8/src/base/platform/platform-posix.cc +++ b/deps/v8/src/base/platform/platform-posix.cc @@ -415,6 +415,16 @@ bool OS::SetPermissions(void* address, size_t size, MemoryPermission access) { int prot = GetProtectionFromMemoryPermission(access); int ret = mprotect(address, size, prot); + + // MacOS 11.2 on Apple Silicon refuses to switch permissions from + // rwx to none. Just use madvise instead. +#if defined(V8_OS_MACOSX) + if (ret != 0 && access == OS::MemoryPermission::kNoAccess) { + ret = madvise(address, size, MADV_FREE_REUSABLE); + return ret == 0; + } +#endif + if (ret == 0 && access == OS::MemoryPermission::kNoAccess) { // This is advisory; ignore errors and continue execution. USE(DiscardSystemPages(address, size)); |