Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/deps
diff options
context:
space:
mode:
authorMatin Zadehdolatabad <zadehdolatabad@gmail.com>2021-02-08 16:52:37 +0300
committerMichaël Zasso <targos@protonmail.com>2021-04-11 13:35:52 +0300
commit5707adaf331cafb747c31e44621314e9f20ab188 (patch)
tree9eda1b93373a4f594e0daec00e7e4aca5d179c7a /deps
parentdb04ae6b0255b751346cfbc2fe3f63fb38b1e1fe (diff)
deps: V8: cherry-pick 0c8b6e415c30
Original commit message: [mac][wasm] Work around MacOS 11.2 code page decommit failures MacOS 11.2 refuses to set "no access" permissions on memory that we previously used for JIT-compiled code. It is still unclear whether this is WAI on the part of the kernel. In the meantime, as a workaround, we use madvise(..., MADV_FREE_REUSABLE) instead of mprotect(..., NONE) when discarding code pages. This is inspired by what Chromium's gin platform does. Fixed: v8:11389 Change-Id: I866586932573b4253002436ae5eee4e0411c45fc Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2679688 Commit-Queue: Jakob Kummerow <jkummerow@chromium.org> Commit-Queue: Michael Lippautz <mlippautz@chromium.org> Auto-Submit: Jakob Kummerow <jkummerow@chromium.org> Reviewed-by: Michael Lippautz <mlippautz@chromium.org> Cr-Commit-Position: refs/heads/master@{#72559} Backport-PR-URL: https://github.com/nodejs/node/pull/38051 Co-authored-by: BoHong Li <a60814billy@gmail.com> Refs: https://github.com/v8/v8/commit/0c8b6e415c3020a987d2287f1543d629cd993535 Fixes: https://github.com/nodejs/node/issues/37061 PR-URL: https://github.com/nodejs/node/pull/37276 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Ash Cripps <acripps@redhat.com>
Diffstat (limited to 'deps')
-rw-r--r--deps/v8/src/base/platform/platform-posix.cc10
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 9785904aa05..e5aa4de160c 100644
--- a/deps/v8/src/base/platform/platform-posix.cc
+++ b/deps/v8/src/base/platform/platform-posix.cc
@@ -390,6 +390,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));