70 Commits

Author SHA1 Message Date
Nico Weber
032bcc92fb Mark CrashWithoutDumping() as [[noreturn]]
No behavior change.

Bug: none
Change-Id: Ie838df830221a09d5401c6c73c8c889ea714940e
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/5905738
Reviewed-by: Peter Boström <pbos@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Nico Weber <thakis@chromium.org>
2024-10-04 04:08:15 +00:00
Avi Drissman
4a93d7f4c4 Revert "Add an option to start a Windows client with global hooks disabled."
This reverts commit e17518a9e879f63b578db6c184c6bb17f1b13a06.

Reason for revert:

When trying to roll Crashpad into Chromium, all the new tests in
this CL fail; https://crrev.com/c/4984643?checksRunsSelected=win-rel&tab=checks

Original change's description:
> Add an option to start a Windows client with global hooks disabled.
>
> Change-Id: I645d6136788ca4ccebfc73005c8c2455dc4b2cee
> Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4949671
> Reviewed-by: Mark Mentovai <mark@chromium.org>
> Commit-Queue: Rich Mckeever <mckeever@google.com>

Change-Id: I3a41238cf0960899fac19d1e6d0ed0e527dfe13f
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4985124
Reviewed-by: Mark Mentovai <mark@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Avi Drissman <avi@chromium.org>
2023-10-27 20:45:09 +00:00
Rich Mckeever
e17518a9e8 Add an option to start a Windows client with global hooks disabled.
Change-Id: I645d6136788ca4ccebfc73005c8c2455dc4b2cee
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4949671
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Rich Mckeever <mckeever@google.com>
2023-10-26 19:40:30 +00:00
Alex Gough
ac0c27a923 Deregister vectored exception handler on client destruction
Some users of crashpad load and unload the dll that hosts
crashpad code. crashpad registers a vectored exception handler
to help collect heap corruption crashes. If the dll is
unloaded this handler might still be called.

This CL adds a scoped handler for such registrations and
uses it on Windows crashpad client. To allow this to
be stored, RegisterHandler() on the client needs to move
onto the client object from being a helper function.

Bug: crashpad:462
Change-Id: I5d77c056e2a9a61ddcfa9d0186ab4bfd85a19bff
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4898263
Reviewed-by: Ben Hamilton <benhamilton@google.com>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Alex Gough <ajgo@chromium.org>
2023-09-28 17:24:39 +00:00
Keishi Hattori
a7cfe95351 Reland "Add SetLastChanceExceptionHandler to implement permissive MTE mode"
This is a reland of commit b1e66e322ddd07f4640ee8bad93397a0511cd313

Original change's description:
> Add SetLastChanceExceptionHandler to implement permissive MTE mode
>
> SetLastChanceExceptionHandler sets a callback to be called after a
> crash has been reported. Returning true from this callback will
> not reraise the signal so the execution can continue. This will be
> used to implement permissive MTE mode, which will continue execution
> after a MTE crash.
>
> Bug: chromium:1467915
> Change-Id: I93a28ceea921fe977805482cf47c07643ca6133c
> Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4707688
> Reviewed-by: Robert Sesek <rsesek@chromium.org>
> Commit-Queue: Keishi Hattori <keishi@chromium.org>

Bug: chromium:1467915
Change-Id: Ibdc18084deb08bccf3c74f688b7d48ff24fe81f9
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4756235
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Commit-Queue: Keishi Hattori <keishi@chromium.org>
2023-09-05 12:40:07 +00:00
Avi Drissman
6a9e2e6003 Adjust to movement of base/ files to base/apple
This CL rolls mini_chromium to pick up the move of a bunch of files
to base/apple, and makes changes to adjust.

