PA: Zap infinite-quarantined memory regions with their class specific key. [chromium/src : main]

1 view
Skip to first unread message

Takashi Sakamoto (Gerrit)

unread,
May 28, 2026, 3:33:31 AM (8 days ago) May 28
to Keishi Hattori, Stephen Nusko, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, chromium...@chromium.org, Kentaro Hara, kinuko...@chromium.org, blink-...@chromium.org, blink-re...@chromium.org, bartek...@chromium.org, gavinp...@chromium.org, lize...@chromium.org, lizeb...@chromium.org, wfh+...@chromium.org
Attention needed from Keishi Hattori and Stephen Nusko

Takashi Sakamoto added 2 comments

Patchset-level comments
File-level comment, Patchset 17 (Latest):
Takashi Sakamoto . resolved

Would you review this CL?

File base/memory/advanced_memory_safety_checks.h
Line 112, Patchset 6: static constexpr uint32_t kTypeId = [] { \
Stephen Nusko . resolved

You'll want a more namespaced variable name I think. Something like kPartitionAllocSanitizedObjectTypeId?

Takashi Sakamoto

Done

Open in Gerrit

Related details

Attention is currently required from:
  • Keishi Hattori
  • Stephen Nusko
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: I479762c9d07fbf56531d9c4d1755c8bbb0bbf3ba
Gerrit-Change-Number: 7785069
Gerrit-PatchSet: 17
Gerrit-Owner: Takashi Sakamoto <ta...@google.com>
Gerrit-Reviewer: Keishi Hattori <kei...@chromium.org>
Gerrit-Reviewer: Takashi Sakamoto <ta...@google.com>
Gerrit-CC: Kentaro Hara <har...@chromium.org>
Gerrit-CC: Stephen Nusko <nus...@chromium.org>
Gerrit-Attention: Stephen Nusko <nus...@chromium.org>
Gerrit-Attention: Keishi Hattori <kei...@chromium.org>
Gerrit-Comment-Date: Thu, 28 May 2026 07:33:21 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Stephen Nusko <nus...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Keishi Hattori (Gerrit)

unread,
May 29, 2026, 1:27:39 AM (7 days ago) May 29
to Takashi Sakamoto, Stephen Nusko, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, chromium...@chromium.org, Kentaro Hara, kinuko...@chromium.org, blink-...@chromium.org, blink-re...@chromium.org, bartek...@chromium.org, gavinp...@chromium.org, lize...@chromium.org, lizeb...@chromium.org, wfh+...@chromium.org
Attention needed from Stephen Nusko and Takashi Sakamoto

Keishi Hattori voted and added 2 comments

Votes added by Keishi Hattori

Code-Review+1

2 comments

Patchset-level comments
Keishi Hattori . resolved

LGTM

File base/memory/advanced_memory_safety_checks_hash.h
Line 92, Patchset 17 (Latest): // And everything else is just empyt padding.
Keishi Hattori . unresolved

typo

Open in Gerrit

Related details

Attention is currently required from:
  • Stephen Nusko
  • Takashi Sakamoto
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not 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: I479762c9d07fbf56531d9c4d1755c8bbb0bbf3ba
    Gerrit-Change-Number: 7785069
    Gerrit-PatchSet: 17
    Gerrit-Owner: Takashi Sakamoto <ta...@google.com>
    Gerrit-Reviewer: Keishi Hattori <kei...@chromium.org>
    Gerrit-Reviewer: Takashi Sakamoto <ta...@google.com>
    Gerrit-CC: Kentaro Hara <har...@chromium.org>
    Gerrit-CC: Stephen Nusko <nus...@chromium.org>
    Gerrit-Attention: Stephen Nusko <nus...@chromium.org>
    Gerrit-Attention: Takashi Sakamoto <ta...@google.com>
    Gerrit-Comment-Date: Fri, 29 May 2026 05:27:17 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Takashi Sakamoto (Gerrit)

    unread,
    May 29, 2026, 1:41:47 AM (7 days ago) May 29
    to Keishi Hattori, Stephen Nusko, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, chromium...@chromium.org, Kentaro Hara, kinuko...@chromium.org, blink-...@chromium.org, blink-re...@chromium.org, bartek...@chromium.org, gavinp...@chromium.org, lize...@chromium.org, lizeb...@chromium.org, wfh+...@chromium.org
    Attention needed from Stephen Nusko

    Takashi Sakamoto added 2 comments

    Patchset-level comments
    File-level comment, Patchset 18 (Latest):
    Takashi Sakamoto . resolved

    Thank you for the review.

    File base/memory/advanced_memory_safety_checks_hash.h
    Line 92, Patchset 17: // And everything else is just empyt padding.
    Keishi Hattori . resolved

    typo

    Takashi Sakamoto

    Done

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Stephen Nusko
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not 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: I479762c9d07fbf56531d9c4d1755c8bbb0bbf3ba
    Gerrit-Change-Number: 7785069
    Gerrit-PatchSet: 18
    Gerrit-Owner: Takashi Sakamoto <ta...@google.com>
    Gerrit-Reviewer: Keishi Hattori <kei...@chromium.org>
    Gerrit-Reviewer: Takashi Sakamoto <ta...@google.com>
    Gerrit-CC: Kentaro Hara <har...@chromium.org>
    Gerrit-CC: Stephen Nusko <nus...@chromium.org>
    Gerrit-Attention: Stephen Nusko <nus...@chromium.org>
    Gerrit-Comment-Date: Fri, 29 May 2026 05:41:34 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Keishi Hattori <kei...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Takashi Sakamoto (Gerrit)

    unread,
    May 29, 2026, 1:42:08 AM (7 days ago) May 29
    to Greg Thompson, Keishi Hattori, Stephen Nusko, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, chromium...@chromium.org, Kentaro Hara, kinuko...@chromium.org, blink-...@chromium.org, blink-re...@chromium.org, bartek...@chromium.org, gavinp...@chromium.org, lize...@chromium.org, lizeb...@chromium.org, wfh+...@chromium.org
    Attention needed from Greg Thompson and Stephen Nusko

    Takashi Sakamoto added 1 comment

    Patchset-level comments
    Takashi Sakamoto . resolved

    grt@, would you review this CL?

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Greg Thompson
    • Stephen Nusko
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not 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: I479762c9d07fbf56531d9c4d1755c8bbb0bbf3ba
    Gerrit-Change-Number: 7785069
    Gerrit-PatchSet: 18
    Gerrit-Owner: Takashi Sakamoto <ta...@google.com>
    Gerrit-Reviewer: Greg Thompson <g...@chromium.org>
    Gerrit-Reviewer: Keishi Hattori <kei...@chromium.org>
    Gerrit-Reviewer: Takashi Sakamoto <ta...@google.com>
    Gerrit-CC: Kentaro Hara <har...@chromium.org>
    Gerrit-CC: Stephen Nusko <nus...@chromium.org>
    Gerrit-Attention: Stephen Nusko <nus...@chromium.org>
    Gerrit-Attention: Greg Thompson <g...@chromium.org>
    Gerrit-Comment-Date: Fri, 29 May 2026 05:41:55 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Greg Thompson (Gerrit)

    unread,
    May 29, 2026, 3:11:12 AM (7 days ago) May 29
    to Takashi Sakamoto, Keishi Hattori, Stephen Nusko, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, chromium...@chromium.org, Kentaro Hara, kinuko...@chromium.org, blink-...@chromium.org, blink-re...@chromium.org, bartek...@chromium.org, gavinp...@chromium.org, lize...@chromium.org, lizeb...@chromium.org, wfh+...@chromium.org
    Attention needed from Stephen Nusko and Takashi Sakamoto

    Greg Thompson added 11 comments

    Patchset-level comments
    Greg Thompson . resolved

    Hi. I stopped reviewing once I noticed that we're only using the first 32 bits of the MD5 hash digest. See my comment about this on line 249 of base/memory/advanced_memory_safety_checks_hash.h. I suggest two simpler alternatives there. What do you think about changing the algorithm?

    Commit Message
    Line 7, Patchset 18 (Latest):PA: Zap infinite-quarantined memory regions with their class specific key.
    Greg Thompson . unresolved
    File base/memory/advanced_memory_safety_checks.h
    Line 103, Patchset 18 (Latest): constexpr uint32_t kHash = \
    base::internal::MD5Hash32Constexpr(__PRETTY_FUNCTION__); \
    return kHash; \
    Greg Thompson . unresolved
    can this be simplified to:
    ```
    return base::internal::MD5Hash32Constexpr(__PRETTY_FUNCTION__);
    ```
    ?
    File base/memory/advanced_memory_safety_checks_hash.h
    Line 250, Patchset 18 (Latest): return internal::MD5CE::Hash32(string);
    Greg Thompson . unresolved

    nit: omit `internal::`

    Line 249, Patchset 18 (Latest):constexpr uint32_t MD5Hash32Constexpr(std::string_view string) {
    Greg Thompson . unresolved

    it's a bit confusing that this function doesn't return an MD5 hash digest. if we're only using the first 32 bits of the digest, why are we using MD5?

    have you considered MurmurHash3 (example: https://source.chromium.org/chromium/chromium/src/+/main:components/safe_browsing/content/renderer/phishing_classifier/murmurhash3_util.cc) or FNV-1a (example: https://source.chromium.org/chromium/chromium/src/+/main:third_party/perfetto/include/perfetto/tracing/internal/fnv1a.h)?

    Line 249, Patchset 18 (Latest):constexpr uint32_t MD5Hash32Constexpr(std::string_view string) {
    Greg Thompson . unresolved

    could we use `base::span<const uint8_t>` rather than `std::string_view`? callers can use `base::byte_span_from_cstring()`, `base::as_bytes()`, or `base::as_byte_span()` depending on what they want to compute a hash digest over.

    in either case, please #include either <string_view> or "base/containers/span.h" depending on which way you go.

    Line 236, Patchset 18 (Latest): return ((a & 0xff) << 24) | (((a >> 8) & 0xff) << 16) |
    Greg Thompson . unresolved

    we have `ExtractByte` above. could we use that here rather than sort of reimplementing it? i would hope that the compiler is smart enough to optimize down to more-or-less the same thing. or do you find otherwise?

    Line 218, Patchset 18 (Latest): const uint32_t m =
    Greg Thompson . unresolved

    https://google.github.io/styleguide/cppguide.html#General_Naming_Rules says we generally shouldn't abbreviate. `padded_length` would be a good name for this.

    Line 65, Patchset 18 (Latest): return (((n + 1 + 8) + 63) / 64) * 64;
    Greg Thompson . unresolved
    Line 20, Patchset 18 (Latest):struct MD5CE {
    Greg Thompson . unresolved

    the style guide says ["Do not use a class simply to group static members"](https://google.github.io/styleguide/cppguide.html#Nonmember,_Static_Member,_and_Global_Functions). a namespace (with `inline constexpr` for the constants) would suffice.

    Greg Thompson . unresolved

    please add a unit test for this that at least validates the test vectors from RFC 1321 in appendix [A.5](https://datatracker.ietf.org/doc/html/rfc1321#appendix-A.5). the ones from [RFC 2202](https://datatracker.ietf.org/doc/html/rfc2202#section-2) would be great, too. and NIST has some test vectors [here](https://www.nist.gov/itl/ssd/software-quality-group/nsrl-test-data).

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Stephen Nusko
    • Takashi Sakamoto
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not 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: I479762c9d07fbf56531d9c4d1755c8bbb0bbf3ba
    Gerrit-Change-Number: 7785069
    Gerrit-PatchSet: 18
    Gerrit-Owner: Takashi Sakamoto <ta...@google.com>
    Gerrit-Reviewer: Greg Thompson <g...@chromium.org>
    Gerrit-Reviewer: Keishi Hattori <kei...@chromium.org>
    Gerrit-Reviewer: Takashi Sakamoto <ta...@google.com>
    Gerrit-CC: Kentaro Hara <har...@chromium.org>
    Gerrit-CC: Stephen Nusko <nus...@chromium.org>
    Gerrit-Attention: Stephen Nusko <nus...@chromium.org>
    Gerrit-Attention: Takashi Sakamoto <ta...@google.com>
    Gerrit-Comment-Date: Fri, 29 May 2026 07:10:51 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy
    Reply all
    Reply to author
    Forward
    0 new messages