[fuchsia] Reject duplicate sysmem buffer collection ids [chromium/src : main]

0 views
Skip to first unread message

David Song (Gerrit)

unread,
Jul 15, 2026, 4:05:50 PM (8 days ago) Jul 15
to Bailey Myers-Morgan, Code Review Nudger, android-bu...@system.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org, David Worsham, Robert Kroeger, emi...@google.com, fuchsia...@chromium.org, ozone-...@chromium.org, spang...@chromium.org
Attention needed from Bailey Myers-Morgan

David Song added 1 comment

File ui/ozone/platform/flatland/flatland_sysmem_buffer_manager.cc
Line 107, Patchset 1 (Latest): {
base::AutoLock auto_lock(collections_lock_);
if (collections_.contains(koid.value())) {
return nullptr;
}
}
David Song . unresolved

Wouldn't this introduce a TOCTOU issue?

Open in Gerrit

Related details

Attention is currently required from:
  • Bailey Myers-Morgan
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • 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: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I99082dcdf4c197395444de17876714abf26568a2
Gerrit-Change-Number: 8076918
Gerrit-PatchSet: 1
Gerrit-Owner: Bailey Myers-Morgan <bmyers...@google.com>
Gerrit-Reviewer: Bailey Myers-Morgan <bmyers...@google.com>
Gerrit-Reviewer: David Song <winter...@google.com>
Gerrit-CC: Code Review Nudger <android-build...@prod.google.com>
Gerrit-CC: David Worsham <dwor...@google.com>
Gerrit-CC: Robert Kroeger <rjkr...@chromium.org>
Gerrit-Attention: Bailey Myers-Morgan <bmyers...@google.com>
Gerrit-Comment-Date: Wed, 15 Jul 2026 20:05:38 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Bailey Myers-Morgan (Gerrit)

unread,
Jul 15, 2026, 4:59:25 PM (8 days ago) Jul 15
to Bailey Myers-Morgan, Code Review Nudger, David Song, android-bu...@system.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org, David Worsham, Robert Kroeger, emi...@google.com, fuchsia...@chromium.org, ozone-...@chromium.org, spang...@chromium.org
Attention needed from David Song

Bailey Myers-Morgan added 1 comment

File ui/ozone/platform/flatland/flatland_sysmem_buffer_manager.cc

base::AutoLock auto_lock(collections_lock_);
if (collections_.contains(koid.value())) {
return nullptr;
}
}
David Song . unresolved

Wouldn't this introduce a TOCTOU issue?

Bailey Myers-Morgan

Yes, I think you're right. I've refactored to return a bool rather than void so the code should know better when to properly destroy the collection. Does this look like it'll resolve your concern?

Open in Gerrit

Related details

Attention is currently required from:
  • David Song
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • 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: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I99082dcdf4c197395444de17876714abf26568a2
Gerrit-Change-Number: 8076918
Gerrit-PatchSet: 3
Gerrit-Owner: Bailey Myers-Morgan <bmyers...@google.com>
Gerrit-Reviewer: Bailey Myers-Morgan <bmyers...@google.com>
Gerrit-Reviewer: David Song <winter...@google.com>
Gerrit-CC: Code Review Nudger <android-build...@prod.google.com>
Gerrit-CC: David Worsham <dwor...@google.com>
Gerrit-CC: Robert Kroeger <rjkr...@chromium.org>
Gerrit-Attention: David Song <winter...@google.com>
Gerrit-Comment-Date: Wed, 15 Jul 2026 20:59:11 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: David Song <winter...@google.com>
satisfied_requirement
unsatisfied_requirement
open
diffy

David Song (Gerrit)

unread,
Jul 15, 2026, 5:15:55 PM (8 days ago) Jul 15
to Bailey Myers-Morgan, Code Review Nudger, android-bu...@system.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org, David Worsham, Robert Kroeger, emi...@google.com, fuchsia...@chromium.org, ozone-...@chromium.org, spang...@chromium.org
Attention needed from Bailey Myers-Morgan

David Song added 1 comment