Bug: chromium:1444927
Change-Id: Ib692e2a1628e2c0c8228795eaecdb7f35b1c09fa
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4786387
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Avi Drissman <avi@chromium.org>
2023-08-16 21:05:16 +00:00
Keishi Hattori
ce7f0f1de9 Revert "Add SetLastChanceExceptionHandler to implement permissive MTE mode"
This reverts commit b1e66e322ddd07f4640ee8bad93397a0511cd313.

Reason for revert: test was flaky on Android bot

Original change's description:
> Add SetLastChanceExceptionHandler to implement permissive MTE mode
>
> SetLastChanceExceptionHandler sets a callback to be called after a
> crash has been reported. Returning true from this callback will
> not reraise the signal so the execution can continue. This will be
> used to implement permissive MTE mode, which will continue execution
> after a MTE crash.
>
> Bug: chromium:1467915
> Change-Id: I93a28ceea921fe977805482cf47c07643ca6133c
> Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4707688
> Reviewed-by: Robert Sesek <rsesek@chromium.org>
> Commit-Queue: Keishi Hattori <keishi@chromium.org>

Bug: chromium:1467915
Change-Id: Id815a780b576088974101117a4587adec64cfe8c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4750459
Commit-Queue: Keishi Hattori <keishi@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2023-08-03 19:12:36 +00:00
Keishi Hattori
b1e66e322d Add SetLastChanceExceptionHandler to implement permissive MTE mode
SetLastChanceExceptionHandler sets a callback to be called after a
crash has been reported. Returning true from this callback will
not reraise the signal so the execution can continue. This will be
used to implement permissive MTE mode, which will continue execution
after a MTE crash.

Bug: chromium:1467915
Change-Id: I93a28ceea921fe977805482cf47c07643ca6133c
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4707688
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Commit-Queue: Keishi Hattori <keishi@chromium.org>
2023-08-03 16:00:18 +00:00
Thomas Gales
8dcf2b216f [fuchsia] Don't build CaptureContext
CaptureContext isn't actually used on Fuchsia and there is a desire to
remove `ucontext_t` from Fuchsia as it isn't a real concept on Fuchsia
and was only added as a placeholder. Moreover, `ucontext_t` won't ever
be added to Fuchsia for RISC-V.

Bug: fuchsia:123052
Fixed: fuchsia:131112
Fixed: fuchsia:127655
Tested: `fx test crashpad` on core.x64 emulator
Tested: `fx test crashpad` on ARM64 device
Tested: `fx shell crasher` @ 16b19a9891978487 on ARM64 device, ran
through Breakpad stackwalker locally as well
Tested: `fx build crashpad_tests` for minimal.riscv64
Change-Id: I4695054426df78a9deff8c9ea9c478b5bf9701b1
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4717085
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Thomas Gales <tgales@google.com>
2023-07-31 20:03:40 +00:00
Ben Hamilton
833219f1ad [ios] Add optional UploadBehavior enum to InProcessHandler::StartProcessingPendingReports()
Previously, StartProcessingPendingReports() only started the prune and
upload threads if it thought the application was actively running in
the foreground.

However, some Crashpad clients would like to replicate Breakpad's
behavior of allowing uploads while the application is starting up
(before it moves to the foreground).

This CL introdues an optional UploadBehavior enum to
InProcessHandler::StartProcessingPendingReports(), defaulting to the
current behavior of only uploading processed crash reports while the
application is in the foreground.

If the enum is set to UploadBehavior::kUploadImmediately, then
InProcessHandler will start the prune and upload threads regardless
of the application state. (If the application state later transitions
to a non-active state, then InProcessHandler will stop the prune and
upload threads as normal.)

Change-Id: I4f13f3a3006d636dd3e511b21ccc23a90b2ea639
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3894230
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Reviewed-by: Justin Cohen <justincohen@chromium.org>
2022-09-15 20:16:25 +00:00
Ben Hamilton
ca3cf2f4e3 [ios] Add an optional upload complete observation callback to the in-process handler
Breakpad offers a callback when uploads complete:
    https://source.chromium.org/chromium/chromium/src/+/main:third_party/breakpad/breakpad/src/client/ios/BreakpadController.h;l=103;drc=1fc9cc0d0e1dfafb8d29dba8d01f09587d870026

