Commit 4e1fc60b authored by Tobias Sargeant's avatar Tobias Sargeant Committed by Commit Bot

[crash] Ensure that CrashpadHandlerMain is exported for trampoline

In the case that CrashpadHandlerMain is not an exported symbol we should
fall back to using the java crashpad launcher.

Also check that the trampoline binary exists.

Bug: 1022837
Test: manual; install a non-trichrome webview on Q, and check
Test: that a minidump is captured.
Change-Id: If397fd805a25f73aa4a54e728670d1943cb188e8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1906350Reviewed-by: default avatarRobert Sesek <rsesek@chromium.org>
Commit-Queue: Tobias Sargeant <tobiasjs@chromium.org>
Cr-Commit-Position: refs/heads/master@{#714492}
parent 0896904a
......@@ -287,8 +287,16 @@ void SetBuildInfoAnnotations(std::map<std::string, std::string>* annotations) {
// adjacent to it.
bool GetHandlerTrampoline(std::string* handler_trampoline,
std::string* handler_library) {
// The linker doesn't support loading executables passed on its command
// line until Q.
if (!base::android::BuildInfo::GetInstance()->is_at_least_q()) {
return false;
}
Dl_info info;
if (dladdr(reinterpret_cast<void*>(&GetHandlerTrampoline), &info) == 0) {
if (dladdr(reinterpret_cast<void*>(&GetHandlerTrampoline), &info) == 0 ||
dlsym(dlopen(info.dli_fname, RTLD_NOLOAD | RTLD_LAZY),
"CrashpadHandlerMain") == nullptr) {
return false;
}
......@@ -498,15 +506,8 @@ class HandlerStarter {
}
if (!base::PathExists(handler_path)) {
// The linker doesn't support loading executables passed on its command
// line until Q.
if (base::android::BuildInfo::GetInstance()->is_at_least_q()) {
bool found_library =
GetHandlerTrampoline(&handler_trampoline_, &handler_library_);
DCHECK(found_library);
} else {
use_java_handler_ = true;
}
use_java_handler_ =
!GetHandlerTrampoline(&handler_trampoline_, &handler_library_);
}
if (!dump_at_crash) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment