crashpad: Introduce a read-only mode for crashpad databases and settings [crashpad/crashpad : main]

3 views
Skip to first unread message

Joshua Pawlicki (Gerrit)

unread,
Oct 7, 2025, 5:02:19 PM (6 days ago) Oct 7
to Mark Mentovai, Crashpad LUCI CQ, crashp...@chromium.org
Attention needed from Mark Mentovai

Joshua Pawlicki voted and added 3 comments

Votes added by Joshua Pawlicki

Commit-Queue+1

3 comments

Patchset-level comments
File-level comment, Patchset 1:
Joshua Pawlicki . unresolved

Mark, PTAL.

On one hand, this wound up being not that bad.

On the other hand, as I progressed, I realized that really the databases can barely do anything at all in read-only mode; _generic is probably the worst, since it will do things like cleaning the database during a read operation if the report data is corrupt. Basically the only thing that is left is getting a (read-only) settings object, at which point maybe it's more sensible to just create a GetReadOnlySettings method on the existing objects (or as a static method, to dodge the directory creation issue mentioned in a comment below).

File client/crash_report_database.h
Line 283, Patchset 2 (Latest): //! not yet exist, it will not be created. Note that for databases
//! implemented as directory structures, existence refers to the existence
//! of both the outermost directory and the inner directory structure.
Joshua Pawlicki . unresolved

This was easier to implement and might be what the users of this function really want, but it is an API change, so flagging that. If we don't want to take that change, then each of the Initialize functions could choose a pair of ensure/create directory functions (one for the outer, one for the inner), or maybe you have a better idea.

