Skip to content

crashpad_handler segfaults on Linux when an external reporter is configured and uploads are enabled. #2286

Closed

Description

@zokrovi

Description

On Linux only, crashpad_handler segfaults inside CrashReportExecutionHandler::WriteMinidumpToDatabase when an external crash reporter is configured and uploads are enabled. The cause looks like a use-after-move of new_report.

In handler/linux/crash_report_exception_handler.cc:

UUID uuid;
database_status = 
 database_->FinishedWritingCrashReport(std::move(new_report), &uuid); // new report gets moved-from here
...
if (has_crash_reporter && uploads_enabled) {
 database_->DeleteReport(new_report->ReportID()); // crash! new_report is null!
} else if (upload_thread_) { 
 ... 
}

FinishedWritingCrashReport takes std::unique_ptr<NewReport> by value, so new_report is null after the std::move. We ultimately get a crash somewhere deeper in the stack trace (typically UUID::ToString).
macOS and Windows appear to be ok, because they use the uuid out-parameter and avoid the dereference.

This bug appears to have been there in "feat: external crash reporter" change (getsentry/crashpad#131, commit 137d0f478), so it has existed since external reporters were introduced.

When does the problem happen

  • During build
  • During run-time
  • When capturing a hard crash

Environment

  • OS: Linux x86_64, glibc
  • Compiler: GCC, any recent
  • CMake version and config: [any recent cmake, SENTRY_BACKEND=crashpad]

Steps To Reproduce

  1. Build on Linux with SENTRY_BACKEND=crashpad
  2. Call sentry_options_set_external_crash_reporter_path() on any executable.
  3. Make sure uploads are enabled in the crashpad db, e.g give consent.
  4. Be sure to enable core dumps (ulimit -c unlimited or coredumpctl)
  5. Trigger a crash or sentry_crash() - crashpad should submit a report but will segfault
    when trying to delete a leftover report in the pending/ dir.
  6. Check the coredump - you should see a stack trace in ...::DeleteReport(crashpad::UUID const&) ()
    where it probably crashed in ...UUID::ToString[abi:cxx11]() const ()

Suggested fix

Instead of _database->DeleteReport(new_report->ReportID()); , use the UUID rather than dereferencing. A one line change to _database->DeleteReport(uuid);

Activity

  1. added
    Bug
    Native
    on Nov 6, 2026
  2. linear-code commented on Nov 6, 2026

    @linear-code
  3. jpnurmi commented on Nov 6, 2026

    @jpnurmi
    Collaborator

    Thanks for a detailed bug report! 🙏

  4. added a commit that references this issue on Nov 6, 2026
    61c5073
  5. self-assigned this
    on Nov 6, 2026
  6. added a commit that references this issue on Nov 19, 2026
    67a91be
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

BugNative

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions