Commit a8c27fcc authored by Samuel Groß's avatar Samuel Groß Committed by V8 LUCI CQ

[sandbox] Enable the sandbox by default in V8 builds

This change makes the default configuration of standalone V8 builds
(again) reflect the default configuration of V8 in Chromium builds.

Bug: v8:10391
Change-Id: Ia98492a283772ebfde43f0edbfdff05319ac4352
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3913345Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Commit-Queue: Samuel Groß <saelo@chromium.org>
Cr-Commit-Position: refs/heads/main@{#83390}
parent a89e10fd
...@@ -521,9 +521,8 @@ if (v8_enable_sandbox == "") { ...@@ -521,9 +521,8 @@ if (v8_enable_sandbox == "") {
# once that is enabled everywhere by default. # once that is enabled everywhere by default.
# TODO(chromium:1325784) the sandbox is not currently supported in Chromium # TODO(chromium:1325784) the sandbox is not currently supported in Chromium
# on Fuchsia. # on Fuchsia.
v8_enable_sandbox = v8_enable_sandbox = v8_enable_pointer_compression_shared_cage &&
build_with_chromium && v8_enable_pointer_compression_shared_cage && v8_enable_external_code_space && target_os != "fuchsia"
v8_enable_external_code_space && target_os != "fuchsia"
} }
# Enable all available sandbox features if sandbox future is enabled. # Enable all available sandbox features if sandbox future is enabled.
......
...@@ -8128,12 +8128,12 @@ std::unique_ptr<v8::BackingStore> v8::ArrayBuffer::NewBackingStore( ...@@ -8128,12 +8128,12 @@ std::unique_ptr<v8::BackingStore> v8::ArrayBuffer::NewBackingStore(
void* deleter_data) { void* deleter_data) {
CHECK_LE(byte_length, i::JSArrayBuffer::kMaxByteLength); CHECK_LE(byte_length, i::JSArrayBuffer::kMaxByteLength);
#ifdef V8_ENABLE_SANDBOX #ifdef V8_ENABLE_SANDBOX
Utils::ApiCheck( Utils::ApiCheck(!data || i::GetProcessWideSandbox()->Contains(data),
!data || i::GetProcessWideSandbox()->Contains(data), "v8_ArrayBuffer_NewBackingStore",
"v8_ArrayBuffer_NewBackingStore", "When the V8 Sandbox is enabled, ArrayBuffer backing stores "
"When the V8 Sandbox is enabled, ArrayBuffer backing stores must be " "must be allocated inside the sandbox address space. Please "
"allocated inside the sandbox address space. Please use an appropriate " "use an appropriate ArrayBuffer::Allocator to allocate these "
"ArrayBuffer::Allocator to allocate these buffers."); "buffers, or disable the sandbox.");
#endif // V8_ENABLE_SANDBOX #endif // V8_ENABLE_SANDBOX
std::unique_ptr<i::BackingStoreBase> backing_store = std::unique_ptr<i::BackingStoreBase> backing_store =
......
...@@ -280,6 +280,14 @@ std::unique_ptr<BackingStore> BackingStore::Allocate( ...@@ -280,6 +280,14 @@ std::unique_ptr<BackingStore> BackingStore::Allocate(
counters->array_buffer_new_size_failures()->AddSample(mb_length); counters->array_buffer_new_size_failures()->AddSample(mb_length);
return {}; return {};
} }
#ifdef V8_ENABLE_SANDBOX
// Check to catch use of a non-sandbox-compatible ArrayBufferAllocator.
CHECK_WITH_MSG(GetProcessWideSandbox()->Contains(buffer_start),
"When the V8 Sandbox is enabled, ArrayBuffer backing stores "
"must be allocated inside the sandbox address space. Please "
"use an appropriate ArrayBuffer::Allocator to allocate "
"these buffers, or disable the sandbox.");
#endif
} }
auto result = new BackingStore(buffer_start, // start auto result = new BackingStore(buffer_start, // start
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment