[wasm] Disable NativeModuleModificationScope on arm64 Mac
M1 hardware uses the CodeSpaceWriteScope (which uses MAP_JIT under the hood), hence all other memory protection mechanisms should be disabled there. Trying to protect code space allocated with MAP_JIT would fail otherwise, resulting in a CHECK failure. R=jkummerow@chromium.org CC=dlehmann@chromium.org Bug: chromium:1218782 Change-Id: I626990575c2180168c2e421a93b9f0b035382f03 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2959613 Commit-Queue: Clemens Backes <clemensb@chromium.org> Reviewed-by: Jakob Kummerow <jkummerow@chromium.org> Cr-Commit-Position: refs/heads/master@{#75123}
This commit is contained in:
parent
f2b726f9dd
commit
7cd9341e86
@ -2293,6 +2293,7 @@ WasmCode* WasmCodeManager::LookupCode(Address pc) const {
|
||||
return candidate ? candidate->Lookup(pc) : nullptr;
|
||||
}
|
||||
|
||||
#if !(defined(V8_OS_MACOSX) && defined(V8_HOST_ARCH_ARM64))
|
||||
// TODO(v8:7424): Code protection scopes are not yet supported with shared code
|
||||
// enabled and need to be revisited.
|
||||
NativeModuleModificationScope::NativeModuleModificationScope(
|
||||
@ -2325,6 +2326,7 @@ NativeModuleModificationScope::~NativeModuleModificationScope() {
|
||||
CHECK(success);
|
||||
}
|
||||
}
|
||||
#endif // !(defined(V8_OS_MACOSX) && defined(V8_HOST_ARCH_ARM64))
|
||||
|
||||
namespace {
|
||||
thread_local WasmCodeRefScope* current_code_refs_scope = nullptr;
|
||||
|
@ -982,6 +982,14 @@ class V8_EXPORT_PRIVATE WasmCodeManager final {
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
};
|
||||
|
||||
#if defined(V8_OS_MACOSX) && defined(V8_HOST_ARCH_ARM64)
|
||||
// Arm64 on MacOS (M1 hardware) uses CodeSpaceWriteScope to switch permissions.
|
||||
// TODO(wasm): Merge NativeModuleModificationScope and CodeSpaceWriteScope.
|
||||
class V8_NODISCARD NativeModuleModificationScope final {
|
||||
public:
|
||||
explicit NativeModuleModificationScope(NativeModule*) {}
|
||||
};
|
||||
#else
|
||||
// Within the scope, the native_module is writable and not executable.
|
||||
// At the scope's destruction, the native_module is executable and not writable.
|
||||
// The states inside the scope and at the scope termination are irrespective of
|
||||
@ -1006,6 +1014,7 @@ class V8_NODISCARD NativeModuleModificationScope final {
|
||||
private:
|
||||
NativeModule* native_module_;
|
||||
};
|
||||
#endif
|
||||
|
||||
// {WasmCodeRefScope}s form a perfect stack. New {WasmCode} pointers generated
|
||||
// by e.g. creating new code or looking up code by its address are added to the
|
||||
|
Loading…
Reference in New Issue
Block a user