Line 285, Patchset 1:CrashReportDatabaseMac::CrashReportDatabaseMac(const base::FilePath& path,
Joshua Pawlicki . unresolved

TODO: add test coverage of all the database operations in a read-only mode, after we re-sync on whether this is the right direction in the first place.

Open in Gerrit

Related details

Attention is currently required from:
  • Mark Mentovai
Submit Requirements:
  • 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: crashpad/crashpad
Gerrit-Branch: main
Gerrit-Change-Id: I9efae2427f82d9a092d12cb1bc3b61da71d6caac
Gerrit-Change-Number: 7017459
Gerrit-PatchSet: 2
Gerrit-Owner: Joshua Pawlicki <waf...@chromium.org>
Gerrit-Reviewer: Joshua Pawlicki <waf...@chromium.org>
Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
Gerrit-Attention: Mark Mentovai <ma...@chromium.org>
Gerrit-Comment-Date: Tue, 07 Oct 2025 20:55:23 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
unsatisfied_requirement
open
diffy

Mark Mentovai (Gerrit)

unread,
Oct 8, 2025, 11:55:02 AM (5 days ago) Oct 8
to Joshua Pawlicki, Crashpad LUCI CQ, crashp...@chromium.org
Attention needed from Joshua Pawlicki

Mark Mentovai added 7 comments

Patchset-level comments
Joshua Pawlicki . unresolved

Mark, PTAL.

On one hand, this wound up being not that bad.

On the other hand, as I progressed, I realized that really the databases can barely do anything at all in read-only mode; _generic is probably the worst, since it will do things like cleaning the database during a read operation if the report data is corrupt. Basically the only thing that is left is getting a (read-only) settings object, at which point maybe it's more sensible to just create a GetReadOnlySettings method on the existing objects (or as a static method, to dodge the directory creation issue mentioned in a comment below).

Mark Mentovai

Mark, PTAL.

On one hand, this wound up being not that bad.

On the other hand, as I progressed, I realized that really the databases can barely do anything at all in read-only mode; _generic is probably the worst, since it will do things like cleaning the database during a read operation if the report data is corrupt. Basically the only thing that is left is getting a (read-only) settings object, at which point maybe it's more sensible to just create a GetReadOnlySettings method on the existing objects (or as a static method, to dodge the directory creation issue mentioned in a comment below).

I feel this concern too. I had the same thought as I was reading through it. Something like

`static CrashReportDatabase::GetReadOnlySettingsForDatabase(const FilePath &);`

?

The “databases can barely do anything at all in read-only mode; _generic is probably the worst” is what tipped this in my mind.

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

Hmm, I see.

What

File client/crash_report_database.h
Line 283, Patchset 2: //! not yet exist, it will not be created. Note that for databases

//! implemented as directory structures, existence refers to the existence
//! of both the outermost directory and the inner directory structure.
Joshua Pawlicki . unresolved

This was easier to implement and might be what the users of this function really want, but it is an API change, so flagging that. If we don't want to take that change, then each of the Initialize functions could choose a pair of ensure/create directory functions (one for the outer, one for the inner), or maybe you have a better idea.

Mark Mentovai

This was easier to implement and might be what the users of this function really want, but it is an API change, so flagging that. If we don't want to take that change, then each of the Initialize functions could choose a pair of ensure/create directory functions (one for the outer, one for the inner), or maybe you have a better idea.

If we’re going to do the `static GetReadOnlySettingsForDatabase` thing, I think we leave this alone _in this change_. You may be right and we may still want to make the change, but at that point it’d be fully decoupled from this and we’d be best off considering it in isolation.

File client/crash_report_database_generic.cc
Line 279, Patchset 4 (Latest): const bool read_only_;
Mark Mentovai . unresolved

`bool` goes toward the end for better struct packing. Here, it would go after `settings_init_`. Applies to all CrashReportDatabase implementations.

File client/settings.cc
Line 195, Patchset 4 (Latest): return false;
Mark Mentovai . unresolved

Gotta `LOG(ERROR)` this and all others to adhere to the documented behavior.

Line 320, Patchset 4 (Latest): return MakeScopedLockedFileHandle(options, FileLocking::kShared, file_path());
Mark Mentovai . unresolved

In the context of what we’re trying to fix, the user that runs this can still `flock(…, LOCK_SH)` any file that it has access to?

Line 359, Patchset 4 (Latest): ScopedLockedFileHandle handle;
Mark Mentovai . unresolved

I would move the `read_only` bar and associated `LOG(ERROR)` here. This will cover the two setters that we have now, and also be much more likely to catch future setters.

Open in Gerrit

Related details

Attention is currently required from:
  • Joshua Pawlicki
Submit Requirements:
  • 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: crashpad/crashpad
Gerrit-Branch: main
Gerrit-Change-Id: I9efae2427f82d9a092d12cb1bc3b61da71d6caac
Gerrit-Change-Number: 7017459
Gerrit-PatchSet: 4
Gerrit-Owner: Joshua Pawlicki <waf...@chromium.org>
Gerrit-Reviewer: Joshua Pawlicki <waf...@chromium.org>
Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
Gerrit-Attention: Joshua Pawlicki <waf...@chromium.org>
Gerrit-Comment-Date: Wed, 08 Oct 2025 15:55:00 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Joshua Pawlicki <waf...@chromium.org>
unsatisfied_requirement
open
diffy

Mark Mentovai (Gerrit)

unread,
Oct 10, 2025, 5:13:56 PM (3 days ago) Oct 10
to Joshua Pawlicki, Crashpad LUCI CQ, crashp...@chromium.org
Attention needed from Joshua Pawlicki

Mark Mentovai added 1 comment

Patchset-level comments
Mark Mentovai . resolved
Open in Gerrit

Related details

Attention is currently required from:
  • Joshua Pawlicki
Submit Requirements:
  • 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: crashpad/crashpad
Gerrit-Branch: main
Gerrit-Change-Id: I9efae2427f82d9a092d12cb1bc3b61da71d6caac
Gerrit-Change-Number: 7017459
Gerrit-PatchSet: 4
Gerrit-Owner: Joshua Pawlicki <waf...@chromium.org>
Gerrit-Reviewer: Joshua Pawlicki <waf...@chromium.org>
Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
Gerrit-Attention: Joshua Pawlicki <waf...@chromium.org>
Gerrit-Comment-Date: Fri, 10 Oct 2025 21:13:54 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
unsatisfied_requirement
open
diffy
Reply all
Reply to author
Forward
0 new messages