This adds an equivalent observation callback to Crashpad on iOS which is invoked each time an upload attempt completes (whether it succeeds or fails).

I couldn't find any existing unit tests for the upload thread, but
I tested this manually by integrating it into a client. Please
let me know the best way to test this.

Change-Id: I17822af5e63c8634484606a6470ce83b2c385676
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3852399
Reviewed-by: Justin Cohen <justincohen@chromium.org>
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2022-09-12 23:08:02 +00:00
Mark Mentovai
6278690abe Update copyright boilerplate, 2022 edition (Crashpad)
sed -i '' -E -e 's/Copyright (.+) The Crashpad Authors\. All rights reserved\.$/Copyright \1 The Crashpad Authors/' $(git grep -El 'Copyright (.+) The Crashpad Authors\. All rights reserved\.$')

Bug: chromium:1098010
Change-Id: I8d6138469ddbe3d281a5d83f64cf918ec2491611
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3878262
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2022-09-06 23:54:07 +00:00
Alex Gough
80520bd937 Add WER runtime exception helper module for Windows
This adds a runtime exception helper (& test module) for Windows and
plumbing to allow the module to be registered by the crashpad client,
and to trigger the crashpad handler. Embedders can build their own
module to control which exceptions are passed to the handler.

See: go/chrome-windows-runtime-exception-helper for motivation.

When registered (which is the responsibility of the embedding
application), the helper is loaded by WerFault.exe when Windows
Error Reporting receives crashes that are not caught by crashpad's
normal handlers - for instance a control-flow violation when a
module is compiled with /guard:cf.

Registration:

The embedder must arrange for the full path to the helper to
be added in the appropriate Windows Error Reporting\
RuntimeExceptionHelperModules registry key.

Once an embedder's crashpad client is connected to a crashpad
handler (e.g. through SetIpcPipeName()) the embedder calls
RegisterWerModule. Internally, this registration includes handles
used to trigger the crashpad handler, an area reserved to hold an
exception and context, and structures needed by the crashpad handler.

Following a crash:

WerFault.exe handles the crash then validates and loads the helper
module. WER hands the helper module a handle to the crashing target
process and copies of the exception and context for the faulting thread.

The helper then copies out the client's registration data and
duplicates handles to the crashpad handler, then fills back the various structures in the paused client that the crashpad handler will need.

The helper then signals the crashpad handler, which collects a dump then
notifies the helper that it is done.

Support:

WerRegisterExceptionHelperModule has been availble since at least
Windows 7 but WerFault would not pass on the exceptions that crashpad
could not already handle. This changed in Windows 10 20H1 (19041),
which supports HKCU and HKLM registrations, and passes in more types of
crashes. It is harmless to register the module for earlier versions
of Windows as it simply won't be loaded by WerFault.exe.

Tests:

snapshot/win/end_to_end_test.py has been refactored slightly to
group crash generation and output validation in main() by breaking
up RunTests into smaller functions.

As the module works by being loaded in WerFault.exe it is tested
in end_to_end_test.py.

Bug: crashpad:133, 866033, 865632
Change-Id: Id668bd15a510a24c79753e1bb03e9456f41a9780
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3677284
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Alex Gough <ajgo@chromium.org>
2022-07-07 17:13:24 +00:00
Justin Cohen
12b35ebde8 ios: Add forbidden allocator to integration tests.
Override malloc_default_zone and malloc_default_purgeable_zone
with allocators that exit when called from the signal or Mach exception
threads in XCUITests, to verify the allocator is not used by the
InProcessHandler. Check stderr for error messages to confirm failures.

