How do I use the Crashpad sanitization options?

94 views
Skip to first unread message

Matthew Spelman

unread,
Feb 7, 2022, 2:10:38 PM2/7/22
to Crashpad-dev
I've been looking at the code under third_party/crashpad/crashpad/snapshot/sanitized and it looks interesting, but I haven't been able to find any examples or detailed documentation about how to integrate its functions into existing Crashpad usage. I am currently using CrashpadClient::StartHandler(...) to generate a crash report, but it's not clear to me how I can configure the generation of the reports with sanitization options. Thanks!

Joshua Peraza

unread,
Feb 8, 2022, 2:38:57 PM2/8/22
to Matthew Spelman, Crashpad-dev
Crashpad's sanitization logic is only fully hooked up on Android, but shouldn't be too much work to hook it up for other platforms.

At a high level, the client process (your application) creates a SanitzationInformation struct describing the sanitzation configuration and communicates the address of the struct to the crashpad handler process. When a crash happens, the handler reads the struct from your client process and sanitizes the dump accordingly.

On Android, the struct address is communicated either in a message the client sends to the handler when it requests a dump or on the command line to crashpad_handler, but this is only because of particular requirements for Android and WebView.

To plumb this out for other platforms, I'd suggest adding a CrashpadInfo::set_sanitzation_info_address() and make sure to update the CrashpadInfoReader. Then, for Linux, you should be able to get the address from a CrashpadInfoClientOptions here and use it to configure sanitization just below that. Other platforms have similar code under hander/<platform>/crash_report_exception_handler.cc but need a little more of the logic that's already there for Linux.


On Mon, Feb 7, 2022 at 11:10 AM Matthew Spelman <mjs...@gmail.com> wrote:
I've been looking at the code under third_party/crashpad/crashpad/snapshot/sanitized and it looks interesting, but I haven't been able to find any examples or detailed documentation about how to integrate its functions into existing Crashpad usage. I am currently using CrashpadClient::StartHandler(...) to generate a crash report, but it's not clear to me how I can configure the generation of the reports with sanitization options. Thanks!

--
You received this message because you are subscribed to the Google Groups "Crashpad-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to crashpad-dev...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/crashpad-dev/eb3607a9-e207-4a82-847d-0064a06f2328n%40chromium.org.
Reply all
Reply to author
Forward
0 new messages