[sandbox] Introduce ExternalBufferTable [v8/v8 : main]

20 views
Skip to first unread message

Deepak Mohan (Robo) (Gerrit)

unread,
Mar 29, 2024, 9:54:55 AM3/29/24
to Samuel Groß, Hannes Payer, cbruni...@chromium.org, mlippau...@chromium.org, v8-re...@googlegroups.com, victorgo...@chromium.org
Attention needed from Samuel Groß

Deepak Mohan (Robo) voted Auto-Submit+1

Auto-Submit+1
Open in Gerrit

Related details

Attention is currently required from:
  • Samuel Groß
Submit Requirements:
  • requirement is not satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: I52f8ed7f0eacf7d979f56df977c351c7a9e932e0
Gerrit-Change-Number: 5401307
Gerrit-PatchSet: 1
Gerrit-Owner: Deepak Mohan (Robo) <hop2...@gmail.com>
Gerrit-Reviewer: Deepak Mohan (Robo) <hop2...@gmail.com>
Gerrit-Reviewer: Samuel Groß <sa...@chromium.org>
Gerrit-CC: Hannes Payer <hpa...@chromium.org>
Gerrit-Attention: Samuel Groß <sa...@chromium.org>
Gerrit-Comment-Date: Fri, 29 Mar 2024 13:54:49 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
unsatisfied_requirement
open
diffy

Samuel Groß (Gerrit)

unread,
Apr 5, 2024, 11:54:15 AM4/5/24
to Deepak Mohan (Robo), Hannes Payer, cbruni...@chromium.org, mlippau...@chromium.org, v8-re...@googlegroups.com, victorgo...@chromium.org

Samuel Groß added 1 comment

Patchset-level comments
File-level comment, Patchset 1 (Latest):
Samuel Groß . resolved