Change-Id: I1bb92e57504d71bbf6c6eaad3571c814e8a6934c
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3488826
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Justin Cohen <justincohen@chromium.org>
2022-03-10 18:08:46 +00:00
Justin Cohen
3c4e37178d ios: Fix up concurrency in DumpWithoutCrashing and exception handling.
Change signal, uncaught NSExceptions and Mach exception handlers to
prevent re-entrancy with a first-exception-wins approach to prevent
concurrent exceptions from trying to use the same cached intermediate
dump writer.  Uses compare-and-swap to either return early for reentrant
signals or to wait indefinitely for anything after the first fatal
exception.

Change the NSException handler generated from the Objective-C exception
preprocessor to not used the cached intermediate dump writer and
not use the same first-exception-wins logic. This is useful because the
Objective-C exception preprocessor is imperfect and may generate
intermediate dumps that are not followed by process termination.

Simplify DumpWithoutCrashing's ownership of its intermediate dump writer
to be thread safe.

Set a handler for SIGPIPE for applications that haven't already
ignored or set a handler for SIGPIPE.

Bug: crashpad:391
Change-Id: Ia8ae61d50be81910fa0af40325300441d9dc01b6
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3401563
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Justin Cohen <justincohen@chromium.org>
2022-03-10 18:05:16 +00:00
Ben Hamilton
e9937cb36c [Cleanup] Fix circular dependency on Windows.
Crashpad currently has a circular dependency: client->snapshot->client.

The dependency from snapshot -> client only exists to pull in a single
constant for Windows (CrashpadClient::kTriggeredExceptionCode), so this
change breaks the dependency by splitting the constant out into a new
file util/win/exception_codes.h.

Change-Id: I6b74b367df716e097758e63a44c53cb92ea5e04d
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3450763
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Justin Cohen <justincohen@chromium.org>
2022-02-17 19:33:24 +00:00
Justin Cohen
55eb7a2eaf ios: Add ability to reset Crashpad client for iOS tests.
Change-Id: I83df67d77367ef01731bd9af015605cfa19e972e
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3418581
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Justin Cohen <justincohen@chromium.org>
2022-02-02 17:50:04 +00:00
Joshua Peraza
667424894f linux: re-order first-chance-handlers, and disabled signal handlers
Both running first chance handlers and checking for disabled signal
handlers should no longer interact with DumpWithoutCrashing().

First-chance-handlers should also run even with disabled crashpad
signal handlers or else those signals would be reported by the next
chained signal handlers as crashes.

Change-Id: I64b3da42c400a1c431c6228d4da181ed56bfda89
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3403413
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
2022-01-20 17:23:26 +00:00
Mark Mentovai
50ed179e9a Use BUILDFLAG for OS checking
Use BUILDFLAG(IS_*) instead of defined(OS_*).

This was generated mostly mechnically by performing the following steps:
 - sed -i '' -E -e 's/defined\(OS_/BUILDFLAG(IS_/g' \
                -e 's%([ !])OS_([A-Z]+)%\1BUILDFLAG(IS_\2)%g' \
       $(git grep -l 'OS_'
         '**/*.c' '**/*.cc' '**/*.h' '**/*.m' '**/*.mm')
 - sed -i '' -e 's/#ifdef BUILDFLAG(/#if BUILDFLAG(/' \
       $(git grep -l '#ifdef BUILDFLAG('
         '**/*.c' '**/*.cc' '**/*.h' '**/*.m' '**/*.mm')
 - gsed -i -z -E -e \
       's%(.*)#include "%\1#include "build/buildflag.h"\n#include "%' \
       $(git grep -l 'BUILDFLAG(IS_'
         '**/*.c' '**/*.cc' '**/*.h' '**/*.m' '**/*.mm')
 - Spot checks to move #include "build/buildflag.h" to the correct parts
   of files.
 - sed -i '' -E -e \
       's%^(#include "build/buildflag.h")$%#include "build/build_config.h"\n\1%' \
       $(grep -L '^#include "build/build_config.h"$'
         $(git grep -l 'BUILDFLAG(IS_'
           '**/*.c' '**/*.cc' '**/*.h' '**/*.m' '**/*.mm'))
 - Add “clang-format off” around tool usage messages.
 - git cl format
 - Update mini_chromium to 85ba51f98278 (intermediate step).
   TESTING ONLY).
 - for f in $(git grep -l '^#include "build/buildflag.h"$'
              '**/*.c' '**/*.cc' '**/*.h' '**/*.m' '**/*.mm'); do \
       grep -v '^#include "build/buildflag.h"$' "${f}" > /tmp/z; \
       cp /tmp/z "${f}"; done
 - git cl format
 - Update mini_chromium to 735143774c5f (intermediate step).
 - Update mini_chromium to f41420eb45fa (as checked in).
 - Update mini_chromium to 6e2f204b4ae1 (as checked in).

