Skip to content

aosp: Fix the crash handler startup - #12916

Merged
hlwarriner merged 5 commits into
youtube:mainfrom
ogarai:yts/fix_crashpad_handler_trampoline
Oct 12, 2026
Merged

hlwarriner merged 5 commits into
youtube:mainfrom
ogarai:yts/fix_crashpad_handler_trampoline

Conversation

@ogarai

@ogarai ogarai commented Sep 24, 2026 •

Copy link
Copy Markdown
Collaborator

On AOSP the crashpad handler never ran. The loader looked for the wrong
file name under a hardcoded arm/ directory, and the exec'd handler
couldn't load libc++_shared.so. Uploads would also have failed, because
the handler was pointed at CA certificates inside the APK.

Package the base crashpad_handler, as other Evergreen platforms do, with
libc++ linked statically. Exec it from the native library directory, as
in C25. At startup, copy the CA certificates out of the APK into the
cache directory and pass that copy to the handler, also as in C25.

Test: On device, a crash starts the handler, which writes a minidump
and uploads it. Both Evergreen System Image native stability yts tests
pass. The crash handler yts test finds the uploaded report and then
fails on symbolization.

Co-authored-by: Henrique Ferreiro hferreiro@igalia.com

Bug: 532158865

@github-actions

Copy link
Copy Markdown
Contributor

🤖 Gemini Suggested Commit Message


android: Launch crashpad handler via the linker

The crashpad handler on AOSP was failing to run due to incorrect file
path resolution and the inability to load shared libraries.
Furthermore, certificate validation for uploads failed because the
handler was directed to certificates within the APK instead of the
system store.

Update the launch mechanism to use the system linker, which ensures
the necessary library environment is established and uses the system
CA store. This path is restricted to Android Q and later, matching
the requirements of the Android TV implementation.

Bug: 532158865

💡 Pro Tips for a Better Commit Message:

  1. Influence the Result: Want to change the output? You can write custom prompts or instructions directly in the Pull Request description. The model uses that text to generate the message.
  2. Re-run the Generator: Post a comment with: /generate-commit-message
@github-actions

github-actions Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor
Context State Description
CI / All Pass ⏳ PENDING Checks are running
CI / android ⏳ PENDING Checks are running
CI / evergreen ⏳ PENDING Checks are running
CI / linux ⏳ PENDING Checks are running
CI / tvos ⏳ PENDING Checks are running

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces Android support for the Crashpad handler, enabling it to run via the system linker on Android Q and later, and dynamically building the environment with LD_LIBRARY_PATH. The review feedback suggests adding a defensive null check for the global environ pointer in BuildHandlerEnvironment to prevent potential dereferencing issues. Additionally, it notes that the preprocessor conditional branches in crashpad_client_linux.cc are identical and should be simplified.

Comment thread starboard/crashpad_wrapper/wrapper.cc Resolved
@andrewsavage1

Copy link
Copy Markdown
Contributor

On AOSP the crashpad handler never ran. The loader looked for the wrong file name under a hardcoded arm/ directory, and the exec'd handler couldn't load libc++_shared.so. Uploads would also have failed, because the handler was pointed at CA certificates inside the APK.

@ogarai are you saying it never ran for Cobalt 25 or in the current Cobalt 27 build?

@hlwarriner can you help review this approach?

@ogarai

ogarai commented Sep 25, 2026

Copy link
Copy Markdown
Collaborator Author

On AOSP the crashpad handler never ran. The loader looked for the wrong file name under a hardcoded arm/ directory, and the exec'd handler couldn't load libc++_shared.so. Uploads would also have failed, because the handler was pointed at CA certificates inside the APK.

@ogarai are you saying it never ran for Cobalt 25 or in the current Cobalt 27 build?

I meant Cobalt 27, I suspect it worked fine in Cobalt 25 because the handler path and the CA certs matched how the APK was packaged before, so they needed updating in Cobalt 27 to the current expected locations.

@hlwarriner

Copy link
Copy Markdown
Member

On AOSP the crashpad handler never ran. The loader looked for the wrong file name under a hardcoded arm/ directory, and the exec'd handler couldn't load libc++_shared.so. Uploads would also have failed, because the handler was pointed at CA certificates inside the APK.

@ogarai are you saying it never ran for Cobalt 25 or in the current Cobalt 27 build?

@hlwarriner can you help review this approach?

It looks like some significant changes are made to how we package and run the Crashpad handler on AOSP vs. in C25. I want to take a closer look and try a local build, and will reply early next week with comments.

@hferreiro

Copy link
Copy Markdown
Collaborator

Hey, I had been working on this and pushed a version of this fix here: 472b646.