File ui/ozone/platform/flatland/flatland_sysmem_buffer_manager.cc
Line 107, Patchset 1: {
base::AutoLock auto_lock(collections_lock_);
if (collections_.contains(koid.value())) {
return nullptr;
}
}
David Song . unresolved

Wouldn't this introduce a TOCTOU issue?

Bailey Myers-Morgan

Yes, I think you're right. I've refactored to return a bool rather than void so the code should know better when to properly destroy the collection. Does this look like it'll resolve your concern?

David Song

We can remove this block then, right?

Open in Gerrit

Related details

Attention is currently required from:
  • Bailey Myers-Morgan
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • 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: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I99082dcdf4c197395444de17876714abf26568a2
Gerrit-Change-Number: 8076918
Gerrit-PatchSet: 3
Gerrit-Owner: Bailey Myers-Morgan <bmyers...@google.com>
Gerrit-Reviewer: Bailey Myers-Morgan <bmyers...@google.com>
Gerrit-Reviewer: David Song <winter...@google.com>
Gerrit-CC: Code Review Nudger <android-build...@prod.google.com>
Gerrit-CC: David Worsham <dwor...@google.com>
Gerrit-CC: Robert Kroeger <rjkr...@chromium.org>
Gerrit-Attention: Bailey Myers-Morgan <bmyers...@google.com>
Gerrit-Comment-Date: Wed, 15 Jul 2026 21:15:43 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Bailey Myers-Morgan <bmyers...@google.com>
Comment-In-Reply-To: David Song <winter...@google.com>
satisfied_requirement
unsatisfied_requirement
open
diffy

Bailey Myers-Morgan (Gerrit)

unread,
Jul 15, 2026, 8:00:52 PM (7 days ago) Jul 15
to Bailey Myers-Morgan, Code Review Nudger, David Song, android-bu...@system.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org, David Worsham, Robert Kroeger, emi...@google.com, fuchsia...@chromium.org, ozone-...@chromium.org, spang...@chromium.org
Attention needed from David Song

Bailey Myers-Morgan added 1 comment

File ui/ozone/platform/flatland/flatland_sysmem_buffer_manager.cc
Line 107, Patchset 1: {
base::AutoLock auto_lock(collections_lock_);
if (collections_.contains(koid.value())) {
return nullptr;
}
}
David Song . unresolved

Wouldn't this introduce a TOCTOU issue?

Bailey Myers-Morgan

Yes, I think you're right. I've refactored to return a bool rather than void so the code should know better when to properly destroy the collection. Does this look like it'll resolve your concern?

David Song

We can remove this block then, right?

Bailey Myers-Morgan

PTAL -- now using `pending_registrations_` to track koids immediately. I believe that should prevent double-registration of collections?

w/r/t returnning `nullptr` rather than `void`, Jetski says:

The public interface `ImportSysmemBufferCollection` is defined to return `scoped_refptr<FlatlandSysmemBufferCollection>`. Because of this signature, we return `nullptr` on failure paths so that calling code (which expects a ref-pointer) knows the import failed and doesn't try to use an invalid reference.

Open in Gerrit

Related details

Attention is currently required from:
  • David Song
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • 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: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I99082dcdf4c197395444de17876714abf26568a2
Gerrit-Change-Number: 8076918
Gerrit-PatchSet: 4
Gerrit-Owner: Bailey Myers-Morgan <bmyers...@google.com>
Gerrit-Reviewer: Bailey Myers-Morgan <bmyers...@google.com>
Gerrit-Reviewer: David Song <winter...@google.com>
Gerrit-CC: Code Review Nudger <android-build...@prod.google.com>
Gerrit-CC: David Worsham <dwor...@google.com>
Gerrit-CC: Robert Kroeger <rjkr...@chromium.org>
Gerrit-Attention: David Song <winter...@google.com>
Gerrit-Comment-Date: Thu, 16 Jul 2026 00:00:39 +0000
satisfied_requirement
unsatisfied_requirement
open
diffy

David Song (Gerrit)