For ease of review and inspection, each of these steps is uploaded as a
new patch set in a review series.

This includes an update of mini_chromium to 6e2f204b4ae1:

f41420eb45fa Use BUILDFLAG for OS checking
6e2f204b4ae1 Include what you use: string_util.h uses build_config.h

Bug: chromium:1234043
Change-Id: Ieef86186f094c64e59b853729737e36982f8cf69
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3400258
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2022-01-19 20:21:19 +00:00
Justin Cohen
204abe16d2 ios: Add iOS in-process handler for managing minidump generation.
Manage the intermediate minidump generation, and own the crash report
upload thread and database.

Change-Id: I272d790a827cd13f6872e56f4675f366d13719c5
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3087721
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2021-10-14 15:16:02 +00:00
Peter Boström
1aa478d161 Remove DISALLOW_* macros in crashpad
This change was partially scripted and partially done manually with vim
regex + manually placing the deleted constructors.

The script change looked for destructors in the public: section of a
class, if that existed the deleted constructors would go before the
destructor.

For manual placement I looked for any constructor in the public: section
of the corresponding class. If there wasn't one, then it would ideally
have gone as the first entry except below enums, classes and typedefs.
This may not have been perfect, but is hopefully good enough. Fingers
crossed.

#include "base/macros.h" is removed from files that don't use
ignore_result, which is the only other thing defined in base/macros.h.

Bug: chromium:1010217
Change-Id: I099526255a40b1ac1264904b4ece2f3f503c9418
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3171034
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Peter Boström <pbos@chromium.org>
2021-09-21 15:09:44 +00:00
Justin Cohen
b8a1685773 ios: Correct typo in client API StartProcessingPendingReports.
Change-Id: Ibc40751a21ed884bde7ed592df20d7541762cba8
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3031701
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Justin Cohen <justincohen@chromium.org>
2021-07-15 15:00:13 +00:00
Justin Cohen
202283a85c ios: Add API to DumpWithoutCrashAndDeferProcessingAtPath.
DumpWithoutCrashAndDeferProcessingAtPath(path) generate an intermediate
dump that can only be processed if ProcessIntermediateDump(file)
is called.  This means the client retains ownership of cleaning up the
intermediate dump if for whatever reason it is no longer needed.

This is useful for Chromium hang reports, which are speculatively
generated during a hang, but are later deleted if a hang recovers or if
the hang leads to an actual crash.

Bug: crashpad: 31
Change-Id: Ie424b375ceae3f5c0da320e766c990ea10df2f52
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3021668
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Justin Cohen <justincohen@chromium.org>
2021-07-15 12:21:12 +00:00
Justin Cohen
2dbd019bc2 ios: Add iOS crashpad overview documentation.
Adds an overview of the limitations of crashpad on the iOS platform,
including explanations of the in-process client and handler, and the
intermediate dump format used.

Bug: crashpad: 31
Change-Id: I1eb6add115570147e2de1be1002c5a4aa366184b
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2706018
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2021-03-24 23:37:02 +00:00
Justin Cohen
b4bcc4df25 ios: Expose EnableUploading in CrashpadClient.
This method should be called when an application is ready to start
uploading any pending reports.