@ogarai feel free to pick whatever it makes sense from that commit. In particular, @andrewsavage1 confirmed that partner toolchains should be using crashpad_handler instead of chrome_crashpad_handler.

@hlwarriner hlwarriner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay but I've left a few comments about concerns I have with the approach.

As a higher level comment, I would in general suggest that we package and run the Crashpad handler similarly to how we did in C25. If there are compelling reasons to change the approach then I think a short doc explaining the changes at a high level would be very helpful.

Comment thread starboard/crashpad_wrapper/wrapper.cc Resolved
Comment thread starboard/crashpad_wrapper/wrapper.cc Resolved
Comment thread starboard/crashpad_wrapper/wrapper.cc Resolved
@hlwarriner

Copy link
Copy Markdown
Member

CC @alunev as FYI

@ogarai
ogarai force-pushed the yts/fix_crashpad_handler_trampoline branch from bdda9c8 to dbe70a1 Compare October 5, 2026 16:54
@ogarai

ogarai commented Oct 5, 2026

Copy link
Copy Markdown
Collaborator Author

Hey, I had been working on this and pushed a version of this fix here: 472b646.

@ogarai feel free to pick whatever it makes sense from that commit. In particular, @andrewsavage1 confirmed that partner toolchains should be using crashpad_handler instead of chrome_crashpad_handler.

Done. I've applied your approach on this PR. Thanks!

@ogarai ogarai changed the title aosp: Launch the crash handler via the linker Oct 5, 2026
@ogarai

ogarai commented Oct 5, 2026

Copy link
Copy Markdown
Collaborator Author

@hlwarriner @hferreiro I've incorporated 472b646 and ported the c25 certs logic. PTAL

ogarai added 3 commits October 7, 2026 11:51
On AOSP the crashpad handler never ran. The loader looked for the wrong
file name under a hardcoded arm/ directory, and the exec'd handler
couldn't load libc++_shared.so. Uploads would also have failed, because
the handler was pointed at CA certificates inside the APK.

Launch it through /system/bin/linker, which Android TV added in youtube#9637,
with the library directory only in the handler's environment. This path
uses the Android system CA store. Like Android TV, it needs Android Q.

Test: On device, a crash starts the handler, which writes a minidump
and uploads it. With youtube#12903, the Evergreen System Image crash handler
yts test finds the uploaded report and then fails on symbolization.
Bug: 532158865
@ogarai
ogarai force-pushed the yts/fix_crashpad_handler_trampoline branch from dbe70a1 to c0e8d3e Compare October 7, 2026 15:59
@ogarai

ogarai commented Oct 7, 2026

Copy link
Copy Markdown
Collaborator Author

Gentle ping @hlwarriner @hferreiro

Comment thread starboard/crashpad_wrapper/wrapper.cc Resolved
Comment thread starboard/crashpad_wrapper/wrapper.cc Resolved
Comment thread starboard/crashpad_wrapper/wrapper.cc Resolved
@ogarai

ogarai commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator Author

@hferreiro @hlwarriner PTAL at the latest commit, thanks!

@ogarai

ogarai commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator Author

@hferreiro @hlwarriner gentle ping

@hferreiro hferreiro left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ogarai you might want to create an issue and link it in the TODO comment.

@ogarai

ogarai commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator Author

@ogarai you might want to create an issue and link it in the TODO comment.

done

@hlwarriner

Copy link
Copy Markdown
Member

@hferreiro @hlwarriner gentle ping

Thanks for making the latest round of changes. Things are extremely busy over here as we prepare for our LTS release but I'll take a final look by eod Monday at the latest.

@hlwarriner
hlwarriner self-requested a review October 12, 2026 15:09

@hlwarriner hlwarriner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will probably have some merge conflicts with #13153. This current PR can be merged first, and then I'll rebase and resolve conflicts for #13153.

@hlwarriner
hlwarriner merged commit 77e87db into youtube:main Oct 12, 2026
521 checks passed
hlwarriner added a commit to hlwarriner/cobalt that referenced this pull request Oct 12, 2026
briantting pushed a commit that referenced this pull request Oct 14, 2026
Refer to original PR: #12916

On AOSP the crashpad handler never ran. The loader looked for the wrong
file name under a hardcoded arm/ directory, and the exec'd handler
couldn't load libc++_shared.so. Uploads would also have failed, because
the handler was pointed at CA certificates inside the APK.

Package the base crashpad_handler, as other Evergreen platforms do, with
libc++ linked statically. Exec it from the native library directory, as
in C25. At startup, copy the CA certificates out of the APK into the
cache directory and pass that copy to the handler, also as in C25.