unread,
Jul 16, 2026, 12:58:24 PM (7 days ago) Jul 16
to Bailey Myers-Morgan, Code Review Nudger, android-bu...@system.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org, David Worsham, Robert Kroeger, emi...@google.com, fuchsia...@chromium.org, ozone-...@chromium.org, spang...@chromium.org
Attention needed from Bailey Myers-Morgan

David Song added 2 comments

File ui/ozone/platform/flatland/flatland_sysmem_buffer_manager.h
Line 100, Patchset 4 (Latest): std::unordered_set<zx_koid_t> pending_registrations_
GUARDED_BY(collections_lock_);
David Song . unresolved

I don't think we need to introduce another unordered_set here. We can store a `nullptr` in `collections_`, which holds the key until it's initialized.

File ui/ozone/platform/flatland/flatland_sysmem_buffer_manager.cc
Line 107, Patchset 1: {
base::AutoLock auto_lock(collections_lock_);
if (collections_.contains(koid.value())) {
return nullptr;
}
}
David Song . unresolved

Wouldn't this introduce a TOCTOU issue?

Bailey Myers-Morgan

Yes, I think you're right. I've refactored to return a bool rather than void so the code should know better when to properly destroy the collection. Does this look like it'll resolve your concern?

David Song

We can remove this block then, right?

Bailey Myers-Morgan

PTAL -- now using `pending_registrations_` to track koids immediately. I believe that should prevent double-registration of collections?

w/r/t returnning `nullptr` rather than `void`, Jetski says:

The public interface `ImportSysmemBufferCollection` is defined to return `scoped_refptr<FlatlandSysmemBufferCollection>`. Because of this signature, we return `nullptr` on failure paths so that calling code (which expects a ref-pointer) knows the import failed and doesn't try to use an invalid reference.

David Song

Flatland is a Fuchsia concept, and we can change its public interface. There's only 1 caller of `ImportSysmemBufferCollection`, and it immediately drops the return value, so it's already not doing what Jetski is saying.

Open in Gerrit

Related details

Attention is currently required from:
  • Bailey Myers-Morgan
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • 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: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I99082dcdf4c197395444de17876714abf26568a2
Gerrit-Change-Number: 8076918
Gerrit-PatchSet: 4
Gerrit-Owner: Bailey Myers-Morgan <bmyers...@google.com>
Gerrit-Reviewer: Bailey Myers-Morgan <bmyers...@google.com>
Gerrit-Reviewer: David Song <winter...@google.com>
Gerrit-CC: Code Review Nudger <android-build...@prod.google.com>
Gerrit-CC: David Worsham <dwor...@google.com>
Gerrit-CC: Robert Kroeger <rjkr...@chromium.org>
Gerrit-Attention: Bailey Myers-Morgan <bmyers...@google.com>
Gerrit-Comment-Date: Thu, 16 Jul 2026 16:58:11 +0000
satisfied_requirement
unsatisfied_requirement
open
diffy

Bailey Myers-Morgan (Gerrit)

unread,
Jul 16, 2026, 1:49:42 PM (7 days ago) Jul 16
to Bailey Myers-Morgan, Code Review Nudger, David Song, android-bu...@system.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org, David Worsham, Robert Kroeger, emi...@google.com, fuchsia...@chromium.org, ozone-...@chromium.org, spang...@chromium.org
Attention needed from David Song

Bailey Myers-Morgan added 3 comments

File ui/ozone/platform/flatland/flatland_sysmem_buffer_manager.h
Line 100, Patchset 4: std::unordered_set<zx_koid_t> pending_registrations_
GUARDED_BY(collections_lock_);
David Song . resolved

I don't think we need to introduce another unordered_set here. We can store a `nullptr` in `collections_`, which holds the key until it's initialized.

Bailey Myers-Morgan

Oh, that's clever! I didn't think of that.

File ui/ozone/platform/flatland/flatland_sysmem_buffer_manager.cc
Line 107, Patchset 1: {
base::AutoLock auto_lock(collections_lock_);
if (collections_.contains(koid.value())) {
return nullptr;
}
}
David Song . unresolved

Wouldn't this introduce a TOCTOU issue?

Bailey Myers-Morgan