Bug: crashpad: 31
Change-Id: I70948fc4dfd8ee509d313b27a50fc4314baf5ce8
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2698179
Reviewed-by: Justin Cohen <justincohen@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Justin Cohen <justincohen@chromium.org>
2021-03-08 19:02:33 +00:00
Justin Cohen
87515bc2fa ios: Expose ProcessIntermediateDumps in CrashpadClient.
This method should be called when an application is ready to start
processing previously created intermediate dumps and begin uploading.
Processing will block, so this should not be called on the main UI
thread.

Bug: crashpad: 31
Change-Id: I31f81c68694cf18dd40e2994c0d6e7107c29e553
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2673024
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2021-02-04 04:35:40 +00:00
Justin Cohen
2cb83e491e ios: Cleanup API for chromium integration.
Bug: crashpad: 31
Change-Id: I9149879b2f6886ea17ca828dd60d37eb187ba88e
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2665887
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2021-02-02 14:27:06 +00:00
Joshua Peraza
2e066d2e56 Use chromeos buildflags
This CL upstreams changes made in chromium to use buildflags:
https://chromium-review.googlesource.com/c/chromium/src/+/2494261
https://chromium-review.googlesource.com/c/chromium/src/+/2594831

and alters the  buildflags in handler_main.cc to allow LaCrOS to use
/sbin/crash_reporter

Bug: chromium:1159628
Change-Id: Iae9f39f9bc61106cb0056bee010ee7eaa7ac1713
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2622766
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2021-01-12 22:22:03 +00:00
Sean McAllister
3965bc7d78 Refactor OS_LINUX usage for coming LaCrOs update.
We're working to decouple ChromeOS and Linux builds of Chrome.

Currently OS_CHROMEOS sets OS_LINUX, so we need to refactor
current OS_LINUX usage to make this explicit.

More information can be found at go/cros_is_linux_os_linux

BUG=chromium:1110266
TEST=manual build

Change-Id: Ie765da1ab6a0bf0286538ae1df3697abaa29aeaa
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2391116
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
2020-09-03 19:12:04 +00:00
Avi Drissman
4ae896bad0 Migrate to OS_MAC and OS_APPLE in Crashpad
This migrates:

 defined(OS_MACOSX) -> defined(OS_APPLE)
 defined(OS_MACOSX) && !defined(OS_IOS) -> defined(OS_MAC)
 !defined(OS_MACOSX) || defined(OS_IOS) -> !defined(OS_MAC)

Bug: chromium:1105907
Change-Id: I1b4abc19bbbe8df90e9c6e64cd29324b40b8ab71
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2321777
Commit-Queue: Avi Drissman <avi@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2020-07-28 02:35:48 +00:00
Joshua Peraza
06a688ddc1 linux: setup a signal stack
Bug: crashpad:340
Change-Id: I035d988bc8e76dbf80c07f0c92b07dbefeba8bd1
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2209768
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2020-07-15 19:00:09 +00:00
IrinaShkviro
4145699874 win,linux: implement attachments support
Implemented the AddAttachment(), InitializeAttachments(), CleanDatabase() functions
on Windows.

Added attachment=FILE_NAME option to the handler, and
"attachments" argument for Windows and Linux to StartHandler function.
On crash it will create the corresponding attachments in the database
and copy content of the specified files to the database.

Bug: b/157144387

Change-Id: Ia238de39028e07112a7b971b5b7d5e71a5864f53
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2248099
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2020-06-24 16:19:27 +00:00
Justin Cohen
17a515d33d [ios] Bring up first draft Mach exception server.
Add Mach exception server and fill out exceptions snapshot.

