Migrate to __system_property_read_callback() [crashpad/crashpad : main]

12 views
Skip to first unread message

Mark Mentovai (Gerrit)

unread,
Aug 15, 2025, 5:22:12 PMAug 15
to Joshua Peraza, Crashpad LUCI CQ, crashp...@chromium.org
Attention needed from Joshua Peraza

Mark Mentovai added 1 comment

File snapshot/linux/system_snapshot_linux.cc
Line 147, Patchset 3 (Latest): __system_property_read_callback(prop, ReadPropertyCallback, &data);
Mark Mentovai . unresolved

Pointers to C++ types are flying across module boundaries here.

Are we guaranteed to be using the same C++ library with the same std::string implementation as this function, or whatever stored this data?

Open in Gerrit

Related details

Attention is currently required from:
  • Joshua Peraza
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: crashpad/crashpad
Gerrit-Branch: main
Gerrit-Change-Id: Ifc532d1caa4692b496e57af4a0455ae95604e146
Gerrit-Change-Number: 6854281
Gerrit-PatchSet: 3
Gerrit-Owner: Joshua Peraza <jpe...@chromium.org>
Gerrit-Reviewer: Joshua Peraza <jpe...@chromium.org>
Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
Gerrit-Attention: Joshua Peraza <jpe...@chromium.org>
Gerrit-Comment-Date: Fri, 15 Aug 2025 21:22:09 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Joshua Peraza (Gerrit)

unread,
Aug 19, 2025, 12:18:23 PMAug 19
to Mark Mentovai, Crashpad LUCI CQ, crashp...@chromium.org
Attention needed from Mark Mentovai

Joshua Peraza voted and added 1 comment

Votes added by Joshua Peraza

Commit-Queue+1

1 comment

File snapshot/linux/system_snapshot_linux.cc
Line 147, Patchset 3: __system_property_read_callback(prop, ReadPropertyCallback, &data);
Mark Mentovai . unresolved

Pointers to C++ types are flying across module boundaries here.

Are we guaranteed to be using the same C++ library with the same std::string implementation as this function, or whatever stored this data?

Joshua Peraza

I made updates to not use std::string in the callback.

At first I didn't see the issue. Then I thought I did. Now I'm not so sure again.

The callback, called from libc.so, needed to call value->assign(). I thought this wasn't a problem because the |value| object would have a vtable pointer it uses to find the right assign() implementation. Then I thought I saw the problem was that dynamic dispatch implementation is not part of the C++ standard. However, ReadPropertyCallback() is compiled for this module so wouldn't it still use dynamic dispatch in the same way?

Open in Gerrit

Related details

Attention is currently required from:
  • Mark Mentovai
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: crashpad/crashpad
Gerrit-Branch: main
Gerrit-Change-Id: Ifc532d1caa4692b496e57af4a0455ae95604e146
Gerrit-Change-Number: 6854281
Gerrit-PatchSet: 5
Gerrit-Owner: Joshua Peraza <jpe...@chromium.org>
Gerrit-Reviewer: Joshua Peraza <jpe...@chromium.org>
Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
Gerrit-Attention: Mark Mentovai <ma...@chromium.org>
Gerrit-Comment-Date: Tue, 19 Aug 2025 16:18:20 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: Mark Mentovai <ma...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Mark Mentovai (Gerrit)

unread,
Aug 19, 2025, 12:36:35 PMAug 19
to Joshua Peraza, Crashpad LUCI CQ, crashp...@chromium.org
Attention needed from Joshua Peraza

Mark Mentovai added 1 comment

File snapshot/linux/system_snapshot_linux.cc
Line 147, Patchset 3: __system_property_read_callback(prop, ReadPropertyCallback, &data);
Mark Mentovai . unresolved

Pointers to C++ types are flying across module boundaries here.

Are we guaranteed to be using the same C++ library with the same std::string implementation as this function, or whatever stored this data?

Joshua Peraza

I made updates to not use std::string in the callback.

At first I didn't see the issue. Then I thought I did. Now I'm not so sure again.

The callback, called from libc.so, needed to call value->assign(). I thought this wasn't a problem because the |value| object would have a vtable pointer it uses to find the right assign() implementation. Then I thought I saw the problem was that dynamic dispatch implementation is not part of the C++ standard. However, ReadPropertyCallback() is compiled for this module so wouldn't it still use dynamic dispatch in the same way?

Mark Mentovai

I made updates to not use std::string in the callback.

At first I didn't see the issue. Then I thought I did. Now I'm not so sure again.

Me neither.

