-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
macOS: Enable wasm and allow to load .wasm on Apple silicon #23257
Conversation
This applies https://chromium-review.googlesource.com/c/v8/v8/+/3700352 as a fix for MemoryAllocator::PartialFreeMemory() which shouldn't try to change permissions of RWX pages. This mainly affects macOS > 11.2 due to mprotect behavior changes (envoyproxy#23243) on Apple silicon. Signed-off-by: Dhi Aurrahman <[email protected]>
CC @envoyproxy/dependency-shepherds: Your approval is needed for changes made to |
bazel/v8.patch
Outdated
@@ -7,13 +7,15 @@ | |||
# 7. Fix build errors in SIMD IndexOf/includes (https://crrev.com/c/3749192). | |||
# 8. Fix build on arm64. | |||
# 9. Fix build on older versions of Linux. | |||
# 10. Fix MemoryAllocator::PartialFreeMemory() which shouldn't try to change permissions of RWX pages, | |||
# mainly affecting macOS on Apple silicon (https://chromium-review.googlesource.com/c/v8/v8/+/3700352). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you file an issue to track when this is released?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tracked here: #23258.
Signed-off-by: Dhi Aurrahman <[email protected]>
Thanks, @lizan! 🙇🏾 |
/lgtm deps |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but quite frankly I'd first try upgrading to v10.6 (or even v10.7, really).
bazel/v8.patch
Outdated
const int target_align = 32; | ||
// Scalar loop to reach desired alignment | ||
@@ -256,21 +266,21 @@ TARGET_AVX2 inline uintptr_t fast_search_avx(T* array, uintptr_t array_len, | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: This PR contains a dozen of unnecessary (whitespace) changes that make this much less readable, consider unstaging them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah sorry, my editor seems too eager to remove "trailing" whitespaces.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much better now, thanks!
Signed-off-by: Dhi Aurrahman <[email protected]>
Signed-off-by: Dhi Aurrahman <[email protected]>
@PiotrSikora sure. I'll try. However, since |
(sorry for the spammy request for re-reviewing this, seems like there was a glitch on GitHub on my side) |
Good point. I guess we could merge this (since it's already approved) and then update V8 in a follow-up PR. |
@RyanTheOptimist seems like we need another stamp (for deps). |
/lgtm deps |
@lizan could you help to approve and merge this? 🙇🏾 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks.
…xy#23257) * macOS: Allow to load .wasm on Apple silicon This applies https://chromium-review.googlesource.com/c/v8/v8/+/3700352 as a fix for MemoryAllocator::PartialFreeMemory() which shouldn't try to change permissions of RWX pages. This mainly affects macOS > 11.2 due to mprotect behavior changes (envoyproxy#23243) on Apple silicon.
Commit Message: This applies changes from https://chromium-review.googlesource.com/c/v8/v8/+/3700352 as a fix for
MemoryAllocator::PartialFreeMemory()
which shouldn't try to change permissions of RWX pages.This mainly affects macOS > 11.2 due to
mprotect()
behavior changes (#23243, https://chromium-review.googlesource.com/c/v8/v8/+/3610445/comment/6294ada3_a3cab643/) on Apple silicon.This also flips the Wasm feature to be enabled by default on macOS.
The future patch removal task is tracked in #23258.
Signed-off-by: Dhi Aurrahman [email protected]
Additional description:
By applying this patch on my local (macOS, 12.6 (21G115), M1), I can run
envoy
to load a.wasm
from theexamples/wasm-cc
. Before this patch, it was caught by:EACCESS
error. See #23243 for more details.Also, I think we need to backport this to
release/1.23
(which has the same v8 version), hence the Homebrew build for Apple silicon will have this Wasm feature enabled.Risk Level: Low, since the current behavior is preserved, and the patch is included on upstream (v8, 10.5-lkgr has it)
Testing: existing, and manual testing on macOS M1
Docs Changes: N/A
Release Notes: N/A (should we add an announcement since we enable wasm by default again?)
Platform Specific Features: enable wasm (v8 runtime) on macOS by default
Fixes #23243