Yes, I think you're right. I've refactored to return a bool rather than void so the code should know better when to properly destroy the collection. Does this look like it'll resolve your concern?

David Song

We can remove this block then, right?

Bailey Myers-Morgan

PTAL -- now using `pending_registrations_` to track koids immediately. I believe that should prevent double-registration of collections?

w/r/t returnning `nullptr` rather than `void`, Jetski says:

The public interface `ImportSysmemBufferCollection` is defined to return `scoped_refptr<FlatlandSysmemBufferCollection>`. Because of this signature, we return `nullptr` on failure paths so that calling code (which expects a ref-pointer) knows the import failed and doesn't try to use an invalid reference.

David Song

Flatland is a Fuchsia concept, and we can change its public interface. There's only 1 caller of `ImportSysmemBufferCollection`, and it immediately drops the return value, so it's already not doing what Jetski is saying.

Bailey Myers-Morgan

Done. I was hesitant to change the interface itself; I suppose the only concern would be someone trying to use the refptr in the future, and that seems pretty unlikely. And they could also just as easily change it back.

Line 128, Patchset 6 (Latest):void FlatlandSysmemBufferManager::RegisterCollection(
Bailey Myers-Morgan . unresolved

PTAL here--I switched this back to `void` since the `bool` return didn't actually address the TOCTOU issue. Let me know if I'm missing something, but I think the early return should work the same as `return False`.

Open in Gerrit

Related details

Attention is currently required from:
  • David Song
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • 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: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I99082dcdf4c197395444de17876714abf26568a2
Gerrit-Change-Number: 8076918
Gerrit-PatchSet: 6
Gerrit-Owner: Bailey Myers-Morgan <bmyers...@google.com>
Gerrit-Reviewer: Bailey Myers-Morgan <bmyers...@google.com>
Gerrit-Reviewer: David Song <winter...@google.com>
Gerrit-CC: Code Review Nudger <android-build...@prod.google.com>
Gerrit-CC: David Worsham <dwor...@google.com>
Gerrit-CC: Robert Kroeger <rjkr...@chromium.org>
Gerrit-Attention: David Song <winter...@google.com>
Gerrit-Comment-Date: Thu, 16 Jul 2026 17:49:30 +0000
satisfied_requirement
unsatisfied_requirement
open
diffy

David Song (Gerrit)

unread,
Jul 16, 2026, 2:07:46 PM (7 days ago) Jul 16
to Bailey Myers-Morgan, Code Review Nudger, android-bu...@system.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org, David Worsham, Robert Kroeger, emi...@google.com, fuchsia...@chromium.org, ozone-...@chromium.org, spang...@chromium.org
Attention needed from Bailey Myers-Morgan

David Song voted and added 2 comments

Votes added by David Song

Code-Review+1

2 comments

File ui/ozone/platform/flatland/flatland_sysmem_buffer_manager.cc
Line 107, Patchset 1: {
base::AutoLock auto_lock(collections_lock_);
if (collections_.contains(koid.value())) {
return nullptr;
}
}
David Song . resolved

Wouldn't this introduce a TOCTOU issue?

Bailey Myers-Morgan

Yes, I think you're right. I've refactored to return a bool rather than void so the code should know better when to properly destroy the collection. Does this look like it'll resolve your concern?

David Song

We can remove this block then, right?

Bailey Myers-Morgan

PTAL -- now using `pending_registrations_` to track koids immediately. I believe that should prevent double-registration of collections?

w/r/t returnning `nullptr` rather than `void`, Jetski says:

The public interface `ImportSysmemBufferCollection` is defined to return `scoped_refptr<FlatlandSysmemBufferCollection>`. Because of this signature, we return `nullptr` on failure paths so that calling code (which expects a ref-pointer) knows the import failed and doesn't try to use an invalid reference.

David Song

Flatland is a Fuchsia concept, and we can change its public interface. There's only 1 caller of `ImportSysmemBufferCollection`, and it immediately drops the return value, so it's already not doing what Jetski is saying.

Bailey Myers-Morgan

Done. I was hesitant to change the interface itself; I suppose the only concern would be someone trying to use the refptr in the future, and that seems pretty unlikely. And they could also just as easily change it back.

David Song

LGTM.

Line 128, Patchset 6 (Latest):void FlatlandSysmemBufferManager::RegisterCollection(
Bailey Myers-Morgan . unresolved

PTAL here--I switched this back to `void` since the `bool` return didn't actually address the TOCTOU issue. Let me know if I'm missing something, but I think the early return should work the same as `return False`.

David Song

Agreed on switching back to `void` here. We can go further and `CHECK` our invariant that the `koid` is present in the `collections_` map as `nullptr`.

Open in Gerrit

Related details

Attention is currently required from:
  • Bailey Myers-Morgan
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • 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: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I99082dcdf4c197395444de17876714abf26568a2
Gerrit-Change-Number: 8076918
Gerrit-PatchSet: 6
Gerrit-Owner: Bailey Myers-Morgan <bmyers...@google.com>
Gerrit-Reviewer: Bailey Myers-Morgan <bmyers...@google.com>
Gerrit-Reviewer: David Song <winter...@google.com>
Gerrit-CC: Code Review Nudger <android-build...@prod.google.com>
Gerrit-CC: David Worsham <dwor...@google.com>
Gerrit-CC: Robert Kroeger <rjkr...@chromium.org>
Gerrit-Attention: Bailey Myers-Morgan <bmyers...@google.com>
Gerrit-Comment-Date: Thu, 16 Jul 2026 18:07:32 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Bailey Myers-Morgan (Gerrit)

unread,
Jul 20, 2026, 4:31:18 PM (3 days ago) Jul 20
to Bailey Myers-Morgan, David Song, Code Review Nudger, android-bu...@system.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org, David Worsham, Robert Kroeger, emi...@google.com, fuchsia...@chromium.org, ozone-...@chromium.org, spang...@chromium.org
Attention needed from David Song

Bailey Myers-Morgan added 1 comment

File ui/ozone/platform/flatland/flatland_sysmem_buffer_manager.cc
Line 128, Patchset 6:void FlatlandSysmemBufferManager::RegisterCollection(
Bailey Myers-Morgan . unresolved

PTAL here--I switched this back to `void` since the `bool` return didn't actually address the TOCTOU issue. Let me know if I'm missing something, but I think the early return should work the same as `return False`.

David Song

Agreed on switching back to `void` here. We can go further and `CHECK` our invariant that the `koid` is present in the `collections_` map as `nullptr`.

Bailey Myers-Morgan

That's a clever idea. Could you quickly PTAL at this change (patchset 6 to 7)? I'm pretty unfamiliar with CHECKs so I want to make sure I replaced the right thing. 😊

Open in Gerrit

Related details

Attention is currently required from:
  • David Song
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • 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: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I99082dcdf4c197395444de17876714abf26568a2
Gerrit-Change-Number: 8076918
Gerrit-PatchSet: 7
Gerrit-Owner: Bailey Myers-Morgan <bmyers...@google.com>
Gerrit-Reviewer: Bailey Myers-Morgan <bmyers...@google.com>
Gerrit-Reviewer: David Song <winter...@google.com>
Gerrit-CC: Code Review Nudger <android-build...@prod.google.com>
Gerrit-CC: David Worsham <dwor...@google.com>
Gerrit-CC: Robert Kroeger <rjkr...@chromium.org>
Gerrit-Attention: David Song <winter...@google.com>
Gerrit-Comment-Date: Mon, 20 Jul 2026 20:31:08 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

David Song (Gerrit)

unread,
Jul 20, 2026, 5:51:26 PM (3 days ago) Jul 20
to Bailey Myers-Morgan, Code Review Nudger, android-bu...@system.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org, David Worsham, Robert Kroeger, emi...@google.com, fuchsia...@chromium.org, ozone-...@chromium.org, spang...@chromium.org
Attention needed from Bailey Myers-Morgan

David Song voted and added 1 comment

Votes added by David Song

Code-Review+1

1 comment

File ui/ozone/platform/flatland/flatland_sysmem_buffer_manager.cc
Line 128, Patchset 6:void FlatlandSysmemBufferManager::RegisterCollection(
Bailey Myers-Morgan . resolved

PTAL here--I switched this back to `void` since the `bool` return didn't actually address the TOCTOU issue. Let me know if I'm missing something, but I think the early return should work the same as `return False`.

David Song

Agreed on switching back to `void` here. We can go further and `CHECK` our invariant that the `koid` is present in the `collections_` map as `nullptr`.

Bailey Myers-Morgan

That's a clever idea. Could you quickly PTAL at this change (patchset 6 to 7)? I'm pretty unfamiliar with CHECKs so I want to make sure I replaced the right thing. 😊

David Song

LGTM.

Open in Gerrit

Related details

Attention is currently required from:
  • Bailey Myers-Morgan
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • 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: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I99082dcdf4c197395444de17876714abf26568a2
    Gerrit-Change-Number: 8076918
    Gerrit-PatchSet: 8
    Gerrit-Owner: Bailey Myers-Morgan <bmyers...@google.com>
    Gerrit-Reviewer: Bailey Myers-Morgan <bmyers...@google.com>
    Gerrit-Reviewer: David Song <winter...@google.com>
    Gerrit-CC: Code Review Nudger <android-build...@prod.google.com>
    Gerrit-CC: David Worsham <dwor...@google.com>
    Gerrit-CC: Robert Kroeger <rjkr...@chromium.org>
    Gerrit-Attention: Bailey Myers-Morgan <bmyers...@google.com>
    Gerrit-Comment-Date: Mon, 20 Jul 2026 21:51:13 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    open
    diffy

    Bailey Myers-Morgan (Gerrit)

    unread,
    Jul 20, 2026, 5:51:58 PM (3 days ago) Jul 20
    to Bailey Myers-Morgan, David Song, Code Review Nudger, android-bu...@system.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org, David Worsham, Robert Kroeger, emi...@google.com, fuchsia...@chromium.org, ozone-...@chromium.org, spang...@chromium.org

    Bailey Myers-Morgan voted Commit-Queue+2

    Commit-Queue+2
    Open in Gerrit

    Related details

    Attention set is empty
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • 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: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I99082dcdf4c197395444de17876714abf26568a2
    Gerrit-Change-Number: 8076918
    Gerrit-PatchSet: 8
    Gerrit-Owner: Bailey Myers-Morgan <bmyers...@google.com>
    Gerrit-Reviewer: Bailey Myers-Morgan <bmyers...@google.com>
    Gerrit-Reviewer: David Song <winter...@google.com>
    Gerrit-CC: Code Review Nudger <android-build...@prod.google.com>
    Gerrit-CC: David Worsham <dwor...@google.com>
    Gerrit-CC: Robert Kroeger <rjkr...@chromium.org>
    Gerrit-Comment-Date: Mon, 20 Jul 2026 21:51:47 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    open
    diffy

    Bailey Myers-Morgan (Gerrit)

    unread,
    Jul 20, 2026, 6:45:14 PM (3 days ago) Jul 20
    to Bailey Myers-Morgan, David Song, Code Review Nudger, android-bu...@system.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org, David Worsham, Robert Kroeger, emi...@google.com, fuchsia...@chromium.org, ozone-...@chromium.org, spang...@chromium.org

    Bailey Myers-Morgan voted Commit-Queue+2

    Commit-Queue+2
    Open in Gerrit

    Related details

    Attention set is empty
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • 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: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I99082dcdf4c197395444de17876714abf26568a2
    Gerrit-Change-Number: 8076918
    Gerrit-PatchSet: 9
    Gerrit-Owner: Bailey Myers-Morgan <bmyers...@google.com>
    Gerrit-Reviewer: Bailey Myers-Morgan <bmyers...@google.com>
    Gerrit-Reviewer: David Song <winter...@google.com>
    Gerrit-CC: Code Review Nudger <android-build...@prod.google.com>
    Gerrit-CC: David Worsham <dwor...@google.com>
    Gerrit-CC: Robert Kroeger <rjkr...@chromium.org>
    Gerrit-Comment-Date: Mon, 20 Jul 2026 22:45:01 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    open
    diffy

    Chromium LUCI CQ (Gerrit)

    unread,
    Jul 20, 2026, 7:40:41 PM (3 days ago) Jul 20
    to Bailey Myers-Morgan, David Song, Code Review Nudger, android-bu...@system.gserviceaccount.com, chromium...@chromium.org, David Worsham, Robert Kroeger, emi...@google.com, fuchsia...@chromium.org, ozone-...@chromium.org, spang...@chromium.org

    Chromium LUCI CQ submitted the change with unreviewed changes

    Unreviewed changes

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

    ```
    The name of the file: ui/ozone/platform/flatland/flatland_sysmem_buffer_manager_unittest.cc
    Insertions: 6, Deletions: 1.

    @@ -31,6 +31,11 @@
    it->second.get() == collection_ptr;
    }

    + void RegisterCollectionDirect(
    + scoped_refptr<FlatlandSysmemBufferCollection> collection) {
    + manager_.RegisterCollection(std::move(collection));
    + }
    +
    void ClearCollections() {
    base::AutoLock auto_lock(manager_.collections_lock_);
    manager_.collections_.clear();
    @@ -60,7 +65,7 @@
    ASSERT_EQ(collection_a->id(), collection_b->id());

    EXPECT_TRUE(RegisterCollection(collection_a));
    - EXPECT_DEATH(manager_.RegisterCollection(collection_b), "");
    + EXPECT_DEATH(RegisterCollectionDirect(collection_b), "");

    // The first registered collection must remain in the registry; a second
    // collection with the same id must not displace it.
    ```

    Change information

    Commit message:
    [fuchsia] Reject duplicate sysmem buffer collection ids

    FlatlandSysmemBufferManager keys its collection registry by the koid of
    the caller-supplied eventpair. Registering a second collection that uses
    a duplicate of an already-registered handle would overwrite the existing
    map entry, dropping the manager's reference to the original collection
    while its handle watch remained armed.

    ImportSysmemBufferCollection() now rejects handles whose koid is already
    registered, and RegisterCollection() uses insert() semantics so an
    existing entry is never displaced.

    FlatlandSysmemBufferCollection::OnZxHandleSignalled() now moves its
    release callbacks to the stack before running them instead of taking a
    self reference, so it never touches the refcount of an object whose last
    reference may already have been released.
    Bug: 513403082
    Change-Id: I99082dcdf4c197395444de17876714abf26568a2
    Commit-Queue: Bailey Myers-Morgan <bmyers...@google.com>
    Reviewed-by: David Song <winter...@google.com>
    Cr-Commit-Position: refs/heads/main@{#1665026}
    Files:
    • M ui/ozone/platform/flatland/BUILD.gn
    • M ui/ozone/platform/flatland/flatland_sysmem_buffer_collection.cc
    • M ui/ozone/platform/flatland/flatland_sysmem_buffer_manager.cc
    • M ui/ozone/platform/flatland/flatland_sysmem_buffer_manager.h
    • A ui/ozone/platform/flatland/flatland_sysmem_buffer_manager_unittest.cc
    Change size: M
    Delta: 5 files changed, 121 insertions(+), 21 deletions(-)
    Branch: refs/heads/main
    Submit Requirements:
    • requirement satisfiedCode-Review: +1 by David Song
    Open in Gerrit
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: merged
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I99082dcdf4c197395444de17876714abf26568a2
    Gerrit-Change-Number: 8076918
    Gerrit-PatchSet: 10
    Gerrit-Owner: Bailey Myers-Morgan <bmyers...@google.com>
    Gerrit-Reviewer: Bailey Myers-Morgan <bmyers...@google.com>
    Gerrit-Reviewer: Chromium LUCI CQ <chromiu...@luci-project-accounts.iam.gserviceaccount.com>
    Gerrit-Reviewer: David Song <winter...@google.com>
    open
    diffy
    satisfied_requirement
    Reply all
    Reply to author
    Forward
    0 new messages