[heap] Fix age check for scavenged objects [v8/v8 : main]

0 views
Skip to first unread message

Omer Katz (Gerrit)

unread,
Sep 26, 2025, 6:57:11 AM (yesterday) Sep 26
to Dominik Inführ, V8 LUCI CQ, Hannes Payer, mlippau...@chromium.org, v8-re...@googlegroups.com
Attention needed from Dominik Inführ

Omer Katz added 1 comment

Patchset-level comments
Open in Gerrit

Related details

Attention is currently required from:
  • Dominik Inführ
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
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: I4a0e1e4077b443f0a293a9fbecd58072a3a3be69
Gerrit-Change-Number: 6988569
Gerrit-PatchSet: 1
Gerrit-Owner: Omer Katz <omer...@chromium.org>
Gerrit-Reviewer: Dominik Inführ <dinf...@chromium.org>
Gerrit-Reviewer: Omer Katz <omer...@chromium.org>
Gerrit-CC: Hannes Payer <hpa...@chromium.org>
Gerrit-Attention: Dominik Inführ <dinf...@chromium.org>
Gerrit-Comment-Date: Fri, 26 Sep 2025 10:57:05 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Dominik Inführ (Gerrit)

unread,
Sep 26, 2025, 8:08:39 AM (yesterday) Sep 26
to Omer Katz, V8 LUCI CQ, Hannes Payer, mlippau...@chromium.org, v8-re...@googlegroups.com
Attention needed from Omer Katz

Dominik Inführ voted and added 2 comments

Votes added by Dominik Inführ

Code-Review+1

2 comments

Patchset-level comments
Dominik Inführ . resolved

Good catch! LGTM

File src/heap/scavenger.cc
Line 1092, Patchset 1 (Latest): return !HeapLayout::InYoungGeneration(object) ||
Dominik Inführ . unresolved

Nit: We could split this condition up a bit, now that we have this in its own function. Something like:

```
if (!InYoungGeneration(object)) return true;
...
```

Open in Gerrit

Related details

Attention is currently required from:
  • Omer Katz
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement satisfiedReview-Enforcement
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: I4a0e1e4077b443f0a293a9fbecd58072a3a3be69
Gerrit-Change-Number: 6988569
Gerrit-PatchSet: 1
Gerrit-Owner: Omer Katz <omer...@chromium.org>
Gerrit-Reviewer: Dominik Inführ <dinf...@chromium.org>
Gerrit-Reviewer: Omer Katz <omer...@chromium.org>
Gerrit-CC: Hannes Payer <hpa...@chromium.org>
Gerrit-Attention: Omer Katz <omer...@chromium.org>
Gerrit-Comment-Date: Fri, 26 Sep 2025 12:08:33 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Omer Katz (Gerrit)

unread,
Sep 26, 2025, 8:15:37 AM (yesterday) Sep 26
to Dominik Inführ, V8 LUCI CQ, Hannes Payer, mlippau...@chromium.org, v8-re...@googlegroups.com

Omer Katz voted and added 1 comment

Votes added by Omer Katz

Commit-Queue+2

1 comment

File src/heap/scavenger.cc
Line 1092, Patchset 1: return !HeapLayout::InYoungGeneration(object) ||
Dominik Inführ . resolved

Nit: We could split this condition up a bit, now that we have this in its own function. Something like:

```
if (!InYoungGeneration(object)) return true;
...
```

Omer Katz

Done

Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
    • requirement satisfiedCode-Owners
    • requirement satisfiedCode-Review
    • requirement satisfiedReview-Enforcement
    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: I4a0e1e4077b443f0a293a9fbecd58072a3a3be69
    Gerrit-Change-Number: 6988569
    Gerrit-PatchSet: 2
    Gerrit-Owner: Omer Katz <omer...@chromium.org>
    Gerrit-Reviewer: Dominik Inführ <dinf...@chromium.org>
    Gerrit-Reviewer: Omer Katz <omer...@chromium.org>
    Gerrit-CC: Hannes Payer <hpa...@chromium.org>
    Gerrit-Comment-Date: Fri, 26 Sep 2025 12:15:31 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    Comment-In-Reply-To: Dominik Inführ <dinf...@chromium.org>
    satisfied_requirement
    open
    diffy

    V8 LUCI CQ (Gerrit)

    unread,
    Sep 26, 2025, 8:46:23 AM (yesterday) Sep 26
    to Omer Katz, Dominik Inführ, Hannes Payer, mlippau...@chromium.org, v8-re...@googlegroups.com

    V8 LUCI CQ submitted the change with unreviewed changes

    Unreviewed changes

    1 is the latest approved patch-set.
    The change was submitted with unreviewed changes in the following files:

    ```
    The name of the file: src/heap/scavenger.cc
    Insertions: 12, Deletions: 5.

    @@ -1089,11 +1089,18 @@

    namespace {
    bool HeapObjectWillBeOld(const Heap* heap, Tagged<HeapObject> object) {
    - return !HeapLayout::InYoungGeneration(object) ||
    - HeapLayout::InAnyLargeSpace(object) ||
    - (HeapLayout::IsSelfForwarded(object) &&
    - MemoryChunkMetadata::FromHeapObject(heap->isolate(), object)
    - ->will_be_promoted());
    + if (!HeapLayout::InYoungGeneration(object)) {
    + return true;
    + }
    + if (HeapLayout::InAnyLargeSpace(object)) {
    + return true;
    + }
    + if (HeapLayout::IsSelfForwarded(object) &&
    + MemoryChunkMetadata::FromHeapObject(heap->isolate(), object)
    + ->will_be_promoted()) {
    + return true;
    + }
    + return false;
    }
    } // namespace

    ```

    Change information

    Commit message:
    [heap] Fix age check for scavenged objects

    The check was only looking at `HeapLayout::InYoungGeneration` and
    ignored large pages and pinned promoted pages. As a result, it was
    possible to miss a old-to-new slot, which could lead to a memory
    corruption.
    Bug: 447457117
    Change-Id: I4a0e1e4077b443f0a293a9fbecd58072a3a3be69
    Reviewed-by: Dominik Inführ <dinf...@chromium.org>
    Commit-Queue: Omer Katz <omer...@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#102794}
    Files:
    • M src/heap/scavenger.cc
    Change size: S
    Delta: 1 file changed, 26 insertions(+), 12 deletions(-)
    Branch: refs/heads/main
    Submit Requirements:
    • requirement satisfiedCode-Review: +1 by Dominik Inführ
    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: I4a0e1e4077b443f0a293a9fbecd58072a3a3be69
    Gerrit-Change-Number: 6988569
    Gerrit-PatchSet: 3
    Gerrit-Owner: Omer Katz <omer...@chromium.org>
    Gerrit-Reviewer: Dominik Inführ <dinf...@chromium.org>
    Gerrit-Reviewer: Omer Katz <omer...@chromium.org>
    Gerrit-CC: Hannes Payer <hpa...@chromium.org>
    open
    diffy
    satisfied_requirement
    Reply all
    Reply to author
    Forward
    0 new messages