Reland "[sandbox] Sandboxify ExternalString external pointers"
This is a reland of commit e7bf81100a
Shared string GC issues have been fixed in https://crrev.com/c/3875028
Original change's description:
> [sandbox] Sandboxify ExternalString external pointers
>
> Bug: v8:10391
> Change-Id: I0f737e5adf6e4fd24f93436fa5680ff20c1536da
> Cq-Include-Trybots: luci.v8.try:v8_linux64_heap_sandbox_dbg_ng,v8_linux_arm64_sim_heap_sandbox_dbg_ng
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3757901
> Commit-Queue: Samuel Groß <saelo@chromium.org>
> Reviewed-by: Igor Sheludko <ishell@chromium.org>
> Reviewed-by: Leszek Swirski <leszeks@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#82958}
Bug: v8:10391
Change-Id: I555498973dc9d5dcc4163b3b1258e41d7148e2d5
Cq-Include-Trybots: luci.v8.try:v8_linux64_heap_sandbox_dbg_ng,v8_linux_arm64_sim_heap_sandbox_dbg_ng
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3872273
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: Igor Sheludko <ishell@chromium.org>
Commit-Queue: Samuel Groß <saelo@chromium.org>
Cr-Commit-Position: refs/heads/main@{#83026}
This commit is contained in:
parent
24e60017d4
commit
8137040c3a
@ -373,8 +373,8 @@ constexpr uint64_t kAllExternalPointerTypeTags[] = {
|
||||
#define SHARED_EXTERNAL_POINTER_TAGS(V) \
|
||||
V(kFirstSharedTag, sandboxed, TAG(0)) \
|
||||
V(kWaiterQueueNodeTag, sandboxed, TAG(0)) \
|
||||
V(kExternalStringResourceTag, unsandboxed, TAG(1)) \
|
||||
V(kExternalStringResourceDataTag, unsandboxed, TAG(2)) \
|
||||
V(kExternalStringResourceTag, sandboxed, TAG(1)) \
|
||||
V(kExternalStringResourceDataTag, sandboxed, TAG(2)) \
|
||||
V(kLastSharedTag, sandboxed, TAG(2))
|
||||
|
||||
// External pointers using these tags are kept in a per-Isolate external
|
||||
|
@ -595,13 +595,13 @@ void Serializer::ObjectSerializer::SerializeExternalString() {
|
||||
if (serializer_->external_reference_encoder_.TryEncode(resource).To(
|
||||
&reference)) {
|
||||
DCHECK(reference.is_from_api());
|
||||
#ifdef V8_SANDBOXED_EXTERNAL_POINTERS
|
||||
#ifdef V8_ENABLE_SANDBOX
|
||||
uint32_t external_pointer_entry =
|
||||
string->GetResourceRefForDeserialization();
|
||||
#endif
|
||||
string->SetResourceRefForSerialization(reference.index());
|
||||
SerializeObject();
|
||||
#ifdef V8_SANDBOXED_EXTERNAL_POINTERS
|
||||
#ifdef V8_ENABLE_SANDBOX
|
||||
string->SetResourceRefForSerialization(external_pointer_entry);
|
||||
#else
|
||||
string->set_address_as_resource(isolate(), resource);
|
||||
|
@ -349,7 +349,7 @@ class ReadStringVisitor : public TqObjectVisitor {
|
||||
if (IsExternalStringCached(object)) {
|
||||
ExternalPointer_t resource_data =
|
||||
GetOrFinish(object->GetResourceDataValue(accessor_));
|
||||
#ifdef V8_SANDBOXED_EXTERNAL_POINTERS
|
||||
#ifdef V8_ENABLE_SANDBOX
|
||||
Isolate* isolate = GetIsolateForSandbox(
|
||||
HeapObject::unchecked_cast(Object(heap_addresses_.any_heap_pointer)));
|
||||
ExternalPointerHandle handle =
|
||||
@ -359,7 +359,7 @@ class ReadStringVisitor : public TqObjectVisitor {
|
||||
handle, kExternalStringResourceDataTag));
|
||||
#else
|
||||
uintptr_t data_address = static_cast<uintptr_t>(resource_data);
|
||||
#endif // V8_COMPRESS_POINTERS
|
||||
#endif // V8_ENABLE_SANDBOX
|
||||
if (done_) return;
|
||||
ReadStringCharacters<TChar>(object, data_address);
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user