Sorry, I haven't gotten around to reviewing this CL yet, it's been a pretty busy week (see https://v8.dev/blog/sandbox)... I'll try to do it first thing on Monday though!

Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement is not satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: I52f8ed7f0eacf7d979f56df977c351c7a9e932e0
Gerrit-Change-Number: 5401307
Gerrit-PatchSet: 1
Gerrit-Owner: Deepak Mohan (Robo) <hop2...@gmail.com>
Gerrit-Reviewer: Deepak Mohan (Robo) <hop2...@gmail.com>
Gerrit-Reviewer: Samuel Groß <sa...@chromium.org>
Gerrit-CC: Hannes Payer <hpa...@chromium.org>
Gerrit-Comment-Date: Fri, 05 Apr 2024 15:54:08 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
unsatisfied_requirement
open
diffy

Deepak Mohan (Robo) (Gerrit)

unread,
Apr 5, 2024, 12:36:18 PM4/5/24
to Samuel Groß, Hannes Payer, cbruni...@chromium.org, mlippau...@chromium.org, v8-re...@googlegroups.com, victorgo...@chromium.org
Attention needed from Samuel Groß

Deepak Mohan (Robo) added 1 comment

Patchset-level comments
Samuel Groß . resolved

Sorry, I haven't gotten around to reviewing this CL yet, it's been a pretty busy week (see https://v8.dev/blog/sandbox)... I'll try to do it first thing on Monday though!

Deepak Mohan (Robo)

Thank you for keeping track of this CL!

Nice high level overview, just read the blog post :)

Open in Gerrit

Related details

Attention is currently required from:
  • Samuel Groß
Submit Requirements:
  • requirement is not satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: I52f8ed7f0eacf7d979f56df977c351c7a9e932e0
Gerrit-Change-Number: 5401307
Gerrit-PatchSet: 1
Gerrit-Owner: Deepak Mohan (Robo) <hop2...@gmail.com>
Gerrit-Reviewer: Deepak Mohan (Robo) <hop2...@gmail.com>
Gerrit-Reviewer: Samuel Groß <sa...@chromium.org>
Gerrit-CC: Hannes Payer <hpa...@chromium.org>
Gerrit-Attention: Samuel Groß <sa...@chromium.org>
Gerrit-Comment-Date: Fri, 05 Apr 2024 16:36:11 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Samuel Groß <sa...@chromium.org>
unsatisfied_requirement
open
diffy

Samuel Groß (Gerrit)

unread,
Apr 8, 2024, 4:56:01 AM4/8/24
to Deepak Mohan (Robo), Hannes Payer, cbruni...@chromium.org, mlippau...@chromium.org, v8-re...@googlegroups.com, victorgo...@chromium.org
Attention needed from Deepak Mohan (Robo)

Samuel Groß added 8 comments

Patchset-level comments
Samuel Groß . resolved

Looks good overall, left some comments, and I think you need to rebase the CL

File include/v8-internal.h
Line 631, Patchset 1 (Latest):// See `ExternalPointerHandle` for the main documentation. The difference to
Samuel Groß . unresolved

Nit: I feel like this block of code should move up, closer to ExternalPointer. Maybe into line 323, just above the
```
//
// External Pointers.
//
```
comment

File src/sandbox/external-buffer-table-inl.h
Line 181, Patchset 1 (Latest): // - If the slot is lazily-initialized, the handle may transition from the
Samuel Groß . unresolved
I wonder if we need to support lazy-initialization for external buffers. I think we don't, and so we could drop a bit of code, e.g. this comment here. Then the code below can probably be simplified to (but maybe it needs to be moved below `  if (handle == kNullExternalBufferHandle) return;` then)
```
#ifdef DEBUG
DCHECK_Eq(handle, base::AsAtomic32::Acquire_Load(
reinterpret_cast<ExternalBufferHandle*>(handle_location)));
#endif
```
Line 167, Patchset 1 (Latest): uint32_t start_of_evacuation_area =
space->start_of_evacuation_area_.load(std::memory_order_relaxed);
if (V8_UNLIKELY(index >= start_of_evacuation_area)) {
space->AbortCompacting(start_of_evacuation_area);
}
Samuel Groß . unresolved

Can this code and the long comment above it move into the parent class (I guess some new helper function) to reduce duplication?

Line 17, Patchset 1 (Latest):void ExternalBufferTableEntry::MakeExternalBufferEntry(
Samuel Groß . unresolved

I wonder if we want to have some sort of `DCHECK(IsExternalBufferPointerTag(tag))` here and introduce the respective predicate in v8-internal.h? We could then leave a comment there that, should we ever run out of external pointer tags, we could reuse tags for external buffers since they use a separate table.

File src/sandbox/external-buffer-table.h
Line 216, Patchset 1 (Latest): inline std::pair<Address, size_t> Exchange(ExternalBufferHandle handle,
Samuel Groß . unresolved

Same here, I think this isn't currently needed

Line 58, Patchset 1 (Latest): inline std::pair<Address, size_t> ExchangeExternalBuffer(
Samuel Groß . unresolved

I think this function is currently not needed, is it? If so, feel free to drop it to simplify things

File src/sandbox/external-buffer-table.cc
Line 16, Patchset 1 (Latest):uint32_t ExternalBufferTable::SweepAndCompact(Space* space,
Samuel Groß . unresolved

I'll think again about whether there's some way to reduce code duplication here. In the meantime, could you maybe just leave a TODO comment for that here?

Open in Gerrit

Related details

Attention is currently required from:
  • Deepak Mohan (Robo)
Submit Requirements:
  • requirement is not satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: I52f8ed7f0eacf7d979f56df977c351c7a9e932e0
Gerrit-Change-Number: 5401307
Gerrit-PatchSet: 1
Gerrit-Owner: Deepak Mohan (Robo) <hop2...@gmail.com>
Gerrit-Reviewer: Deepak Mohan (Robo) <hop2...@gmail.com>
Gerrit-Reviewer: Samuel Groß <sa...@chromium.org>
Gerrit-CC: Hannes Payer <hpa...@chromium.org>
Gerrit-Attention: Deepak Mohan (Robo) <hop2...@gmail.com>
Gerrit-Comment-Date: Mon, 08 Apr 2024 08:55:56 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
unsatisfied_requirement
open
diffy

Deepak Mohan (Robo) (Gerrit)

unread,
Apr 9, 2024, 1:24:44 AM4/9/24
to Samuel Groß, Hannes Payer, cbruni...@chromium.org, mlippau...@chromium.org, v8-re...@googlegroups.com, victorgo...@chromium.org
Attention needed from Samuel Groß

Deepak Mohan (Robo) voted and added 7 comments

Votes added by Deepak Mohan (Robo)

Auto-Submit+1

7 comments

File include/v8-internal.h
Line 631, Patchset 1:// See `ExternalPointerHandle` for the main documentation. The difference to
Samuel Groß . resolved

Nit: I feel like this block of code should move up, closer to ExternalPointer. Maybe into line 323, just above the
```
//
// External Pointers.
//
```
comment

Deepak Mohan (Robo)

Acknowledged

File src/sandbox/external-buffer-table-inl.h
Line 181, Patchset 1: // - If the slot is lazily-initialized, the handle may transition from the
Samuel Groß . resolved
I wonder if we need to support lazy-initialization for external buffers. I think we don't, and so we could drop a bit of code, e.g. this comment here. Then the code below can probably be simplified to (but maybe it needs to be moved below `  if (handle == kNullExternalBufferHandle) return;` then)
```
#ifdef DEBUG
DCHECK_Eq(handle, base::AsAtomic32::Acquire_Load(
reinterpret_cast<ExternalBufferHandle*>(handle_location)));
#endif
```
Deepak Mohan (Robo)

Acknowledged

Line 167, Patchset 1: uint32_t start_of_evacuation_area =

space->start_of_evacuation_area_.load(std::memory_order_relaxed);
if (V8_UNLIKELY(index >= start_of_evacuation_area)) {
space->AbortCompacting(start_of_evacuation_area);
}
Samuel Groß . resolved

Can this code and the long comment above it move into the parent class (I guess some new helper function) to reduce duplication?

Deepak Mohan (Robo)

Acknowledged

Line 17, Patchset 1:void ExternalBufferTableEntry::MakeExternalBufferEntry(
Samuel Groß . resolved

I wonder if we want to have some sort of `DCHECK(IsExternalBufferPointerTag(tag))` here and introduce the respective predicate in v8-internal.h? We could then leave a comment there that, should we ever run out of external pointer tags, we could reuse tags for external buffers since they use a separate table.

Deepak Mohan (Robo)

Acknowledged

File src/sandbox/external-buffer-table.h
Line 216, Patchset 1: inline std::pair<Address, size_t> Exchange(ExternalBufferHandle handle,
Samuel Groß . resolved

Same here, I think this isn't currently needed

Deepak Mohan (Robo)

Acknowledged

Line 58, Patchset 1: inline std::pair<Address, size_t> ExchangeExternalBuffer(
Samuel Groß . resolved

I think this function is currently not needed, is it? If so, feel free to drop it to simplify things

Deepak Mohan (Robo)

Acknowledged

File src/sandbox/external-buffer-table.cc
Line 16, Patchset 1:uint32_t ExternalBufferTable::SweepAndCompact(Space* space,
Samuel Groß . resolved

I'll think again about whether there's some way to reduce code duplication here. In the meantime, could you maybe just leave a TODO comment for that here?

Deepak Mohan (Robo)

Acknowledged

Open in Gerrit

Related details

Attention is currently required from:
  • Samuel Groß
Submit Requirements:
  • requirement is not satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: I52f8ed7f0eacf7d979f56df977c351c7a9e932e0
Gerrit-Change-Number: 5401307
Gerrit-PatchSet: 2
Gerrit-Owner: Deepak Mohan (Robo) <hop2...@gmail.com>
Gerrit-Reviewer: Deepak Mohan (Robo) <hop2...@gmail.com>
Gerrit-Reviewer: Samuel Groß <sa...@chromium.org>
Gerrit-CC: Hannes Payer <hpa...@chromium.org>
Gerrit-Attention: Samuel Groß <sa...@chromium.org>
Gerrit-Comment-Date: Tue, 09 Apr 2024 05:24:39 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: Samuel Groß <sa...@chromium.org>
unsatisfied_requirement
open
diffy

Deepak Mohan (Robo) (Gerrit)

unread,
Apr 9, 2024, 1:34:44 AM4/9/24
to Samuel Groß, Hannes Payer, cbruni...@chromium.org, mlippau...@chromium.org, v8-re...@googlegroups.com, victorgo...@chromium.org
Attention needed from Samuel Groß

Deepak Mohan (Robo) added 1 comment

File include/v8-internal.h
Line 572, Patchset 2 (Latest): return tag == kExternalStringResourceDataTag;
Deepak Mohan (Robo) . unresolved

Is this what you had in mind ? From the existing tags I can think of only this one tag that would use the buffer table. For external array buffer, we first want to introduce a compile time flag and a separate tag, so I decided to keep it out for separate CL.

Open in Gerrit

Related details

Attention is currently required from:
  • Samuel Groß
Submit Requirements:
  • requirement is not satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: I52f8ed7f0eacf7d979f56df977c351c7a9e932e0
Gerrit-Change-Number: 5401307
Gerrit-PatchSet: 2
Gerrit-Owner: Deepak Mohan (Robo) <hop2...@gmail.com>
Gerrit-Reviewer: Deepak Mohan (Robo) <hop2...@gmail.com>
Gerrit-Reviewer: Samuel Groß <sa...@chromium.org>
Gerrit-CC: Hannes Payer <hpa...@chromium.org>
Gerrit-Attention: Samuel Groß <sa...@chromium.org>
Gerrit-Comment-Date: Tue, 09 Apr 2024 05:34:36 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
unsatisfied_requirement
open
diffy

Samuel Groß (Gerrit)

unread,
Apr 9, 2024, 6:37:02 AM4/9/24
to Deepak Mohan (Robo), V8 LUCI CQ, Hannes Payer, cbruni...@chromium.org, mlippau...@chromium.org, v8-re...@googlegroups.com, victorgo...@chromium.org
Attention needed from Deepak Mohan (Robo)

Samuel Groß added 8 comments

Patchset-level comments
File-level comment, Patchset 2 (Latest):
Samuel Groß . resolved

Nice thanks! A couple more suggestions

File include/v8-internal.h
Line 572, Patchset 2 (Latest): return tag == kExternalStringResourceDataTag;
Deepak Mohan (Robo) . resolved

Is this what you had in mind ? From the existing tags I can think of only this one tag that would use the buffer table. For external array buffer, we first want to introduce a compile time flag and a separate tag, so I decided to keep it out for separate CL.

Samuel Groß

Yep, exactly like this! Thanks!

File src/sandbox/external-buffer-table-inl.h
Line 137, Patchset 2 (Latest):
Samuel Groß . unresolved

With the new managed resources (see https://chromium-review.googlesource.com/c/v8/v8/+/5425025), could you add a `DCHECK(!IsManagedResourceTag(tag))` here since we don't expect them in the external buffer table and won't be able to handle them? Maybe also somewhere leave a comment to consider introducing a dedicated `ExternalBufferTag` enum which would guarantee that this can't happen.

File src/sandbox/external-buffer-table.h
Line 176, Patchset 2 (Latest): using CompactibleSpace = CompactibleExternalEntityTable<
Samuel Groß . unresolved
How about
```
using super =
CompactibleExternalEntityTable<ExternalPointerTableEntry,
kExternalPointerTableReservationSize>;
```
Instead, like here: https://chromium-review.googlesource.com/c/v8/v8/+/5185345/18/src/sandbox/external-pointer-table.h
Line 162, Patchset 2 (Latest):class V8_EXPORT_PRIVATE ExternalBufferTable
Samuel Groß . unresolved

Could you add a comment here briefly describing what this table is used for?

Line 84, Patchset 2 (Latest): struct Payload {
Samuel Groß . unresolved

Nit: could you leave a TODO here like "TODO investigate whether we could have a reusable "TaggedPayload" class that can be used by the external pointer tables and the trusted pointer tables"?

File src/sandbox/external-pointer-inl.h
Line 52, Patchset 2 (Latest):inline void ExternalBufferMember<tag>::Init(IsolateForSandbox isolate,
Samuel Groß . unresolved

I wonder if these should move into a dedicated set of files (`external-buffer*`), wdyt?

File src/sandbox/external-pointer-table-inl.h
Line 211, Patchset 2 (Latest): AbortCompactingIfNeeded(space, index);
Samuel Groß . unresolved

Actually, I wonder: can this logic move into `AllocateEntry`, if `AllocateEntry` is added to `CompactibleExternalEntityTable`? It seems like we have all information available there, and I think that's also what's being done here: https://chromium-review.googlesource.com/c/v8/v8/+/5185345/18/src/sandbox/external-pointer-table.h

Open in Gerrit

Related details

Attention is currently required from:
  • Deepak Mohan (Robo)
Submit Requirements:
  • requirement is not satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: I52f8ed7f0eacf7d979f56df977c351c7a9e932e0
Gerrit-Change-Number: 5401307
Gerrit-PatchSet: 2
Gerrit-Owner: Deepak Mohan (Robo) <hop2...@gmail.com>
Gerrit-Reviewer: Deepak Mohan (Robo) <hop2...@gmail.com>
Gerrit-Reviewer: Samuel Groß <sa...@chromium.org>
Gerrit-CC: Hannes Payer <hpa...@chromium.org>
Gerrit-Attention: Deepak Mohan (Robo) <hop2...@gmail.com>
Gerrit-Comment-Date: Tue, 09 Apr 2024 10:36:56 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Deepak Mohan (Robo) <hop2...@gmail.com>
unsatisfied_requirement
open
diffy

Deepak Mohan (Robo) (Gerrit)

unread,
Apr 10, 2024, 8:35:38 AM4/10/24
to V8 LUCI CQ, Samuel Groß, Hannes Payer, cbruni...@chromium.org, mlippau...@chromium.org, v8-re...@googlegroups.com, victorgo...@chromium.org
Attention needed from Samuel Groß

Deepak Mohan (Robo) voted and added 7 comments

Votes added by Deepak Mohan (Robo)

Auto-Submit+1

7 comments

File src/sandbox/external-buffer-table-inl.h
Line 135, Patchset 3 (Latest): DCHECK(!IsManagedExternalPointerType(tag));
Deepak Mohan (Robo) . unresolved
Line 137, Patchset 2:
Samuel Groß . resolved

With the new managed resources (see https://chromium-review.googlesource.com/c/v8/v8/+/5425025), could you add a `DCHECK(!IsManagedResourceTag(tag))` here since we don't expect them in the external buffer table and won't be able to handle them? Maybe also somewhere leave a comment to consider introducing a dedicated `ExternalBufferTag` enum which would guarantee that this can't happen.

Deepak Mohan (Robo)

Acknowledged

File src/sandbox/external-buffer-table.h
Line 176, Patchset 2: using CompactibleSpace = CompactibleExternalEntityTable<
Samuel Groß . resolved
How about
```
using super =
CompactibleExternalEntityTable<ExternalPointerTableEntry,
kExternalPointerTableReservationSize>;
```
Instead, like here: https://chromium-review.googlesource.com/c/v8/v8/+/5185345/18/src/sandbox/external-pointer-table.h
Deepak Mohan (Robo)

Acknowledged

Line 162, Patchset 2:class V8_EXPORT_PRIVATE ExternalBufferTable
Samuel Groß . resolved

Could you add a comment here briefly describing what this table is used for?

Deepak Mohan (Robo)

Acknowledged

Line 84, Patchset 2: struct Payload {
Samuel Groß . resolved

Nit: could you leave a TODO here like "TODO investigate whether we could have a reusable "TaggedPayload" class that can be used by the external pointer tables and the trusted pointer tables"?

Deepak Mohan (Robo)

I can take a look at it in follow-up CL.

File src/sandbox/external-pointer-inl.h
Line 52, Patchset 2:inline void ExternalBufferMember<tag>::Init(IsolateForSandbox isolate,
Samuel Groß . resolved

I wonder if these should move into a dedicated set of files (`external-buffer*`), wdyt?

Deepak Mohan (Robo)

Makes sense, I guess that means we also need ExternalBuffer_t.

File src/sandbox/external-pointer-table-inl.h
Line 211, Patchset 2: AbortCompactingIfNeeded(space, index);
Samuel Groß . resolved

Actually, I wonder: can this logic move into `AllocateEntry`, if `AllocateEntry` is added to `CompactibleExternalEntityTable`? It seems like we have all information available there, and I think that's also what's being done here: https://chromium-review.googlesource.com/c/v8/v8/+/5185345/18/src/sandbox/external-pointer-table.h

Deepak Mohan (Robo)

Acknowledged

Open in Gerrit

Related details

Attention is currently required from:
  • Samuel Groß
Submit Requirements:
  • requirement is not satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: I52f8ed7f0eacf7d979f56df977c351c7a9e932e0
Gerrit-Change-Number: 5401307
Gerrit-PatchSet: 3
Gerrit-Owner: Deepak Mohan (Robo) <hop2...@gmail.com>
Gerrit-Reviewer: Deepak Mohan (Robo) <hop2...@gmail.com>
Gerrit-Reviewer: Samuel Groß <sa...@chromium.org>
Gerrit-CC: Hannes Payer <hpa...@chromium.org>
Gerrit-Attention: Samuel Groß <sa...@chromium.org>
Gerrit-Comment-Date: Wed, 10 Apr 2024 12:35:32 +0000
unsatisfied_requirement
open
diffy

Deepak Mohan (Robo) (Gerrit)

unread,
Apr 10, 2024, 1:35:42 PM4/10/24
to V8 LUCI CQ, Samuel Groß, Hannes Payer, cbruni...@chromium.org, mlippau...@chromium.org, v8-re...@googlegroups.com, victorgo...@chromium.org
Attention needed from Samuel Groß

Deepak Mohan (Robo) added 1 comment

File src/sandbox/external-buffer-table.h
Line 159, Patchset 3 (Latest): std::atomic<Payload> payload_;
Deepak Mohan (Robo) . unresolved

Looking into the windows build failure https://logs.chromium.org/logs/v8/buildbucket/cr-buildbucket/8751140545198081025/+/u/build/compile/stdout?format=raw it comes from the atomic operation on 128-bit Payload type. I am thinking of removing the Payload wrapper and have the entry class as follows. Downside is we cannot explore a reusable TaggedPayload for the buffer table. Thoughts ?

```
struct ExternalBufferTableEntry {
private:
std::atomic<Address> encoded_word_;
std::atomic<size_t> raw_size_;
};
```
Open in Gerrit

Related details

Attention is currently required from:
  • Samuel Groß
Submit Requirements:
  • requirement is not satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: I52f8ed7f0eacf7d979f56df977c351c7a9e932e0
Gerrit-Change-Number: 5401307
Gerrit-PatchSet: 3
Gerrit-Owner: Deepak Mohan (Robo) <hop2...@gmail.com>
Gerrit-Reviewer: Deepak Mohan (Robo) <hop2...@gmail.com>
Gerrit-Reviewer: Samuel Groß <sa...@chromium.org>
Gerrit-CC: Hannes Payer <hpa...@chromium.org>
Gerrit-Attention: Samuel Groß <sa...@chromium.org>
Gerrit-Comment-Date: Wed, 10 Apr 2024 17:35:33 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
unsatisfied_requirement
open
diffy

Samuel Groß (Gerrit)

unread,
Apr 11, 2024, 10:04:26 AM4/11/24
to Deepak Mohan (Robo), V8 LUCI CQ, Hannes Payer, cbruni...@chromium.org, mlippau...@chromium.org, v8-re...@googlegroups.com, victorgo...@chromium.org
Attention needed from Deepak Mohan (Robo)

Samuel Groß added 5 comments

Patchset-level comments
File-level comment, Patchset 3 (Latest):
Samuel Groß . resolved

Nice, I like it! Please rebase once more and I can start another round of dry-runs

File src/sandbox/external-buffer-table-inl.h
Line 135, Patchset 3 (Latest): DCHECK(!IsManagedExternalPointerType(tag));
Deepak Mohan (Robo) . resolved
Samuel Groß

Acknowledged. It's landing just now, sorry for the delay/trouble with that Cl... :(

File src/sandbox/external-buffer-table.h
Line 199, Patchset 3 (Latest): using super =
Samuel Groß . unresolved

Could you call this `Base` instead? Sorry, I realize that I suggested that name, but I've since looked through our code base and it seems we typically call this `Base`, and I've now done the same in the CompactibleExternalEntityTable class

Line 159, Patchset 3 (Latest): std::atomic<Payload> payload_;
Deepak Mohan (Robo) . unresolved

Looking into the windows build failure https://logs.chromium.org/logs/v8/buildbucket/cr-buildbucket/8751140545198081025/+/u/build/compile/stdout?format=raw it comes from the atomic operation on 128-bit Payload type. I am thinking of removing the Payload wrapper and have the entry class as follows. Downside is we cannot explore a reusable TaggedPayload for the buffer table. Thoughts ?

```
struct ExternalBufferTableEntry {
private:
std::atomic<Address> encoded_word_;
std::atomic<size_t> raw_size_;
};
```
Samuel Groß

I think that's fine. That's basically what we already do for the code pointer table: https://source.chromium.org/chromium/chromium/src/+/main:v8/src/sandbox/code-pointer-table.h;l=84;drc=0c86ce8471f83b0004a61a4d5fb7be29ac60e2cc
We could still use a "TaggedPayload" class since I guess we'd only need to tag one of the two values, the other can be a raw `Address` or `size_t`.

The only drawback is that the compiler seems unable to fold two atomic 64-bit loads into one atomic 128-bit load. Maybe worth keeping that as a comment, but I think it's definitely fine that way for now.

File src/sandbox/external-buffer-table.cc
Line 71, Patchset 3 (Latest): // If we evacuated all live entries in this segment then we can skip it
Samuel Groß . unresolved

We've now removed this shortcut in https://chromium-review.googlesource.com/c/v8/v8/+/5439561 It should still be fine here since we don't support managed buffers (yet?), but maybe there's some value in keeping the implementations as close together as possible for now?

Open in Gerrit

Related details

Attention is currently required from:
  • Deepak Mohan (Robo)
Submit Requirements:
  • requirement is not satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: I52f8ed7f0eacf7d979f56df977c351c7a9e932e0
Gerrit-Change-Number: 5401307
Gerrit-PatchSet: 3
Gerrit-Owner: Deepak Mohan (Robo) <hop2...@gmail.com>
Gerrit-Reviewer: Deepak Mohan (Robo) <hop2...@gmail.com>
Gerrit-Reviewer: Samuel Groß <sa...@chromium.org>
Gerrit-CC: Hannes Payer <hpa...@chromium.org>
Gerrit-Attention: Deepak Mohan (Robo) <hop2...@gmail.com>
Gerrit-Comment-Date: Thu, 11 Apr 2024 14:04:20 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
unsatisfied_requirement
open
diffy

Deepak Mohan (Robo) (Gerrit)

unread,
Apr 12, 2024, 7:49:07 AM4/12/24
to V8 LUCI CQ, Samuel Groß, Hannes Payer, cbruni...@chromium.org, mlippau...@chromium.org, v8-re...@googlegroups.com, victorgo...@chromium.org
Attention needed from Samuel Groß

Deepak Mohan (Robo) voted and added 4 comments

Votes added by Deepak Mohan (Robo)

Auto-Submit+1

4 comments

Patchset-level comments
Deepak Mohan (Robo) . resolved

Should be good for a dry-run, PTAL

File src/sandbox/external-buffer-table.h
Line 199, Patchset 3: using super =
Samuel Groß . resolved

Could you call this `Base` instead? Sorry, I realize that I suggested that name, but I've since looked through our code base and it seems we typically call this `Base`, and I've now done the same in the CompactibleExternalEntityTable class

Deepak Mohan (Robo)

Acknowledged

Line 159, Patchset 3: std::atomic<Payload> payload_;
Deepak Mohan (Robo) . resolved

Looking into the windows build failure https://logs.chromium.org/logs/v8/buildbucket/cr-buildbucket/8751140545198081025/+/u/build/compile/stdout?format=raw it comes from the atomic operation on 128-bit Payload type. I am thinking of removing the Payload wrapper and have the entry class as follows. Downside is we cannot explore a reusable TaggedPayload for the buffer table. Thoughts ?

```
struct ExternalBufferTableEntry {
private:
std::atomic<Address> encoded_word_;
std::atomic<size_t> raw_size_;
};
```
Samuel Groß

I think that's fine. That's basically what we already do for the code pointer table: https://source.chromium.org/chromium/chromium/src/+/main:v8/src/sandbox/code-pointer-table.h;l=84;drc=0c86ce8471f83b0004a61a4d5fb7be29ac60e2cc
We could still use a "TaggedPayload" class since I guess we'd only need to tag one of the two values, the other can be a raw `Address` or `size_t`.

The only drawback is that the compiler seems unable to fold two atomic 64-bit loads into one atomic 128-bit load. Maybe worth keeping that as a comment, but I think it's definitely fine that way for now.

Deepak Mohan (Robo)

Missed the codepointertable, thanks for the pointer! I see that it does not use Payload for the code_ object, during the TaggedPayload exploration should we try converting it as well ?

We could still use a "TaggedPayload" class since I guess we'd only need to tag one of the two values, the other can be a raw Address or size_t.

Oh yeah, sounds good.

The only drawback is that the compiler seems unable to fold two atomic 64-bit loads into one atomic 128-bit load.

Seems like this might be a clang only issue, on linux we can use gcc libatomic as fallback https://godbolt.org/z/4PbTYsvzW and windows msvc seems to support it natively.

File src/sandbox/external-buffer-table.cc
Line 71, Patchset 3: // If we evacuated all live entries in this segment then we can skip it
Samuel Groß . resolved

We've now removed this shortcut in https://chromium-review.googlesource.com/c/v8/v8/+/5439561 It should still be fine here since we don't support managed buffers (yet?), but maybe there's some value in keeping the implementations as close together as possible for now?

Deepak Mohan (Robo)

Acknowledged

Open in Gerrit

Related details

Attention is currently required from:
  • Samuel Groß
Submit Requirements:
  • requirement is not satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: I52f8ed7f0eacf7d979f56df977c351c7a9e932e0
Gerrit-Change-Number: 5401307
Gerrit-PatchSet: 3
Gerrit-Owner: Deepak Mohan (Robo) <hop2...@gmail.com>
Gerrit-Reviewer: Deepak Mohan (Robo) <hop2...@gmail.com>
Gerrit-Reviewer: Samuel Groß <sa...@chromium.org>
Gerrit-CC: Hannes Payer <hpa...@chromium.org>
Gerrit-Attention: Samuel Groß <sa...@chromium.org>
Gerrit-Comment-Date: Fri, 12 Apr 2024 11:49:01 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: Deepak Mohan (Robo) <hop2...@gmail.com>
Comment-In-Reply-To: Samuel Groß <sa...@chromium.org>
unsatisfied_requirement
open
diffy

Deepak Mohan (Robo) (Gerrit)

unread,
Apr 12, 2024, 8:36:13 AM4/12/24
to Samuel Groß, V8 LUCI CQ, Hannes Payer, cbruni...@chromium.org, mlippau...@chromium.org, v8-re...@googlegroups.com, victorgo...@chromium.org

Deepak Mohan (Robo) voted and added 1 comment

Votes added by Deepak Mohan (Robo)

Auto-Submit+1

1 comment

File src/sandbox/external-pointer-table.h
Deepak Mohan (Robo) . resolved

Given this will be resolved in https://chromium-review.googlesource.com/c/v8/v8/+/5185345/comment/33849afa_14a4721e/, let me remove this to avoid conflict.

Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement is not satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: I52f8ed7f0eacf7d979f56df977c351c7a9e932e0
Gerrit-Change-Number: 5401307
Gerrit-PatchSet: 5
Gerrit-Owner: Deepak Mohan (Robo) <hop2...@gmail.com>
Gerrit-Reviewer: Deepak Mohan (Robo) <hop2...@gmail.com>
Gerrit-Reviewer: Samuel Groß <sa...@chromium.org>
Gerrit-CC: Hannes Payer <hpa...@chromium.org>
Gerrit-Comment-Date: Fri, 12 Apr 2024 12:36:08 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
unsatisfied_requirement
open
diffy

Andy Wingo (Gerrit)

unread,
Apr 12, 2024, 9:48:25 AM4/12/24
to Deepak Mohan (Robo), Samuel Groß, V8 LUCI CQ, Hannes Payer, cbruni...@chromium.org, mlippau...@chromium.org, v8-re...@googlegroups.com, victorgo...@chromium.org
Attention needed from Deepak Mohan (Robo)

Andy Wingo added 1 comment

File src/sandbox/external-pointer-table.h
Line 272, Patchset 4: using Base =
Andy Wingo . unresolved
Open in Gerrit

Related details

Attention is currently required from:
  • Deepak Mohan (Robo)
Submit Requirements:
  • requirement is not satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: I52f8ed7f0eacf7d979f56df977c351c7a9e932e0
Gerrit-Change-Number: 5401307
Gerrit-PatchSet: 6
Gerrit-Owner: Deepak Mohan (Robo) <hop2...@gmail.com>
Gerrit-Reviewer: Deepak Mohan (Robo) <hop2...@gmail.com>
Gerrit-Reviewer: Samuel Groß <sa...@chromium.org>
Gerrit-CC: Andy Wingo <wi...@igalia.com>
Gerrit-CC: Hannes Payer <hpa...@chromium.org>
Gerrit-Attention: Deepak Mohan (Robo) <hop2...@gmail.com>
Gerrit-Comment-Date: Fri, 12 Apr 2024 13:48:20 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
unsatisfied_requirement
open
diffy

Andy Wingo (Gerrit)

unread,
Apr 12, 2024, 9:53:10 AM4/12/24
to Deepak Mohan (Robo), Samuel Groß, V8 LUCI CQ, Hannes Payer, cbruni...@chromium.org, mlippau...@chromium.org, v8-re...@googlegroups.com, victorgo...@chromium.org
Attention needed from Deepak Mohan (Robo)

Andy Wingo added 1 comment

File src/sandbox/external-pointer-table.h
Andy Wingo . resolved
Andy Wingo

Aah excuse me, I was misreading an interdiff. Please ignore :)

Open in Gerrit

Related details

Attention is currently required from:
  • Deepak Mohan (Robo)
Submit Requirements:
  • requirement is not satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: I52f8ed7f0eacf7d979f56df977c351c7a9e932e0
Gerrit-Change-Number: 5401307
Gerrit-PatchSet: 6
Gerrit-Owner: Deepak Mohan (Robo) <hop2...@gmail.com>
Gerrit-Reviewer: Deepak Mohan (Robo) <hop2...@gmail.com>
Gerrit-Reviewer: Samuel Groß <sa...@chromium.org>
Gerrit-CC: Andy Wingo <wi...@igalia.com>
Gerrit-CC: Hannes Payer <hpa...@chromium.org>
Gerrit-Attention: Deepak Mohan (Robo) <hop2...@gmail.com>
Gerrit-Comment-Date: Fri, 12 Apr 2024 13:53:05 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Andy Wingo <wi...@igalia.com>
unsatisfied_requirement
open
diffy

Samuel Groß (Gerrit)

unread,
Apr 15, 2024, 10:39:30 AM4/15/24
to Deepak Mohan (Robo), Michael Lippautz, Igor Sheludko, Andy Wingo, V8 LUCI CQ, Hannes Payer, cbruni...@chromium.org, mlippau...@chromium.org, v8-re...@googlegroups.com, victorgo...@chromium.org
Attention needed from Deepak Mohan (Robo) and Michael Lippautz

Samuel Groß voted and added 5 comments

Votes added by Samuel Groß

Code-Review+1
Commit-Queue+1

5 comments

Patchset-level comments
File-level comment, Patchset 6 (Latest):
Samuel Groß . resolved

Nice, just a few more nits, otherwise LGTM from my side!

Commit Message
Line 9, Patchset 6 (Latest):This change implements a pointer table where each entry is 16 Bytes
Samuel Groß . unresolved

Nit: 'Bytes' -> 'bytes'

File src/sandbox/external-buffer-table-inl.h
Line 156, Patchset 6 (Latest):#ifdef DEBUG
Samuel Groß . unresolved

Nit: I think you can drop the `ifdef DEBUG` since the body is now a single `DCHECK`

Line 100, Patchset 6 (Latest): // During compaction, entries that are evacuated may not be visited during
// sweeping and may therefore still have their marking bit set. As such, we
// should clear that here.
payload.ClearMarkBit();
Samuel Groß . unresolved

See my other comment above. This is no longer necessary now that we've removed the shortcut in SweepAndCompact

File src/sandbox/external-buffer-table.cc
Line 194, Patchset 6 (Latest): at(old_index).UnmarkAndMigrateInto(new_entry);
Samuel Groß . unresolved

Nit: with the simplification in `SweepAndCompact` this can simply become `MigrateInto` now and doesn't have to do anything with the marking bit anymore.

Open in Gerrit

Related details

Attention is currently required from:
  • Deepak Mohan (Robo)
  • Michael Lippautz
Submit Requirements:
  • requirement satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: I52f8ed7f0eacf7d979f56df977c351c7a9e932e0
Gerrit-Change-Number: 5401307
Gerrit-PatchSet: 6
Gerrit-Owner: Deepak Mohan (Robo) <hop2...@gmail.com>
Gerrit-Reviewer: Deepak Mohan (Robo) <hop2...@gmail.com>
Gerrit-Reviewer: Michael Lippautz <mlip...@chromium.org>
Gerrit-Reviewer: Samuel Groß <sa...@chromium.org>
Gerrit-CC: Andy Wingo <wi...@igalia.com>
Gerrit-CC: Hannes Payer <hpa...@chromium.org>
Gerrit-CC: Igor Sheludko <ish...@chromium.org>
Gerrit-Attention: Deepak Mohan (Robo) <hop2...@gmail.com>
Gerrit-Attention: Michael Lippautz <mlip...@chromium.org>
Gerrit-Comment-Date: Mon, 15 Apr 2024 14:39:24 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
open
diffy

Deepak Mohan (Robo) (Gerrit)

unread,
Apr 15, 2024, 6:14:56 PM4/15/24
to Michael Lippautz, Samuel Groß, Igor Sheludko, Andy Wingo, V8 LUCI CQ, Hannes Payer, cbruni...@chromium.org, mlippau...@chromium.org, v8-re...@googlegroups.com, victorgo...@chromium.org
Attention needed from Michael Lippautz and Samuel Groß

Deepak Mohan (Robo) voted and added 4 comments

Votes added by Deepak Mohan (Robo)

Auto-Submit+1

4 comments

Commit Message
Line 9, Patchset 6:This change implements a pointer table where each entry is 16 Bytes
Samuel Groß . resolved

Nit: 'Bytes' -> 'bytes'

Deepak Mohan (Robo)

Acknowledged

File src/sandbox/external-buffer-table-inl.h
Samuel Groß . unresolved

Nit: I think you can drop the `ifdef DEBUG` since the body is now a single `DCHECK`

Deepak Mohan (Robo)

Should this be a `CHECK` instead ?

Line 100, Patchset 6: // During compaction, entries that are evacuated may not be visited during

// sweeping and may therefore still have their marking bit set. As such, we
// should clear that here.
payload.ClearMarkBit();
Samuel Groß . resolved

See my other comment above. This is no longer necessary now that we've removed the shortcut in SweepAndCompact

Deepak Mohan (Robo)

Acknowledged

File src/sandbox/external-buffer-table.cc
Line 194, Patchset 6: at(old_index).UnmarkAndMigrateInto(new_entry);
Samuel Groß . resolved

Nit: with the simplification in `SweepAndCompact` this can simply become `MigrateInto` now and doesn't have to do anything with the marking bit anymore.

Deepak Mohan (Robo)

Acknowledged

Open in Gerrit

Related details

Attention is currently required from:
  • Michael Lippautz
  • Samuel Groß
Submit Requirements:
  • requirement satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: I52f8ed7f0eacf7d979f56df977c351c7a9e932e0
Gerrit-Change-Number: 5401307
Gerrit-PatchSet: 7
Gerrit-Owner: Deepak Mohan (Robo) <hop2...@gmail.com>
Gerrit-Reviewer: Deepak Mohan (Robo) <hop2...@gmail.com>
Gerrit-Reviewer: Michael Lippautz <mlip...@chromium.org>
Gerrit-Reviewer: Samuel Groß <sa...@chromium.org>
Gerrit-CC: Andy Wingo <wi...@igalia.com>
Gerrit-CC: Hannes Payer <hpa...@chromium.org>
Gerrit-CC: Igor Sheludko <ish...@chromium.org>
Gerrit-Attention: Samuel Groß <sa...@chromium.org>
Gerrit-Attention: Michael Lippautz <mlip...@chromium.org>
Gerrit-Comment-Date: Mon, 15 Apr 2024 22:14:49 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: Samuel Groß <sa...@chromium.org>
satisfied_requirement
open
diffy

Michael Lippautz (Gerrit)

unread,
Apr 16, 2024, 2:25:34 AM4/16/24
to Deepak Mohan (Robo), Samuel Groß, Igor Sheludko, Andy Wingo, V8 LUCI CQ, Hannes Payer, cbruni...@chromium.org, mlippau...@chromium.org, v8-re...@googlegroups.com, victorgo...@chromium.org
Attention needed from Deepak Mohan (Robo) and Samuel Groß

Michael Lippautz voted and added 2 comments

Votes added by Michael Lippautz

Code-Review+1

2 comments

Patchset-level comments
File-level comment, Patchset 8 (Latest):
Michael Lippautz . resolved

lgtm, only looked at API, exuction, and heap

File include/v8-internal.h
Line 342, Patchset 8 (Latest):constexpr size_t kExternalBufferTableReservationSize = 128 * MB;
Michael Lippautz . unresolved

Introducing the CppPointerTable (which is just an EPT) caused OOMs for virtual memory on Android. The additional reservation may cause similar issues here.

Open in Gerrit

Related details

Attention is currently required from:
  • Deepak Mohan (Robo)
  • Samuel Groß
Submit Requirements:
  • requirement satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: I52f8ed7f0eacf7d979f56df977c351c7a9e932e0
Gerrit-Change-Number: 5401307
Gerrit-PatchSet: 8
Gerrit-Owner: Deepak Mohan (Robo) <hop2...@gmail.com>
Gerrit-Reviewer: Deepak Mohan (Robo) <hop2...@gmail.com>
Gerrit-Reviewer: Michael Lippautz <mlip...@chromium.org>
Gerrit-Reviewer: Samuel Groß <sa...@chromium.org>
Gerrit-CC: Andy Wingo <wi...@igalia.com>
Gerrit-CC: Hannes Payer <hpa...@chromium.org>
Gerrit-CC: Igor Sheludko <ish...@chromium.org>
Gerrit-Attention: Deepak Mohan (Robo) <hop2...@gmail.com>
Gerrit-Attention: Samuel Groß <sa...@chromium.org>
Gerrit-Comment-Date: Tue, 16 Apr 2024 06:25:27 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
open
diffy

Samuel Groß (Gerrit)

unread,
Apr 16, 2024, 2:47:41 AM4/16/24
to Deepak Mohan (Robo), Michael Lippautz, Igor Sheludko, Andy Wingo, V8 LUCI CQ, Hannes Payer, cbruni...@chromium.org, mlippau...@chromium.org, v8-re...@googlegroups.com, victorgo...@chromium.org
Attention needed from Deepak Mohan (Robo)

Samuel Groß voted and added 1 comment

Votes added by Samuel Groß

Code-Review+1

1 comment

File src/sandbox/external-buffer-table-inl.h
Samuel Groß . resolved

Nit: I think you can drop the `ifdef DEBUG` since the body is now a single `DCHECK`

Deepak Mohan (Robo)

Should this be a `CHECK` instead ?

Samuel Groß

No I think a `DCHECK` is fine here

Open in Gerrit

Related details

Attention is currently required from:
  • Deepak Mohan (Robo)
Submit Requirements:
  • requirement satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: I52f8ed7f0eacf7d979f56df977c351c7a9e932e0
Gerrit-Change-Number: 5401307
Gerrit-PatchSet: 8
Gerrit-Owner: Deepak Mohan (Robo) <hop2...@gmail.com>
Gerrit-Reviewer: Deepak Mohan (Robo) <hop2...@gmail.com>
Gerrit-Reviewer: Michael Lippautz <mlip...@chromium.org>
Gerrit-Reviewer: Samuel Groß <sa...@chromium.org>
Gerrit-CC: Andy Wingo <wi...@igalia.com>
Gerrit-CC: Hannes Payer <hpa...@chromium.org>
Gerrit-CC: Igor Sheludko <ish...@chromium.org>
Gerrit-Attention: Deepak Mohan (Robo) <hop2...@gmail.com>
Gerrit-Comment-Date: Tue, 16 Apr 2024 06:47:36 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
open
diffy

Deepak Mohan (Robo) (Gerrit)

unread,
Apr 16, 2024, 3:09:48 AM4/16/24
to Samuel Groß, Michael Lippautz, Igor Sheludko, Andy Wingo, V8 LUCI CQ, Hannes Payer, cbruni...@chromium.org, mlippau...@chromium.org, v8-re...@googlegroups.com, victorgo...@chromium.org
Attention needed from Michael Lippautz and Samuel Groß

Deepak Mohan (Robo) voted and added 1 comment

Votes added by Deepak Mohan (Robo)

Auto-Submit+1

1 comment

File include/v8-internal.h
Line 342, Patchset 8 (Latest):constexpr size_t kExternalBufferTableReservationSize = 128 * MB;
Michael Lippautz . unresolved

Introducing the CppPointerTable (which is just an EPT) caused OOMs for virtual memory on Android. The additional reservation may cause similar issues here.

Deepak Mohan (Robo)

Thanks for bringing this up! I see the solution there was to half the reservation size.

@sa...@chromium.org should we have a fallback for the buffer table case where failure to allocate subspace should use regular EPT ? Or just half the reservation for android as done for EPT ?

Open in Gerrit

Related details

Attention is currently required from:
  • Michael Lippautz
  • Samuel Groß
Submit Requirements:
  • requirement satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: I52f8ed7f0eacf7d979f56df977c351c7a9e932e0
Gerrit-Change-Number: 5401307
Gerrit-PatchSet: 8
Gerrit-Owner: Deepak Mohan (Robo) <hop2...@gmail.com>
Gerrit-Reviewer: Deepak Mohan (Robo) <hop2...@gmail.com>
Gerrit-Reviewer: Michael Lippautz <mlip...@chromium.org>
Gerrit-Reviewer: Samuel Groß <sa...@chromium.org>
Gerrit-CC: Andy Wingo <wi...@igalia.com>
Gerrit-CC: Hannes Payer <hpa...@chromium.org>
Gerrit-CC: Igor Sheludko <ish...@chromium.org>
Gerrit-Attention: Samuel Groß <sa...@chromium.org>
Gerrit-Attention: Michael Lippautz <mlip...@chromium.org>
Gerrit-Comment-Date: Tue, 16 Apr 2024 07:09:40 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: Michael Lippautz <mlip...@chromium.org>
satisfied_requirement
open
diffy

Samuel Groß (Gerrit)

unread,
Apr 16, 2024, 4:04:00 AM4/16/24
to Deepak Mohan (Robo), Michael Lippautz, Igor Sheludko, Andy Wingo, V8 LUCI CQ, Hannes Payer, cbruni...@chromium.org, mlippau...@chromium.org, v8-re...@googlegroups.com, victorgo...@chromium.org
Attention needed from Deepak Mohan (Robo) and Michael Lippautz

Samuel Groß added 1 comment

File include/v8-internal.h
Line 342, Patchset 8 (Latest):constexpr size_t kExternalBufferTableReservationSize = 128 * MB;
Michael Lippautz . unresolved

Introducing the CppPointerTable (which is just an EPT) caused OOMs for virtual memory on Android. The additional reservation may cause similar issues here.

Deepak Mohan (Robo)

Thanks for bringing this up! I see the solution there was to half the reservation size.

@sa...@chromium.org should we have a fallback for the buffer table case where failure to allocate subspace should use regular EPT ? Or just half the reservation for android as done for EPT ?

Samuel Groß

I think a fallback case like that would add quite a bit of complexity and I'm not sure if it'd be secure, so I'd like to avoid that. I think we could try halving the size on Android (as we do for the other tables) and then see if that's good enough.

Open in Gerrit

Related details

Attention is currently required from:
  • Deepak Mohan (Robo)
  • Michael Lippautz
Submit Requirements:
  • requirement satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: I52f8ed7f0eacf7d979f56df977c351c7a9e932e0
Gerrit-Change-Number: 5401307
Gerrit-PatchSet: 8
Gerrit-Owner: Deepak Mohan (Robo) <hop2...@gmail.com>
Gerrit-Reviewer: Deepak Mohan (Robo) <hop2...@gmail.com>
Gerrit-Reviewer: Michael Lippautz <mlip...@chromium.org>
Gerrit-Reviewer: Samuel Groß <sa...@chromium.org>
Gerrit-CC: Andy Wingo <wi...@igalia.com>
Gerrit-CC: Hannes Payer <hpa...@chromium.org>
Gerrit-CC: Igor Sheludko <ish...@chromium.org>
Gerrit-Attention: Deepak Mohan (Robo) <hop2...@gmail.com>
Gerrit-Attention: Michael Lippautz <mlip...@chromium.org>
Gerrit-Comment-Date: Tue, 16 Apr 2024 08:03:54 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Deepak Mohan (Robo) <hop2...@gmail.com>
Comment-In-Reply-To: Michael Lippautz <mlip...@chromium.org>
satisfied_requirement
open
diffy

Deepak Mohan (Robo) (Gerrit)

unread,
Apr 16, 2024, 7:41:23 AM4/16/24
to Samuel Groß, Michael Lippautz, Igor Sheludko, Andy Wingo, V8 LUCI CQ, Hannes Payer, cbruni...@chromium.org, mlippau...@chromium.org, v8-re...@googlegroups.com, victorgo...@chromium.org
Attention needed from Michael Lippautz

Deepak Mohan (Robo) added 2 comments

Patchset-level comments
Deepak Mohan (Robo) . resolved

Thanks for the review!

File include/v8-internal.h
Line 342, Patchset 8 (Latest):constexpr size_t kExternalBufferTableReservationSize = 128 * MB;
Michael Lippautz . resolved

Introducing the CppPointerTable (which is just an EPT) caused OOMs for virtual memory on Android. The additional reservation may cause similar issues here.

Deepak Mohan (Robo)

Thanks for bringing this up! I see the solution there was to half the reservation size.

@sa...@chromium.org should we have a fallback for the buffer table case where failure to allocate subspace should use regular EPT ? Or just half the reservation for android as done for EPT ?

Samuel Groß

I think a fallback case like that would add quite a bit of complexity and I'm not sure if it'd be secure, so I'd like to avoid that. I think we could try halving the size on Android (as we do for the other tables) and then see if that's good enough.

Deepak Mohan (Robo)
Open in Gerrit

Related details

Attention is currently required from:
  • Michael Lippautz
Submit Requirements:
  • requirement satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: I52f8ed7f0eacf7d979f56df977c351c7a9e932e0
Gerrit-Change-Number: 5401307
Gerrit-PatchSet: 8
Gerrit-Owner: Deepak Mohan (Robo) <hop2...@gmail.com>
Gerrit-Reviewer: Deepak Mohan (Robo) <hop2...@gmail.com>
Gerrit-Reviewer: Michael Lippautz <mlip...@chromium.org>
Gerrit-Reviewer: Samuel Groß <sa...@chromium.org>
Gerrit-CC: Andy Wingo <wi...@igalia.com>
Gerrit-CC: Hannes Payer <hpa...@chromium.org>
Gerrit-CC: Igor Sheludko <ish...@chromium.org>
Gerrit-Attention: Michael Lippautz <mlip...@chromium.org>
Gerrit-Comment-Date: Tue, 16 Apr 2024 11:41:16 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Deepak Mohan (Robo) <hop2...@gmail.com>
Comment-In-Reply-To: Samuel Groß <sa...@chromium.org>
Comment-In-Reply-To: Michael Lippautz <mlip...@chromium.org>
satisfied_requirement
open
diffy

Samuel Groß (Gerrit)

unread,
Apr 16, 2024, 9:33:23 AM4/16/24
to Deepak Mohan (Robo), Michael Lippautz, Igor Sheludko, Andy Wingo, V8 LUCI CQ, Hannes Payer, cbruni...@chromium.org, mlippau...@chromium.org, v8-re...@googlegroups.com, victorgo...@chromium.org
Attention needed from Deepak Mohan (Robo) and Michael Lippautz

Samuel Groß added 2 comments

Patchset-level comments
Samuel Groß . resolved

One more thing I just noticed

File src/sandbox/external-buffer-table.h
Line 232, Patchset 8 (Latest): // This method is atomic and can be called from background threads.
Samuel Groß . unresolved

Now that we use two fields in the Entry struct, and set both in this function, I think this statement is no longer true. If we're unlucky, a `::Set` in one thread could interleave with a `::Get` in another thread and produce incorrect results. Maybe just update this comment to state that it is not atomic as it stores two fields?

Open in Gerrit

Related details

Attention is currently required from:
  • Deepak Mohan (Robo)
  • Michael Lippautz
Submit Requirements:
  • requirement satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: I52f8ed7f0eacf7d979f56df977c351c7a9e932e0
Gerrit-Change-Number: 5401307
Gerrit-PatchSet: 8
Gerrit-Owner: Deepak Mohan (Robo) <hop2...@gmail.com>
Gerrit-Reviewer: Deepak Mohan (Robo) <hop2...@gmail.com>
Gerrit-Reviewer: Michael Lippautz <mlip...@chromium.org>
Gerrit-Reviewer: Samuel Groß <sa...@chromium.org>
Gerrit-CC: Andy Wingo <wi...@igalia.com>
Gerrit-CC: Hannes Payer <hpa...@chromium.org>
Gerrit-CC: Igor Sheludko <ish...@chromium.org>
Gerrit-Attention: Deepak Mohan (Robo) <hop2...@gmail.com>
Gerrit-Attention: Michael Lippautz <mlip...@chromium.org>
Gerrit-Comment-Date: Tue, 16 Apr 2024 13:33:16 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
open
diffy

V8 LUCI CQ (Gerrit)

unread,
Apr 16, 2024, 9:38:35 AM4/16/24
to Deepak Mohan (Robo), Michael Lippautz, Samuel Groß, Igor Sheludko, Andy Wingo, Hannes Payer, cbruni...@chromium.org, mlippau...@chromium.org, v8-re...@googlegroups.com, victorgo...@chromium.org

V8 LUCI CQ submitted the change

Change information

Commit message:
[sandbox] Introduce ExternalBufferTable

This change implements a pointer table where each entry is 16 bytes
of (external pointer, size) tuple. The table is intended for
accessing buffer data outside the sandbox in a memory safe way.

The table supports compaction and follows the same GC algorithm
as ExternalPointerTable.
Bug: v8:14585
Change-Id: I52f8ed7f0eacf7d979f56df977c351c7a9e932e0
Reviewed-by: Michael Lippautz <mlip...@chromium.org>
Auto-Submit: Deepak Mohan (Robo) <hop2...@gmail.com>
Commit-Queue: Michael Lippautz <mlip...@chromium.org>
Reviewed-by: Samuel Groß <sa...@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93391}
Files:
  • M BUILD.bazel
  • M BUILD.gn
  • M include/v8-internal.h
  • M src/execution/isolate-data.h
  • M src/execution/isolate.cc
  • M src/execution/isolate.h
  • M src/heap/heap.h
  • M src/sandbox/compactible-external-entity-table.h
  • A src/sandbox/external-buffer-inl.h
  • A src/sandbox/external-buffer-table-inl.h
  • A src/sandbox/external-buffer-table.cc
  • A src/sandbox/external-buffer-table.h
  • A src/sandbox/external-buffer.h
  • M src/sandbox/external-pointer-inl.h
  • M src/sandbox/isolate-inl.h
  • M src/sandbox/isolate.h
Change size: L
Delta: 16 files changed, 992 insertions(+), 2 deletions(-)
Branch: refs/heads/main
Submit Requirements:
  • requirement satisfiedCode-Review: +1 by Michael Lippautz, +1 by Samuel Groß
Open in Gerrit
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: merged
Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: I52f8ed7f0eacf7d979f56df977c351c7a9e932e0
Gerrit-Change-Number: 5401307
Gerrit-PatchSet: 9
Gerrit-Owner: Deepak Mohan (Robo) <hop2...@gmail.com>
Gerrit-Reviewer: Deepak Mohan (Robo) <hop2...@gmail.com>
Gerrit-Reviewer: Michael Lippautz <mlip...@chromium.org>
Gerrit-Reviewer: Samuel Groß <sa...@chromium.org>
open
diffy
satisfied_requirement

Deepak Mohan (Robo) (Gerrit)

unread,
Apr 16, 2024, 10:07:21 AM4/16/24
to V8 LUCI CQ, Michael Lippautz, Samuel Groß, Igor Sheludko, Andy Wingo, Hannes Payer, cbruni...@chromium.org, mlippau...@chromium.org, v8-re...@googlegroups.com, victorgo...@chromium.org

Deepak Mohan (Robo) added 1 comment

File src/sandbox/external-buffer-table.h
Line 232, Patchset 8: // This method is atomic and can be called from background threads.
Samuel Groß . unresolved

Now that we use two fields in the Entry struct, and set both in this function, I think this statement is no longer true. If we're unlucky, a `::Set` in one thread could interleave with a `::Get` in another thread and produce incorrect results. Maybe just update this comment to state that it is not atomic as it stores two fields?

Deepak Mohan (Robo)

Would it be okay if I make the change as part of https://chromium-review.googlesource.com/c/v8/v8/+/5406741 or do you prefer it in a separate CL ?

Also QQ, is there any situation were we would need to access the getter and setter methods from multiple threads today ?

Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: I52f8ed7f0eacf7d979f56df977c351c7a9e932e0
Gerrit-Change-Number: 5401307
Gerrit-PatchSet: 9
Gerrit-Owner: Deepak Mohan (Robo) <hop2...@gmail.com>
Gerrit-Reviewer: Deepak Mohan (Robo) <hop2...@gmail.com>
Gerrit-Reviewer: Michael Lippautz <mlip...@chromium.org>
Gerrit-Reviewer: Samuel Groß <sa...@chromium.org>
Gerrit-CC: Andy Wingo <wi...@igalia.com>
Gerrit-CC: Hannes Payer <hpa...@chromium.org>
Gerrit-CC: Igor Sheludko <ish...@chromium.org>
Gerrit-Comment-Date: Tue, 16 Apr 2024 14:07:06 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Samuel Groß <sa...@chromium.org>
satisfied_requirement
open
diffy

Samuel Groß (Gerrit)

unread,
Apr 16, 2024, 10:12:45 AM4/16/24
to Deepak Mohan (Robo), V8 LUCI CQ, Michael Lippautz, Igor Sheludko, Andy Wingo, Hannes Payer, cbruni...@chromium.org, mlippau...@chromium.org, v8-re...@googlegroups.com, victorgo...@chromium.org

Samuel Groß added 1 comment

File src/sandbox/external-buffer-table.h
Line 232, Patchset 8: // This method is atomic and can be called from background threads.
Samuel Groß . resolved

Now that we use two fields in the Entry struct, and set both in this function, I think this statement is no longer true. If we're unlucky, a `::Set` in one thread could interleave with a `::Get` in another thread and produce incorrect results. Maybe just update this comment to state that it is not atomic as it stores two fields?

Deepak Mohan (Robo)

Would it be okay if I make the change as part of https://chromium-review.googlesource.com/c/v8/v8/+/5406741 or do you prefer it in a separate CL ?

Also QQ, is there any situation were we would need to access the getter and setter methods from multiple threads today ?

Samuel Groß

Yeah that's fine! And yeah, I'm not sure this is currently needed at all (we probably only need AllocateAndInitialize), but I guess it's kind of awkward not to have a `Set` method? But I'm also fine with deleting the method if it's not needed anywhere

Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: I52f8ed7f0eacf7d979f56df977c351c7a9e932e0
Gerrit-Change-Number: 5401307
Gerrit-PatchSet: 9
Gerrit-Owner: Deepak Mohan (Robo) <hop2...@gmail.com>
Gerrit-Reviewer: Deepak Mohan (Robo) <hop2...@gmail.com>
Gerrit-Reviewer: Michael Lippautz <mlip...@chromium.org>
Gerrit-Reviewer: Samuel Groß <sa...@chromium.org>
Gerrit-CC: Andy Wingo <wi...@igalia.com>
Gerrit-CC: Hannes Payer <hpa...@chromium.org>
Gerrit-CC: Igor Sheludko <ish...@chromium.org>
Gerrit-Comment-Date: Tue, 16 Apr 2024 14:12:38 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
open
diffy
Reply all
Reply to author
Forward
0 new messages