I thought that the `string` itself was going to be used on the other side of a module boundary. But now I think that it’s not—you’re only passing a `string*` through the module boundary, but it’s not dereferenced to a `string` until it pops out of the other side, right into the `ReadPropertyCallback` function that’s in this module.

Now I think that patch set 3 is OK.

Open in Gerrit

Related details

Attention is currently required from:
  • Joshua Peraza
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: crashpad/crashpad
Gerrit-Branch: main
Gerrit-Change-Id: Ifc532d1caa4692b496e57af4a0455ae95604e146
Gerrit-Change-Number: 6854281
Gerrit-PatchSet: 5
Gerrit-Owner: Joshua Peraza <jpe...@chromium.org>
Gerrit-Reviewer: Joshua Peraza <jpe...@chromium.org>
Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
Gerrit-Attention: Joshua Peraza <jpe...@chromium.org>
Gerrit-Comment-Date: Tue, 19 Aug 2025 16:36:31 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Joshua Peraza <jpe...@chromium.org>
Comment-In-Reply-To: Mark Mentovai <ma...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Joshua Peraza (Gerrit)

unread,
Aug 19, 2025, 12:42:28 PMAug 19
to Mark Mentovai, Crashpad LUCI CQ, crashp...@chromium.org
Attention needed from Mark Mentovai

Joshua Peraza voted and added 1 comment

Votes added by Joshua Peraza

Commit-Queue+1

1 comment

File snapshot/linux/system_snapshot_linux.cc
Line 147, Patchset 3: __system_property_read_callback(prop, ReadPropertyCallback, &data);
Mark Mentovai . resolved

Pointers to C++ types are flying across module boundaries here.

Are we guaranteed to be using the same C++ library with the same std::string implementation as this function, or whatever stored this data?

Joshua Peraza

I made updates to not use std::string in the callback.

At first I didn't see the issue. Then I thought I did. Now I'm not so sure again.

The callback, called from libc.so, needed to call value->assign(). I thought this wasn't a problem because the |value| object would have a vtable pointer it uses to find the right assign() implementation. Then I thought I saw the problem was that dynamic dispatch implementation is not part of the C++ standard. However, ReadPropertyCallback() is compiled for this module so wouldn't it still use dynamic dispatch in the same way?

Mark Mentovai

I made updates to not use std::string in the callback.

At first I didn't see the issue. Then I thought I did. Now I'm not so sure again.

Me neither.

I thought that the `string` itself was going to be used on the other side of a module boundary. But now I think that it’s not—you’re only passing a `string*` through the module boundary, but it’s not dereferenced to a `string` until it pops out of the other side, right into the `ReadPropertyCallback` function that’s in this module.

Now I think that patch set 3 is OK.

Joshua Peraza

patch set 3 is restored!

Open in Gerrit

Related details

Attention is currently required from:
  • Mark Mentovai
Submit Requirements:
  • requirement satisfiedCode-Owners
  • 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: crashpad/crashpad
Gerrit-Branch: main
Gerrit-Change-Id: Ifc532d1caa4692b496e57af4a0455ae95604e146
Gerrit-Change-Number: 6854281
Gerrit-PatchSet: 6
Gerrit-Owner: Joshua Peraza <jpe...@chromium.org>
Gerrit-Reviewer: Joshua Peraza <jpe...@chromium.org>
Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
Gerrit-Attention: Mark Mentovai <ma...@chromium.org>
Gerrit-Comment-Date: Tue, 19 Aug 2025 16:42:25 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Mark Mentovai (Gerrit)

unread,
Aug 19, 2025, 1:41:12 PMAug 19
to Joshua Peraza, Crashpad LUCI CQ, crashp...@chromium.org
Attention needed from Joshua Peraza

Mark Mentovai voted and added 2 comments

Votes added by Mark Mentovai

Code-Review+1

2 comments

File snapshot/linux/system_snapshot_linux.cc
Line 134, Patchset 6 (Latest): data->value->assign(value);
Mark Mentovai . resolved

Bummed that the interface doesn’t make the length available, so you’re stuck feeling around in the dark for a NUL byte.