Note that:
 - The 'capture' portion of this CL will be moved out of the snapshot
   interface and into a separate in-process dump to disk location.
 - All of the pointer dereferences need to be wrapped in vm_read.
 - The read-fast-and-dump logic in exception_snapshot will end up in a
   different file completely, but until we pick a
   serialization/deserialization method, keep it as-is.

Bug: crashpad:31
Change-Id: I44203aa44036a341d6b4517fde7ab0cb9d7e94d7
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2160122
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2020-04-25 23:38:48 +00:00
Justin Cohen
b109e4ce38 [ios] Bring up first draft process and module snapshot.
Gather most of the necessary information for the module snapshot.

Note that:
 - The 'capture' portion of this CL will be moved out of the snapshot
   interface and into a separate in-process dump to disk location.
 - All of the pointer dereferences need to be wrapped in vm_read.
 - The read-fast-and-dump logic in module_snapshot may end up in a
   different file completely, but until we pick a
   serialization/deserialization method, keep it in module_snapshot_ios.

Change-Id: Ie80c739c167634520d13ec920a29a80116aa3bfe
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2079196
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Justin Cohen <justincohen@chromium.org>
2020-03-05 15:42:35 +00:00
Justin Cohen
9ed8290547 Bring up skeleton crashpad_client_ios.
First steps at bringing up the crashpad_client on iOS.  Also updates
the XCUITest to trigger various crashes, with some swizzling
necessary to allow crashes.

Change-Id: I87dd36bed1c052b509d14bfa29679ed81e58a377
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2039470
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
Reviewed-by: Rohit Rao <rohitrao@chromium.org>
2020-02-18 20:03:41 +00:00
Joshua Peraza
eb0c4726f1 linux: make GetHandlerSocket() params optional
It turns out it's frequently convenient to only grab one of these at a time.

Change-Id: Ie4a05583a5c875163154efc485d57a014101cc16
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1838011
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
2019-10-03 18:00:42 +00:00
Joshua Peraza
06fdbdecdc android, chromeos: fix build breakages
Also augment some documentation.

Change-Id: Icbb8bdbe435484346f2b24e37f81182a3f189cb5
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1797189
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2019-09-11 18:02:50 +00:00
Joshua Peraza
fc44a3747c linux: Allow configuring unhandled signals
Change-Id: I621555f892a3064c5cba09120309bc900da237f9
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1793563
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
2019-09-10 17:57:21 +00:00
Tim Zheng
726ab2a655 Integrate Crashpad with Chrome OS
This CL adds modification to Crashpad to integrate Crashpad reporting
for Chrome on Chrome OS.

Design doc: go/cros-crashpad
BUG=chromium:944123

Change-Id: I22e2f2a93f32c2dc149c9c011fa8134cf6d5b74f
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1707369
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2019-08-19 23:28:00 +00:00
Joshua Peraza
ec56fc6a38 linux: add Get/SetHandlerSocket()
These methods are used to connect additional clients to an existing
handler process.

Bug: crashpad:285
Change-Id: Iefa5b0d8f5fd7d4799140ff9a7c2f79ac65da738
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1759281
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2019-08-19 21:48:09 +00:00
Joshua Peraza
607c80e0b8 linux: Implement StartHandler()
This CL adds a RequestCrashDumpHandler to request a crash dump over a
socket. Common functionality with LaunchAtCrashHandler is factored out
into a SignalHandler base class.

Bug: crashpad:284
Change-Id: I86293ef599a0dd6eea63c096a5c931c620c05ecc
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1568985
Reviewed-by: Mark Mentovai <mark@chromium.org>
2019-05-02 20:59:15 +00:00
Joshua Peraza
99bf283e54 android: Add methods to start handler with /system/bin/linker
Starting with Android Q, Bionic's linker will support loading
executables from an APK, replacing the /system/bin/app_process
workaround.

libhandler_trampoline.so is a small executable, which `dlopen()`s
the handler code from another native library allowing
de-duplicating shared code with that library without having that
library available for a more direct link time dependency.