Test: On device, a crash starts the handler, which writes a minidump
and uploads it. Both Evergreen System Image native stability yts tests
pass. The crash handler yts test finds the uploaded report and then
fails on symbolization.

Co-authored-by: Henrique Ferreiro <hferreiro@igalia.com>

Bug: 532158865

(cherry picked from commit 77e87db)
briantting pushed a commit that referenced this pull request Oct 16, 2026
Refer to original PR: #12916

On AOSP the crashpad handler never ran. The loader looked for the wrong
file name under a hardcoded arm/ directory, and the exec'd handler
couldn't load libc++_shared.so. Uploads would also have failed, because
the handler was pointed at CA certificates inside the APK.

Package the base crashpad_handler, as other Evergreen platforms do, with
libc++ linked statically. Exec it from the native library directory, as
in C25. At startup, copy the CA certificates out of the APK into the
cache directory and pass that copy to the handler, also as in C25.

Test: On device, a crash starts the handler, which writes a minidump
and uploads it. Both Evergreen System Image native stability yts tests
pass. The crash handler yts test finds the uploaded report and then
fails on symbolization.

Co-authored-by: Henrique Ferreiro <hferreiro@igalia.com>

Bug: 532158865

(cherry picked from commit 77e87db)
andrewsavage1 pushed a commit that referenced this pull request Oct 16, 2026
Follow-up to #12916. On Evergreen platforms the Crashpad handler is a
separate executable that only the native toolchain builds, and the
loader launches it. The Chromium crash reporter linked into the hermetic
libcobalt.so is a stub, so the hermetic build has no use for
chrome_crashpad_handler and shouldn't build it at all.

Bug: 406511608
andrewsavage1 pushed a commit that referenced this pull request Oct 19, 2026
Since #12916, the AOSP platform
configuration applies -static-libstdc++ to every native toolchain
binary, so the per-target flag on devil_util_bin is redundant. Drop it.

Cross-reference the flag and the libunwind that
//build/config:common_deps adds for the native toolchain, since the
static libc++ doesn't link without it.

Bug: 495203133
hferreiro added a commit to hferreiro/cobalt that referenced this pull request Oct 19, 2026
Follow-up to youtube#12916. The hermetic
libcobalt.so compiled the Chromium crash reporter against Crashpad
client stubs kept in third_party only so that it would link. Crash
reporting in libcobalt.so is a no-op there: Crashpad is run by the
loader, through //starboard/crashpad_wrapper, and libcobalt.so reaches
it through Starboard extensions rather than this API. Replace the
reporter with a no-op in hermetic builds, and remove the stubs it kept
alive.

Bug: 406511608
briantting pushed a commit that referenced this pull request Oct 20, 2026
…ermetically

Refer to original PR: #13348

Follow-up to #12916. On Evergreen platforms the Crashpad handler is a
separate executable that only the native toolchain builds, and the
loader launches it. The Chromium crash reporter linked into the hermetic
libcobalt.so is a stub, so the hermetic build has no use for
chrome_crashpad_handler and shouldn't build it at all.

Bug: 406511608

(cherry picked from commit 1f9f737)
briantting pushed a commit that referenced this pull request Oct 20, 2026
Refer to original PR: #13349

Since #12916, the AOSP platform
configuration applies -static-libstdc++ to every native toolchain
binary, so the per-target flag on devil_util_bin is redundant. Drop it.

Cross-reference the flag and the libunwind that
//build/config:common_deps adds for the native toolchain, since the
static libc++ doesn't link without it.

Bug: 495203133

(cherry picked from commit c1b25e5)
briantting pushed a commit that referenced this pull request Oct 20, 2026
…ermetically

Refer to original PR: #13348

Follow-up to #12916. On Evergreen platforms the Crashpad handler is a
separate executable that only the native toolchain builds, and the
loader launches it. The Chromium crash reporter linked into the hermetic
libcobalt.so is a stub, so the hermetic build has no use for
chrome_crashpad_handler and shouldn't build it at all.

Bug: 406511608

(cherry picked from commit 1f9f737)
briantting pushed a commit that referenced this pull request Oct 20, 2026
Refer to original PR: #13349

Since #12916, the AOSP platform
configuration applies -static-libstdc++ to every native toolchain
binary, so the per-target flag on devil_util_bin is redundant. Drop it.

Cross-reference the flag and the libunwind that
//build/config:common_deps adds for the native toolchain, since the
static libc++ doesn't link without it.

Bug: 495203133

(cherry picked from commit c1b25e5)
@ogarai
ogarai deleted the yts/fix_crashpad_handler_trampoline branch November 4, 2026 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

5 participants