Line 149, Patchset 6 (Latest): if (!data.read || value->empty()) {
Mark Mentovai . unresolved

Are we sure about this? A 0-length property value should still be valid.

In the past, it wasn’t possible to distinguish between a missing property and a 0-length value when calling `__system_property_get`: both cases return 0, so it’s reasonable to consider that return value as signaling an error. But now that this has been split into separate `__system_property_find` and `__system_property_read_callback` steps, we should be able to differentiate easily.

Open in Gerrit

Related details

Attention is currently required from:
  • Joshua Peraza
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: crashpad/crashpad
Gerrit-Branch: main
Gerrit-Change-Id: Ifc532d1caa4692b496e57af4a0455ae95604e146
Gerrit-Change-Number: 6854281
Gerrit-PatchSet: 6
Gerrit-Owner: Joshua Peraza <jpe...@chromium.org>
Gerrit-Reviewer: Joshua Peraza <jpe...@chromium.org>
Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
Gerrit-Attention: Joshua Peraza <jpe...@chromium.org>
Gerrit-Comment-Date: Tue, 19 Aug 2025 17:41:09 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Joshua Peraza (Gerrit)

unread,
Aug 19, 2025, 2:03:16 PMAug 19
to Mark Mentovai, Crashpad LUCI CQ, crashp...@chromium.org

Joshua Peraza voted and added 1 comment

Votes added by Joshua Peraza

Commit-Queue+2

1 comment

File snapshot/linux/system_snapshot_linux.cc
Line 149, Patchset 6: if (!data.read || value->empty()) {
Mark Mentovai . resolved

Are we sure about this? A 0-length property value should still be valid.

In the past, it wasn’t possible to distinguish between a missing property and a 0-length value when calling `__system_property_get`: both cases return 0, so it’s reasonable to consider that return value as signaling an error. But now that this has been split into separate `__system_property_find` and `__system_property_read_callback` steps, we should be able to differentiate easily.

Joshua Peraza

Yeah, an empty property value does look valid.

Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: crashpad/crashpad
Gerrit-Branch: main
Gerrit-Change-Id: Ifc532d1caa4692b496e57af4a0455ae95604e146
Gerrit-Change-Number: 6854281
Gerrit-PatchSet: 7
Gerrit-Owner: Joshua Peraza <jpe...@chromium.org>
Gerrit-Reviewer: Joshua Peraza <jpe...@chromium.org>
Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
Gerrit-Comment-Date: Tue, 19 Aug 2025 18:03:12 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: Mark Mentovai <ma...@chromium.org>
satisfied_requirement
open
diffy

Mark Mentovai (Gerrit)

unread,
Aug 19, 2025, 2:03:46 PMAug 19
to Joshua Peraza, Crashpad LUCI CQ, crashp...@chromium.org
Attention needed from Joshua Peraza

Mark Mentovai voted and added 1 comment

Votes added by Mark Mentovai

Code-Review+1

1 comment

Patchset-level comments
File-level comment, Patchset 7 (Latest):
Mark Mentovai . resolved

LGTM

Open in Gerrit

Related details

Attention is currently required from:
  • Joshua Peraza
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: crashpad/crashpad
Gerrit-Branch: main
Gerrit-Change-Id: Ifc532d1caa4692b496e57af4a0455ae95604e146
Gerrit-Change-Number: 6854281
Gerrit-PatchSet: 7
Gerrit-Owner: Joshua Peraza <jpe...@chromium.org>
Gerrit-Reviewer: Joshua Peraza <jpe...@chromium.org>
Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
Gerrit-Attention: Joshua Peraza <jpe...@chromium.org>
Gerrit-Comment-Date: Tue, 19 Aug 2025 18:03:43 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
open
diffy

Crashpad LUCI CQ (Gerrit)

unread,
Aug 19, 2025, 2:13:24 PMAug 19
to Joshua Peraza, Mark Mentovai, crashp...@chromium.org

Crashpad LUCI CQ submitted the change

Change information

Commit message:
Migrate to __system_property_read_callback()

__system_property_get() is deprecated. __system_property_read_callback()
replaces it as of Android API level 26.

This change was generated using gemini-cli.
Bug: 413072681
Change-Id: Ifc532d1caa4692b496e57af4a0455ae95604e146
Commit-Queue: Joshua Peraza <jpe...@chromium.org>
Reviewed-by: Mark Mentovai <ma...@chromium.org>
Files:
  • M snapshot/linux/system_snapshot_linux.cc
Change size: S
Delta: 1 file changed, 25 insertions(+), 4 deletions(-)
Branch: refs/heads/main
Submit Requirements:
  • requirement satisfiedCode-Review: +1 by Mark Mentovai
Open in Gerrit
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: merged
Gerrit-Project: crashpad/crashpad
Gerrit-Branch: main
Gerrit-Change-Id: Ifc532d1caa4692b496e57af4a0455ae95604e146
Gerrit-Change-Number: 6854281
Gerrit-PatchSet: 8
Gerrit-Owner: Joshua Peraza <jpe...@chromium.org>
Gerrit-Reviewer: Crashpad LUCI CQ <crashpa...@luci-project-accounts.iam.gserviceaccount.com>
open
diffy
satisfied_requirement
Reply all
Reply to author
Forward
0 new messages