Bug: 928422
Change-Id: Ib126b8fca6005a34b9e4ef103eb1383dc0c554ea
Reviewed-on: https://chromium-review.googlesource.com/c/1477336
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
2019-02-25 19:22:57 +00:00
Joshua Peraza
91781418bc linux: Add CrashWithoutDump()
When a renderer crashes in Multi-process WebView, the browser process
may need to crash itself to maintain equivalent behavior with single
process WebView. This allows it to do so without generating a dump of
the browser process, which would provide no useful information.

Change-Id: I272d6322269bd0ba8753b5b3959a613877eaf867
Reviewed-on: https://chromium-review.googlesource.com/c/1258082
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-10-02 22:57:33 +00:00
Joshua Peraza
d4d2f8557a android: Add client methods to start a Java handler
These methods use /system/bin/app_process{32,64} to load a Java class
supplied by the embedding application. It is expected that the
supplied class loads a native library containing Crashpad's handler
code and passes its arguments to crashpad::HandlerMain().

Bug: crashpad:30
Change-Id: Ic0f9a1439007047b06f07f5ec7d5de9a9d4a19a2
Reviewed-on: https://chromium-review.googlesource.com/1194400
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-08-29 16:11:27 +00:00
Scott Graham
c82309f0e5 fuchsia: Implement StartHandler() and ExceptionHandlerServer
StartHandler() binds to the default job's exception port, and launches
the handler process (normally this is crashpad_handler), passing it the
task handle and a handle to the exception port as startup parameters.
This follows the protocol used by crashlogger.

Additionally, implement ExceptionHandlerServer in crashpad_handler,
which contains the exception processing loop. It currently dispatches to
an empty CrashReportExceptionHandler where a report will be written
eventually.

Bug: crashpad:196
Change-Id: Ie27ff6f67adfbcc7d03551ae7e84a885da43df5a
Reviewed-on: https://chromium-review.googlesource.com/1043282
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2018-05-05 00:02:12 +00:00
Joshua Peraza
f5b486de74 linux: Make StartHandler methods static
Bug: crashpad:30
Change-Id: I3b9e9f149ea8190c3b725691f4fb320eca9cbad0
Reviewed-on: https://chromium-review.googlesource.com/966887
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
2018-03-16 18:49:05 +00:00
Joshua Peraza
fa2a03fbdd linux: Add CrashpadClient::SetFirstChanceExceptionHandler()
Bug: crashpad:30
Change-Id: Idde7fd5c8ddec7c807c7720cd5b4958bf7f13fe8
Reviewed-on: https://chromium-review.googlesource.com/933363
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-02-23 19:45:17 +00:00
Joshua Peraza
01105719d7 linux: add CRASHPAD_SIMULATE_CRASH()
Bug: crashpad:30
Change-Id: I135864a0e31119de3a814ee5ab5729336f6284a3
Reviewed-on: https://chromium-review.googlesource.com/927116
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-02-21 00:21:44 +00:00
Scott Graham
885fb47a0d Make CrashpadClient::DumpAndCrashTargetProcess static
Noticed during discussion for
https://chromium-review.googlesource.com/c/chromium/src/+/896638 and the
linked bug that there's no need for this to be an instance method. Make
it static as it's easier to use.

Bug: chromium:806661
Change-Id: I24b893e58a47b5256b3b1b43dd5f1fc2d7cc6be8
Reviewed-on: https://chromium-review.googlesource.com/898439
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-02-02 20:54:44 +00:00
Joshua Peraza
574936540d linux: Add CrashpadClient methods to start the handler
This change includes methods to install a signal handler to launch
the handler process at crash time or to launch the handler on behalf
of another process.

Bug: crashpad:30
Change-Id: I503c788cb3648852d09e9e8c1fe5099ca07a0277
Reviewed-on: https://chromium-review.googlesource.com/759406
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-02-01 18:50:07 +00:00