[sandbox] Also enable the sandbox outside of Chromium builds

Drive-by: include the right header in sandboxed-pointer-inl.h and fix
missing sandbox initialization in generate-bytecode-expectations.cc.

Bug: v8:10391
Change-Id: Ic39ba04b7c98eaa58ea3943189c23b297f581f5a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3630082
Reviewed-by: Igor Sheludko <ishell@chromium.org>
Commit-Queue: Samuel Groß <saelo@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81216}
This commit is contained in:
Samuel Groß 2022-06-16 13:18:12 +02:00 committed by V8 LUCI CQ
parent 7aeb32a3c2
commit 5b9401dde4
3 changed files with 8 additions and 4 deletions

View File

@ -501,9 +501,8 @@ if (v8_enable_sandbox == "") {
# once that is enabled everywhere by default.
# TODO(chromium:1325784) the sandbox is not currently supported in Chromium
# on Fuchsia.
v8_enable_sandbox =
build_with_chromium && v8_enable_pointer_compression_shared_cage &&
v8_enable_external_code_space && target_os != "fuchsia"
v8_enable_sandbox = v8_enable_pointer_compression_shared_cage &&
v8_enable_external_code_space && target_os != "fuchsia"
}
# Enable sandboxed pointers when the sandbox is enabled.

View File

@ -6,7 +6,7 @@
#define V8_SANDBOX_SANDBOXED_POINTER_INL_H_
#include "include/v8-internal.h"
#include "src/common/ptr-compr.h"
#include "src/common/ptr-compr-inl.h"
#include "src/execution/isolate.h"
#include "src/sandbox/sandboxed-pointer.h"

View File

@ -347,6 +347,11 @@ V8InitializationScope::V8InitializationScope(const char* exec_path)
v8::V8::InitializeICUDefaultLocation(exec_path);
v8::V8::InitializeExternalStartupData(exec_path);
v8::V8::InitializePlatform(platform_.get());
#ifdef V8_ENABLE_SANDBOX
if (!v8::V8::InitializeSandbox()) {
FATAL("Could not initialize the sandbox");
}
#endif
v8::V8::Initialize();
v8::Isolate::CreateParams create_params;