987 Commits

Author SHA1 Message Date
Peter Collingbourne
0d26b02c37 Reraise signals via rt_tgsigqueueinfo(2) on Linux (try 2).
Previously we would rely on implicit re-raising to deliver signals to
the underlying handler on POSIX systems if the signal is detected as
being re-raisable via WillSignalReraiseAutonomously(). This detection
mechanism is imperfect, as it will misclassify signals delivered as
a result of kill(2) when passing a signal number usually used for
synchronous signals, but now also asynchronous MTE tag check faults,
which are delivered as SIGSEGV signals on Linux. As a result, these
signals would not be re-raised and therefore would be discarded.

Although we could, for example, teach WillSignalReraiseAutonomously()
about MTE faults, the signal would still be re-raised via raise(3)
and therefore we would lose the information in siginfo.

We can avoid discarding these signals on Linux while at the
same time preserving the siginfo by making use of the syscall
rt_tgsigqueueinfo(2) which delivers a signal together with a
user-provided siginfo. The problem still exists on non-Linux POSIX
systems because this syscall is Linux-specific.

With kernel versions prior to 3.9, the kernel will reject the
rt_tgsigqueueinfo() syscall with EPERM. If that happens, follow
the non-Linux code path.

Change-Id: Ia410fbd651a756945c9402e361edfd5c520453d6
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3300991
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Peter Collingbourne <pcc@chromium.org>
2021-11-25 00:33:31 +00:00
Peter Collingbourne
c537245de8 Revert "Reraise signals via rt_tgsigqueueinfo(2) on Linux."
Causes test failures on older versions of Android (e.g. Marshmallow).

Also reverts follow-up CL "Fix dead-code warning in util/posix/signals.cc".

This reverts commits ab9a87fb5463e5d1579e16bacb1f79d0dd71119b and
04431eccfe878570b1c74a5b376d96b4c9c7e0e8.

Bug: 1272877
Change-Id: Id9ef420516c932147b6c8b67d9f4daf9d31d9b03
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3300986
Reviewed-by: Peter Boström <pbos@chromium.org>
Commit-Queue: Peter Collingbourne <pcc@chromium.org>
2021-11-24 22:09:30 +00:00
Justin Cohen
3a7e935a86 ios: Handle partial intermediate dumps and exception contexts.
Testing in beta has shown a few examples of a cropped intermediate dump
still providing useful information, but due to the order intermediate
dump data is written, could be improved.

- Change the order of writing data to the intermediate dump by
increasing the priority of the Exception block from:
 Header / Process / System / Threads/ Modules / Exception
to
 Header / Process / System / Exception / Threads / Modules

- Annotate minidump reports generated from incomplete intermediate
dumps with the key 'crashpad_intermediate_dump_incomplete'.

- Handle partial exception contexts rather than throwing them away.

Change-Id: I543c1d3135c42e5b8e339e498ea0c86002f37ea3
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3294862
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2021-11-22 21:07:13 +00:00
Justin Cohen
4b86b27773 ios: Add IOSIntermediateDumpInterface.
Change IOSIntermediateDumpReader to take a new interface that can be
backed by a FilePath (as it is now) or a StringFile byte array, which
can be useful for tests, especially with fuzzing.

Change-Id: I02a25cfb7cd204975d1bcce80201bd10944f3f2e
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3270755
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2021-11-21 04:29:36 +00:00
Robert Sesek
c8edcf1bb8 Split util/net files into a separate static_library target.
Only the handler uses util/net. After
8342e6bd613a5b2e44eca1d74288e3115ccef139, the introduction of an
Objective-C class caused Chromium to emit duplicate class defintion
warnings in the component build.

Bug: chromium:1270609
Change-Id: I2770528347aef406bb21a79d295f702498f7b37e
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3290276
Commit-Queue: Robert Sesek <rsesek@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2021-11-19 20:34:25 +00:00
Justin Cohen
92f6c21242 Retry UploadReport on http upload failures.
This implements a per-report retry rate limit (as opposed to per upload
rate limit in ShouldRateLimitUpload). When a report upload ends in a
retry state, an in-memory only timestamp is stored with the next
possible retry time. This timestamp is a backoff from the main thread
work interval, doubling on each attemt. Because this is only stored in
memory, on restart reports in the retry state will always be tried
once, and then fall back into the next backoff. This continues until
5 retry attempts are reached.

Change-Id: Ibde8855a8a9f0743f0b0bd4d5e3de8a45c64bcb6
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3087723
Reviewed-by: Mark Mentovai <mark@chromium.org>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Commit-Queue: Justin Cohen <justincohen@chromium.org>
2021-11-19 19:58:55 +00:00
Peter Boström
ab9a87fb54 Fix dead-code warning in util/posix/signals.cc
This unblocks a roll of crashpad into chromium.

Bug: None
Change-Id: I54fc53e0b53b8a7c7ff8e28c4657b46587bfad8d
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3287226
Commit-Queue: Peter Boström <pbos@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2021-11-17 00:57:24 +00:00
Peter Boström
bede7bb29e Rename "base/macros.h" => "base/ignore_result.h"
This pulls in "base/ignore_result.h" from mini_chromium through DEPS and
updates existing uses of "base/macros.h" to use "base/ignore_result.h".

Bug: chromium:1010217
Change-Id: I283e2bcfb2775de420d7e767b3b4a639dbba9e20
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3286105
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Peter Boström <pbos@chromium.org>
2021-11-16 21:21:28 +00:00
Peter Collingbourne
04431eccfe Reraise signals via rt_tgsigqueueinfo(2) on Linux.
Previously we would rely on implicit re-raising to deliver signals to
the underlying handler on POSIX systems if the signal is detected as
being re-raisable via WillSignalReraiseAutonomously(). This detection
mechanism is imperfect, as it will misclassify signals delivered as
a result of kill(2) when passing a signal number usually used for
synchronous signals, but now also asynchronous MTE tag check faults,
which are delivered as SIGSEGV signals on Linux. As a result, these
signals would not be re-raised and therefore would be discarded.

Although we could, for example, teach WillSignalReraiseAutonomously()
about MTE faults, the signal would still be re-raised via raise(3)
and therefore we would lose the information in siginfo.

We can avoid discarding these signals on Linux while at the
same time preserving the siginfo by making use of the syscall
rt_tgsigqueueinfo(2) which delivers a signal together with a
user-provided siginfo. The problem still exists on non-Linux POSIX
systems because this syscall is Linux-specific.

Change-Id: I6df58d9371e29f75e19b4f899b723d4047f12936
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3278691
Commit-Queue: Peter Collingbourne <pcc@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2021-11-16 02:45:23 +00:00
Olivier Robin
c8d8dd9ccf Add attachment support for Mac/iOS crash report database
Copy the crash_report_database_generic implementation.

bug: crashpad: 31
Change-Id: I582620ec8b22fecc7568d220c410c397948dfcb1
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3045405
Commit-Queue: Olivier Robin <olivierrobin@chromium.org>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2021-11-15 17:41:54 +00:00
Jakob Kummerow
d62cc6fdbd Linux: capture memory pointed to by context
This adds support for capturing memory snippets for addresses
currently stored in registers to Linux/Android/CrOS.
Modeled after the existing support on Windows.

Bug: crashpad:30
Change-Id: Ib7cb523555a6e8e4d70145c205d67dcfbc9c7fcc
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3273712
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2021-11-12 18:15:04 +00:00
Robert Sesek
8342e6bd61 mac/ios: Restore NSInputStream-backed HTTP transport reader.
This effectively reverts f0ee5f0efee651ab82aa854761f107193b3db5de, but
updates the subclass with the new required NSStream methods. Crashpad
switched to using CFReadStream because NSInputStream required overriding
two private methods of NSInputStream in order to use it with
NSURLConnection. With Mac OS X 10.11 (the earliest that Chromium
supports), this is no longer the case. On iOS, using the private
CFReadStreamCreate() API is not permissible. Switch back to using a
custom NSInputStream subclass instead.

Bug: crashpad:382
Change-Id: I92b1260f49c6fa6c304475f7dc9b27ae1a5f35c4
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3271448
Commit-Queue: Robert Sesek <rsesek@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2021-11-10 21:14:42 +00:00
Justin Cohen
717b3c9e7b ios: Fix incorrect type in IOSIntermediateDumpReader::Parse.
size_t is written to intermediate dump properties, but the parser was
reading off_t.  off_t can go negative, which is a bad thing to pass
to a std::vector constructor.

Bug: crashpad:31
Change-Id: I52ebda0b29ece50d6d1cbc9064a70b2e221a4df1
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3261749
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2021-11-05 00:53:03 +00:00
Justin Cohen
aaed581a53 Correct WorkDelegate::DoWork race condition with an atomic_bool.
Bug:crashpad:380
Change-Id: Iae523f22366ca65816c42b499bd482056efb5bca
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3244729
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Justin Cohen <justincohen@chromium.org>
2021-10-26 16:15:55 +00:00
Justin Cohen
2d5a30fb17 ios: Create a PruneIntermediateDumpsAndCrashReportsThread.
This will prune the database on a daily basis, in accordance with the
specified condition. This will also unlock any leftover intermediate
dump files.

Bug: crashpad:31
Change-Id: I229f8b8006b44d31062fbf73bb9d316d69ab2dcf
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3231618
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2021-10-25 15:54:05 +00:00
Peter Kasting
2c45d05875 More -Wshadow fixes.
Bug: chromium:794619
Change-Id: I1987eb543d0b1a5f82eeb8504b6adde8ef6df600
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3238894
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2021-10-25 14:42:24 +00:00
Justin Cohen
c367128a85 ios: Don't use POSIX file locks for iOS intermediate dumps.
Instead use a custom mechanism based on the filename. Rather than a
filename of <uuid>, instead name the file <bundle-id>|<uuid>[.locked].
A locked file will have the optional .locked extension. Files can be
unlocked after writing an intermediate dump, or during initialization by
looking for matching bundle-ids.

Clients that call ProcessIntermediateDumps() will clean up any leftover
locked intermediate dumps. Clients that never call
ProcessIntermediateDumps, such as extensions that leave this up to the
main application, will be cleaned up in a followup change.

Bug: crashpad:31
Change-Id: Icd4aaa3b79351870fbe9b8463cfbdf7cff7d5f87
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3229429
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
Reviewed-by: Rohit Rao <rohitrao@chromium.org>
2021-10-19 18:23:51 +00:00
Justin Cohen
02d50376a7 Correct formatting in util/posix/signals_test.cc
Change-Id: I431f663a91bfce62b8d554ee980fa62da8551275
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3223541
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Justin Cohen <justincohen@chromium.org>
2021-10-14 16:04:58 +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
Adenilson Cavalcanti
07a6b70755 Disable cause-SIGFPE test on Arm processors
The way that division operations behave have changed between Armv7
and Armv8. On the later one, divisions by zero will *not* yield an
exception of any kind (for both a 32bit and 64bit app), for hardware
integer divide operation.

On Arm processors exceptions may also be a factor of:
 - if the hardware implementation supports it.
 - if the kernel has set the proper internal state registers/flags.
 - C library implementations (e.g. libgcc x clang_rt).

Aside that, a division by zero is within the realm of UD (Undefined
Behavior) in C/C++.

Since there are two categories of tests (explicit raise x caused by
instructions), it just makes sense to disable the second for Arm
since there is no reliable way to cause a SIGFPE without an explicit
raise() POSIX call.

For x86, we keep the previous implementation idea but streamlined
the code by deploying 'volatile' to ensure that the compiler
won't optimize away the result of the division (i.e no need
to call stat() and fstat()).

Bug: chromium:919548, chromium:1184398
Change-Id: Ib0fd4bdf503dcd50149dccae0577c777488c0238
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3213431
Commit-Queue: Adenilson Cavalcanti <cavalcantii@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2021-10-13 22:43:04 +00:00
Joshua Peraza
0a8985cd20 linux,arm: support memory tagging
64-bit ARM's Top-Byte-Ignore enables features such as memory tagging.
https://www.kernel.org/doc/html/latest/arm64/tagged-address-abi.html

Android 11 will start using memory tagging on some devices.
https://source.android.com/devices/tech/debug/tagged-pointers

Crashpad needs to remove the tags from pointers before comparing to
addresses or using with system calls.

Bug: crashpad:364
Change-Id: I67c6b9a4a86d090e1d139de727eb06d9e222cc25
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3078500
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
2021-10-13 21:23:34 +00:00
Justin Cohen
413dedd90f ios: Missing include.
uint16_t needs stdint.h.

Change-Id: Iafbbb6365d2cf180e61f62c5fbd9e7c35a58e827
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3212887
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Justin Cohen <justincohen@chromium.org>
2021-10-07 20:39:39 +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
Dangyi Liu
8940d63dfc Disable mac specific features when in Fuchsia tree
Because Fuchsia's fork deleted apple_cf for license compliance.

Bug: fuchsia:66116
Change-Id: Iecdbc005799bdf6a4d0d3433d63e8040f28621cf
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3120806
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
2021-08-27 22:34:46 +00:00
Justin Cohen
40cd1b72cf ios: Migrate ios/snapshot to writing intermediate dumps.
This migrates all the logic that used to live in ios/snapshots that
gathers all the various information during an exception.

Everything in InProcessIntermediateDumpHandler is considered
`RUNS-DURING-CRASH`.

Change-Id: Icc47c9de0f66be2b14a46a13d1038176082a3218
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2920547
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2021-08-11 17:52:56 +00:00
Justin Cohen
e47918b80a ios: Move and update ObjcExceptionPreprocessor.
More cleanly integration the ObjExceptionPreprocessor with the
Crashpad client and in process handler, to record bought
'caught' and 'uncaught' NSExceptions.

Bug: crashpad: 31
Change-Id: I77a77ca6d893cdc74da476c1888d9bcb338339d8
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2920851
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2021-08-11 16:41:53 +00:00
Joshua Peraza
1db7e2b547 Avoid use of UMA_HISTOGRAM_COUNTS
UMA_HISTOGRAM_COUNTS is documented as deprecated and defaults to
creating larger histograms than are needed by Crashpad.

Bug: chromium:1237013
Change-Id: Ic133e05bce41759a11dbb523d84afc5246c6dc37
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3075884
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2021-08-11 16:35:54 +00:00
Justin Cohen
7451893cd8 ios: Fix MissingIntermediateDumpKey and InvalidIntermediateDumpKeySize histogram.
The actual number of enums that will be recorded is approx ~75.

Bug: crashpad: 31
Change-Id: If33671c7627d6e55e94c86308c8482711e33cef4
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3035823
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Justin Cohen <justincohen@chromium.org>
2021-08-11 15:53:43 +00:00
Joshua Peraza
78bcb55e1c Construct ProcessMemoryLinux using PtraceConnection
Update ProcessMemoryLinux to be constructed from PtraceConnection
instead of being Initialize()d with a pid_t.

This allows consolidating PtraceClient's BrokeredMemory with
ProcessMemoryLinux and providing the PtraceConnection as a alternative
to the memory file (previously only done for brokered connections).

Change-Id: I1363e208030eaf595fb8051e9a2c6b255c1f9886
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3072402
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
2021-08-11 15:48:33 +00:00
David Fang
d5d78c1469 [third_party] Make mini_chromium relocatable
This will accommodate moving third_party/mini_chromium around.
The default location is unchanged for now.

There are GN variables that may need to be updated when Fuchsia's source
re-organizes its layout:

* mini_chromium_source_parent : this contains a BUILD.gn with groups and
encloses the mini_chromium_source_root.  This is controlled by the
structure of the project that depends on this project.

* _mini_chromium_source_root : this is what is normally checked out from
git, the upstream source directory

* mini_chromium_import_root : points inside source_root to make GN files
accessible.

This first step breaks out case logic for "if (crashpad_is_in_fuchsia)"
even if the value is unchanged for now.  This will faciliate a smaller
change when Fuchsia re-structures third_party sources.

Change-Id: I09e5362f4be8fdb440e3891422881b1053052341
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3062424
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2021-08-11 15:26:03 +00:00
Tamir Duberstein
79d85979e6 Use generic MOCK_METHOD macros
These macros were introduced in 2018. See
https://github.com/google/googletest/commit/c5f08bf.

Mark mocks "override" where needed and move
"-Wno-inconsistent-missing-override" to gmock_all_test since
googletest/googlemock/test/gmock-function-mocker_test.cc doesn't always
specify "override" on mocks.

Change-Id: Icdc0a0ac986ab8d8d904173d093096c8f666ec04
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3079439
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2021-08-09 14:04:38 +00:00
Nico Weber
058c1c2d9c Fix a few -Wunreachable-code-aggressive warnings
No behavior change.

Bug: chromium:1066980
Change-Id: Ic9485f3244516a4196965d2ebb2bfbc2c62a91d7
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3054401
Commit-Queue: Nico Weber <thakis@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2021-07-27 15:00:08 +00:00
Joshua Peraza
3ae82cd30a Remove gyp
Standalone Crashpad for Android can now be built with gn.

Change-Id: I0ee7f8e1af8c2bc0edb88e93b345abd7d739f33c
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3034984
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
2021-07-16 17:09:48 +00:00
Hans Wennborg
e481b16bf4 Add missing <ostream> include
It's currently included by string_piece.h, but that include is going
away.

Bug: crashpad:none
Change-Id: I5214e888f086b12e91121f81ef94c8038fe9558a
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3015681
Commit-Queue: Hans Wennborg <hans@chromium.org>
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Reviewed-by: Justin Cohen <justincohen@chromium.org>
2021-07-08 17:08:21 +00:00
Justin Cohen
3b0ebc29cd Cleanup some diffs between Chromium and Crashpad.
Some header changes (page_size), formatting and exception processor
cast changes.

Change-Id: Id1d2dd99ee6d82b5322692894e4e12e96fcac030
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2936663
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Justin Cohen <justincohen@chromium.org>
2021-06-28 14:25:39 +00:00
Justin Cohen
ce378c4293 Fix some chromium roll errors and warnings.
Remove unneeded base/strings/stringprintf.h includes.
ARCH_CPU_X86_64 macro is used without including build/build_config.h
Missing base/check.h

Change-Id: Ib7864ab7b30ef8fc37649783f7b90b618d0d6a0b
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2920552
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Justin Cohen <justincohen@chromium.org>
2021-06-02 22:02:42 +00:00
Justin Cohen
7f6f917aac ios: Migrate ios/snapshot to reading intermediate dumps.
Change-Id: Ib7715e642fa685a5f607239d07dcb68868cacb09
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2883523
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2021-05-26 19:36:05 +00:00
Lei Zhang
d8f60c8112 Swap from base/stl_util.h to cxx17_backports.h.
Chromium moved base::size() to base/cxx17_backports.h, so do the same in
mini_chromium and update the users in Crashpad.

Roll mini_chromium to 2f06f83f to make the new base header available.

Bug: chromium:1210983
Change-Id: Ie3dc4c189dcdfcac030b95fe285f94abb29a27bf
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2917779
Commit-Queue: Lei Zhang <thestig@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2021-05-25 21:44:52 +00:00
Justin Cohen
b2b65a91cf ios: Add support for intermediate dump reader and writer.
Due to the limitations of in-process handling, an intermediate dump file
is written during exceptions. The data is streamed to a file using only
in-process safe methods. The file format is similar to binary JSON,
supporting keyed properties, maps and arrays.
 - Property [key:int, length:int, value:intarray]
 - StartMap [key:int], followed by repeating Properties until EndMap
 - StartArray [key:int], followed by repeating Maps until EndArray
 - EndMap, EndArray, EndDocument

Similar to JSON, maps can contain other maps, arrays and properties.

Once loaded, the binary file is read into a set of data structures that
expose the data, maps and arrays.

Bug: crashpad: 31
Change-Id: I43a19204935303afd753c8c7090c54099634ccd6
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2870807
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Justin Cohen <justincohen@chromium.org>
2021-05-24 16:53:26 +00:00
Justin Cohen
6f8dfc7730 ios: Rename RAW_LOG to CRASHPAD_RAW_LOG.
Deconflict with chromium RAW_LOG.

Change-Id: Iac0110f52259595175aaed983ea3ac6136911407
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2910732
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Justin Cohen <justincohen@chromium.org>
2021-05-20 15:03:42 +00:00
Leonard Grey
3a112cfefd Modernize Objective-C
Via tools/mac/rewrite_modern_objc.py in the Chromium repo

Bug: chromium:324079
Change-Id: I3160331899b3ea75e0ebc78abd9a0a84e9339b40
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2904179
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Leonard Grey <lgrey@chromium.org>
2021-05-18 19:35:51 +00:00
Justin Cohen
d5b3a1d531 ios: Add support for ScopedVMRead and RAWLOG
Adds wrapper to vm_read and vm_deallocate memory to allow for safe
in-process memory reads during crashes.

Also adds a logging utility safe for in-process exception handling.

Bug: crashpad: 31
Change-Id: I658f3181cbec40a79e304b7306466e10c003564f
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2875349
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Justin Cohen <justincohen@chromium.org>
2021-05-07 19:00:19 +00:00
Justin Cohen
a2ab062f46 Add non-blocking support to LoggingLockFile.
Bug: crashpad: 31
Change-Id: I67689eb1cb97c1feefe51e355a1509d97d2a0735
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2871970
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2021-05-05 18:32:25 +00:00
Dangyi Liu
2c1261fca7 fix -Wconversion issues in util tests
Change-Id: I51a57df459f8f3a79f7d2df7a823820bccb55bd0
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2832209
Reviewed-by: Francois Rousseau <frousseau@google.com>
Commit-Queue: Scott Graham <scottmg@chromium.org>
2021-04-16 22:06:23 +00:00
Scott Graham
7743306709 fuchsia: When building on host, add dependency on libcurl
There's no default curl available when building on host Linux in the
Fuchsia tree, so add an explicit dependency when using the curl
transport in Fuchsia.

Change-Id: I0afe5e2cc8ea0a70f3ef4e1635d4d808237c93b6
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2832147
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Scott Graham <scottmg@chromium.org>
2021-04-16 22:03:23 +00:00
Justin Cohen
323e53b2f3 ios: Fix API deprecation error in iOS13.
UI_USER_INTERFACE_IDIOM is deprecated in iOS13. Instead use
-[UIDevice userInterfaceIdiom] directly.

Bug: crashpad: 31
Change-Id: I0bdcc3b3b42bd2ca87cee26abedbeb5b89632981
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2826575
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Justin Cohen <justincohen@chromium.org>
2021-04-16 17:34:03 +00:00
Robert Sesek
f1943fcb57 Remove Mac sdk_inputs dep for crashpad on iOS
The //build/confic/mac/BUILD.gn which defines this target does not
build properly in some cronet ios build configurations, and the
dependency is not necessary for ios builds.

Fixed: 1161219
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2656759
Commit-Queue: Ken Rockot <rockot@google.com>
Auto-Submit: Ken Rockot <rockot@google.com>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Cr-Commit-Position: refs/heads/master@{#848224}
Message-Id: Merged from chromium a9f64a9dbf42e411a38e3c93b131984a0a02a84a
Change-Id: Ifd03c41d42b3756cb77bb7cc3ece5d3f23b1262d
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2818147
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Robert Sesek <rsesek@chromium.org>
2021-04-09 21:11:01 +00:00
Joshua Peraza
b1c36e7478 Resurrect http_transport_libcurl
Bug: chromium:1077284
Change-Id: I19eed6072dd7854b81f7fa8c25470b18b3bc1ffd
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2037803
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2021-04-07 17:19:18 +00:00
Justin Cohen
dc02980481 ios: Move system data collector to internal.
Also fixes a usage of ->assign in the class which will be unsafe to use.

Bug: crashpad:31
Change-Id: I434df35b0669dde2323817f3c0cef1727926c85f
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2650088
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2021-03-29 16:59:37 +00:00
Jan Wilken Dörrie
2872c0ea4e [LSC] Remove base::char16 and base::string16 aliases
This change removes usages of the base::char16 and base::string16 type
aliases in favor of using char16_t and std::u16string directly.

Bug: chromium:1184339
Change-Id: Ieb790cbe2ce98d91865cd21d98616195a57b3903
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2742482
Commit-Queue: Jan Wilken Dörrie <jdoerrie@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2021-03-08 21:08:44 +00:00
Justin Cohen
9a7c3beeef ios: Get simulator device model correctly.
Use SIMULATOR_MODEL_IDENTIFIER to get the equivalent device model.

Bug: crashpad:31
Change-Id: I17950d77c214533614781a5ca41170d6c3a77ae3
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2726978
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2021-03-01 22:58:05 +00:00
Justin Cohen
adf40ba77c ios: Handle libunwind.h header changes.
Xcode 12.5 renamed __personality_routine to _Unwind_Personality_Fn
in usr/include/unwind.h

Bug: crashpad:31
Change-Id: I06a9cec7f94556dfd7c1f729069c93c61b4b0d9c
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2686121
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Justin Cohen <justincohen@chromium.org>
2021-02-10 20:08:41 +00:00
Anirudh Mathukumilli
1f28ee77ef [tracer] Fix action suppression
The previous error suppression in https://crrev.com/c/2662398 was not
sufficient to disable action tracing (see
https://fuchsia.dev/fuchsia-src/development/build/hermetic_actions?hl=en)

Bug: fuchsia:68780
Change-Id: I587a71e01a13f863dceb548d09227ea3400e31b0
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2668015
Reviewed-by: Scott Graham <scottmg@chromium.org>
Commit-Queue: Scott Graham <scottmg@chromium.org>
2021-02-02 22:48:26 +00:00
Anirudh Mathukumilli
ee563696c3 [tracer] Add suppression for crashing action
This particular action was crashing when being traced.

Bug: fuchsia:68780
Change-Id: Ia83d48b2a88f53bd8e139ea9c787429f93a24533
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2662398
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: Scott Graham <scottmg@chromium.org>
2021-02-01 23:08:35 +00:00
Justin Cohen
2d2e46b2ac ios: Fix iOS14 detection of _UIGestureEnvironmentUpdate sinkholes.
Change-Id: I3c3e46dc4bf3d321f555add137b3e436503f4195
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2429223
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Justin Cohen <justincohen@chromium.org>
2021-01-20 16:35:54 +00:00
Jan Wilken Dörrie
564d5f340f [c16lcpy] Use std::char_traits<base::char16> in c16lcpy
This change replaces calls to the deprecated base::c16memcmp,
base::c16len and base::c16memcpy in favor of using static methods on
std::char_traits<base::char16> directly.

Bug: chromium:911896
Change-Id: I739410cf41a77da9d43e59513cace086f93f0c36
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2637704
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Jan Wilken Dörrie <jdoerrie@chromium.org>
2021-01-20 13:25:24 +00:00
Braden Kell
44de18ca37 Fix instances of undefined behavior
This change removes several unaligned accesses, as well a null pointer
offset and an out of bounds array access.

Bug: fuchsia:46805
Change-Id: I0110d0b7faf672655d978894b868760eee7b2988
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2583025
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: Scott Graham <scottmg@chromium.org>
2020-12-11 19:18:19 +00:00
Robert Sesek
1e76cbbe5a mac: Depend on the //build/config/mac:sdk_inputs target for MIG actions
When using the new Goma RBE and use_system_xcode, the referenced .defs
input files are located below the root build directory and so are
considered build outputs. The sdk_inputs target is an empty action that
lets GN consider them to be generated outputs.

Bug: chromium:1157103
Change-Id: I38a959d2c00c20fa403a1c15b1eac69ef2043d5d
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2582922
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Robert Sesek <rsesek@chromium.org>
2020-12-10 14:49:27 +00:00
Mark Schott
ddcffd8675 [util] Remove redundant std::allocator type name for C++20
C++20 removed std::allocator<void>, so we need to use a void* instead.

TEST=no behavior change

Change-Id: Ifd1ee686e86ee55accab8c4b23e80000cdbdf227
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2578864
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
2020-12-08 20:18:34 +00:00
Joshua Peraza
20cbfa4971 linux: Use mmap for attachments in PtraceBroker
The broker attempts to use sbrk() to allocate memory to track ptrace
attachments. If the process failed due to an OOM, this system call might
fail, the broker falls back to saving attachments on the stack, and then
overruns the stack.

This change updates the broker to use sys_mmap() instead of sbrk(),
which is expected to work at least as well. If sys_mmap() fails or
the first mapped page is exhausted, further attachments fail without
attempting to save them to the stack.

Bug: chromium:1128441
Change-Id: Ibffaa986403adaf3178ee77e6d210053fbf60f26
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2488280
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
2020-12-03 23:24:55 +00:00
yucliu
b6f2d06996 [Android] Fix un-paired namespace declare for higher __ANDROID_API__
Bug: None
Test: Build with larger __ANDROID_API__ (29)
Change-Id: I5bfb8ad0ea5b866469191c5a385b071eec185716
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2522110
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Robert Sesek <rsesek@chromium.org>
2020-11-05 21:14:26 +00:00
Justin Cohen
d7c2340283 ios: Disable IOSExceptionProcessor SelectorExists.
Disabled while fix is being investigated.

Bug: crashpad:358
Change-Id: Ie7de5ab01b60e6f3e93096980dcdecd1eec1f171
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2505597
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Reviewed-by: Justin Cohen <justincohen@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2020-10-28 19:20:28 +00:00
Joshua Peraza
88955e6b56 Fix ThreadLogMessagesTest on Chrome OS
Previously, these tests expected a specifically formatted prefix to log
messages, but logging on Chrome OS uses a different format for the
prefix.

This change updates the tests to expect log messages at the end of a log
line, but ignores the prefix.

Change-Id: Iff748eec04d0fc5a0a786a5676a74e2aad1ec243
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2503462
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
2020-10-28 16:22:51 +00:00
Joshua Peraza
68b10080d2 Be more tidy
Change-Id: I9d2b718c36bd1dd7538241e91b984a50039068f3
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2502773
Reviewed-by: Mark Mentovai <mark@chromium.org>
2020-10-27 16:40:45 +00:00
Joshua Peraza
cdb1e7f52b fix flake in LogOutputStreamTest
LogOutputStreamTest.{WriteAbort,FlushAbort} are flaky because the logcat
is sometimes overloaded earlier than expected causing FlushAbort to fail
during Write() or either test to fail to write the abort message.

This change updates LogOutputStream to detect logcat overloads (EAGAIN)
and make one attempt at writing the abort message, even if the output
cap hasn't been reached.

This change also updates LogOutputStream's interface to defer log writes
to a Delegate. In tests, the Delegate implements a mock log and in
production, writes to Android's logcat.

I've removed VerifyGuards because LogOutputStream no longer writes
guards if Write() has never been called and the guards are tested in
other tests.

Change-Id: Icad83524aaf573c3e082469f1de095b6ca2c4839
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2439641
Reviewed-by: Mark Mentovai <mark@chromium.org>
2020-10-26 18:36:11 +00:00
Joshua Peraza
5368dc6389 handle potentially throwing functions in no_cfi_icall
Define templates for potentially throwing functions at C++17
when noexcept becomes part of a function's type.

Change-Id: I8e9cbf4b0702ad6b9b9a9d7560418908045fd11a
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2454835
Reviewed-by: Eric Astor <epastor@google.com>
2020-10-26 18:11:33 +00:00
Joshua Peraza
79d43b8ac3 Add noexcept to no_cfi_icall templates
Change-Id: I8115406303813c983bb4bb627e3b25adbdb3efee
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2441392
Reviewed-by: Mark Mentovai <mark@chromium.org>
2020-10-02 17:46:48 +00:00
Nico Weber
0e03f8e7fa Remove now-no-op set_sources_assignment_filter calls
After https://chromium-review.googlesource.com/c/chromium/src/+/2426564,
not having a sources assignments filter is the default.

No behavior change.

Bug: chromium:1018739
Change-Id: Ia2e6af0d613d3cbdfe6595bfe1f688c1efd55f39
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2446269
Reviewed-by: Mark Mentovai <mark@chromium.org>
2020-10-02 17:43:39 +00:00
Scott Graham
e6b525a4be Update config adjustments for moved build config in mini_chromium
Includes DEPS roll of mini_chromium:
f0bd14b Pull build_config.h source set into separate build file
65fb5c9 Update path to win_helper after moving to build/config

Change-Id: Ic9f5c68e2cebd8bf86492766684bdb422da1aa9e
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2426989
Reviewed-by: Mark Mentovai <mark@chromium.org>
2020-09-23 22:12:16 +00:00
Eric Astor
865ba27672 Remove unnecessary macro from CaptureContext code
The Windows implementation of CaptureContext used a macro to refer to
the offset of a field in a struct.

Bug: chromium:762167
Change-Id: I621d5c88283b1d066158559aade8811a9825c72e
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2426743
Reviewed-by: Mark Mentovai <mark@chromium.org>
2020-09-23 20:25:35 +00:00
Joshua Peraza
36d4bb83b3 Remove base dependency from no_cfi_icall
crashpad_handler_trampoline needs to use NoCfiIcall, but does not link
libstdc++ in order to remain small. A dependency on base causes link
errors in ASAN builds:

https://ci.chromium.org/p/chromium/builders/ci/android-asan/7791?

This CL depends on
https://chromium-review.googlesource.com/c/chromium/mini_chromium/+/2405651
in order to include "build/build_config.h".

Change-Id: Ie0344b7ead9c019cdda8a6e37ea8ec9cd5bf72b0
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2405650
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2020-09-21 21:25:08 +00:00
Scott Graham
1c77abe909 fuchsia: Centralize disabling of Wconversion
Because of the multiple-worlds building of the Crashpad code in the
Fuchsia tree (with the Fuchsia BUILDCONFIG.gn in particular) there's no
good location to globally disable Wconversion for all of crashpad.

This can be somewhat-improved by using a GN template
crashpad_static_library() similar to the existing crashpad_executable()
template.

Includes mini_chromium DEPS roll:
68da43e Fix a couple trucation warnings
88ce866 build: set include dirs

Bug: fuchsia:58162
Change-Id: I638fcf858c35b9a858ca2c410636f8c99603aed2
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2411131
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Scott Graham <scottmg@chromium.org>
2020-09-16 22:25:10 +00:00
Jan Wilken Dörrie
a98ee20e57 [crashpad] Prepare crashpad for base::string16 switch
This change prepares crashpad for the upcoming switch of base::string16
to std::u16string on all platforms. It does so by replacing Windows-only
instances of base::string16 with std::wstring, and using appropriate
string utility functions.

Bug: chromium:911896
Change-Id: Ibb0b8a4e4dc7fae1d24d18823f8dbb6da31f8239
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2332402
Commit-Queue: Jan Wilken Dörrie <jdoerrie@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2020-09-12 07:36:53 +00:00
Shai Barack
90344b24ed fuchsia: suppress -Wconversion warnings
Bug: fuchsia:56258
Bug: fuchsia:58162
Change-Id: I0b74e1786c169bef4e44ab54a19ffba79063474a
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2405375
Commit-Queue: Mark Mentovai <mark@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2020-09-11 22:00:00 +00:00
Joshua Peraza
3e065b11d0 linux, mac: disable cfi-icall for cross-dso calls
CFI attempts to verify that the dynamic type of a function object
matches the static type of the function pointer used to call it.

https://clang.llvm.org/docs/ControlFlowIntegrity.html#indirect-function-call-checking

However, the analyzer does not have enough information to check
cross-dso calls. In these instances, CFI crashes upon calling the
function with an error like:

pthread_create_linux.cc:60:16: runtime error:
control flow integrity check for type
'int (unsigned long *, const pthread_attr_t *, void *(*)(void *), void *)'
failed during indirect function call
(/lib/x86_64-linux-gnu/libpthread.so.0+0x9200):
note: (unknown) defined here pthread_create_linux.cc:60:16:
note: check failed in crashpad_handler,
destination function located in /lib/x86_64-linux-gnu/libpthread.so.0

Change-Id: Ib29dabfe714f2ee9cc06a5d17e6899ff81a06df4
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2339332
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2020-09-10 22:15:29 +00:00
Mark Mentovai
9a5a789123 mac: Fix MacOSVersionNumber for 10.12.0 < version < 10.13.4
In 5412beb63386, I asserted (via my code) that the kern.osproductversion
sysctl was introduced in 10.12.0, but this was utterly wrong. It’s not
available until 10.13.4. Compare 10.13.3
xnu-4570.41.2/bsd/kern/kern_sysctl.c to 10.13.4
xnu-4570.51.1/bsd/kern/kern_sysctl.c, look for osproductversion.

https://pbs.twimg.com/media/EU0GDTVU4AY73KC.jpg

Failures appeared starting at
https://ci.chromium.org/p/chromium/builders/ci/Mac10.12%20Tests/37499
(https://logs.chromium.org/logs/chromium/buildbucket/cr-buildbucket.appspot.com/8869605548532164608/+/steps/crashpad_tests_on_Intel_GPU_on_Mac_on_Mac-10.12.6/0/stdout).

This fixes expectations to not require kern.osproductversion to exist
until 10.13.4.

VM-tested on 10.12.6, 10.13.3, 10.13.4, and 10.14.0.

Bug: crashpad:347
Test: crashpad_util_test MacUtil.MacOSVersionNumber
Change-Id: Ic58d8ca8f04394d41c691dd2d946c59497ee71d5
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2402248
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2020-09-10 13:53:29 +00:00
Mark Mentovai
fc97e5cbb2 mac: Work around broken {CTL_KERN, KERN_PROCARGS2} sysctl in 11.0db6
A new bug in macOS 11.0db6 20A5364e has broken the {CTL_KERN,
KERN_PROCARGS2} sysctl such that it will not work properly unless
provided with a buffer at least 17 bytes larger than originally
indicated. Work around the bug by providing a buffer a whole 32 bytes
larger.

Bug: crashpad:347, crashpad:355
Test: crashpad_util_test ProcessInfo.{Self,SelfTask,Forked}
Change-Id: I9324a63390875308979a10fefcd4c1c880651aee
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2399646
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2020-09-09 15:56:38 +00:00
Mark Mentovai
0bc3826129 mac-arm64: Allow target_cpu = "mac_universal" to create universal builds
When building for macOS and configured with target_cpu =
"mac_universal", bi-architecture x86_64/arm64 output will be produced.

mac_universal is, so far, a “Crashpad special” that will only work with
mini_chromium and the standalone Crashpad build, and not the in-Chromium
build. It exists to support Keystone, which intends to ship as
x86_64/arm64 universal.

Includes:

Update mini_chromium to e0008f2714a76c7f2a3854fa75774427a886d6b9

e0008f2714a7 mac-arm64: Allow target_cpu = "mac_universal" to create
             universal builds

Bug: crashpad:345
Change-Id: I5ff2dce5ffae58186e33757aa94587f8eca20b99
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2387410
Commit-Queue: Mark Mentovai <mark@chromium.org>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2020-09-04 04:02:56 +00:00
Mark Mentovai
ca83774eea mac-arm64: Make MacModelAndBoard use target-type instead of board-id
Bug: crashpad:345
Test: crashpad_util_test MacUtil.MacModelAndBoard
Change-Id: I3eff29c2fc6ae646808cc9dbde8d0dbefd810962
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2386465
Commit-Queue: Mark Mentovai <mark@chromium.org>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2020-09-04 03:43:25 +00:00
Mark Mentovai
abfc89bb9b mac-arm64: Set expectations for tests that crash via __builtin_trap
__builtin_trap uses ud2 on x86_64, producing a SIGILL. On arm64, it uses
brk #1, producing a SIGTRAP. Test expectations must be adjusted
accordingly.

Bug: crashpad:345
Test: crashpad_snapshot_test MachOImageAnnotationsReader.CrashModuleInitialization, crashpad_util_test ExcServerVariants.*,ExceptionPorts.*
Change-Id: I22e75b7b48b8887031b1d95f1cea8a09733daf49
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2386464
Commit-Queue: Mark Mentovai <mark@chromium.org>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2020-09-04 03:41:05 +00:00
Mark Mentovai
e0d8a0aa01 mac-arm64: Cope with signal handling quirks
On x86_64, it’s impossible for a signal handler distinguish between
SIGBUS caused synchronously by a hardware fault and SIGBUS raised
asynchronously by software. This remains true on arm64, and is expanded
to include both SIGILL and SIGSEGV.

Bug: crashpad:345
Test: crashpad_util_test Signals.Raise_HandlerReraisesTo*
Change-Id: I181ea35121048dc0c666e2346340e698220ca650
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2386463
Commit-Queue: Mark Mentovai <mark@chromium.org>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2020-09-04 03:21:35 +00:00
Mark Mentovai
5412beb633 mac: Replace MacOSXMinorVersion with MacOSVersionNumber
MacOSXMinorVersion reported just the “y” value for an OS version 10.y.z.
This is no longer sufficient to identify OS versions accurately in macOS
11. A new MacOSVersionNumber function reports the full OS version as
“xxyyzz” for an OS version x.y.z. This is the same format used by
<Availability.h> __MAC_* macros since 10.10.

MacOSXVersion is also renamed to MacOSVersionComponents for
disambiguation and proper modern nomenclature.

Bug: crashpad:347
Test: crashpad_snapshot_test SystemSnapshotMacTest.OSVersion, crashpad_util_test MacUtil.MacOSVersionNumber
Change-Id: I66421954f021c0627095474cb26359970fcd9101
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2386386
Commit-Queue: Mark Mentovai <mark@chromium.org>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2020-09-04 02:53:35 +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
Mark Mentovai
df3bc64246 mac: Be more positive
4ae896bad0af replaced OS_MACOSX with OS_APPLE and introduced OS_MAC,
disentangled from OS_IOS. This allows !defined(OS_IOS) to be written
more directly as defined(OS_MAC) in cases where OS_APPLE is assured.

Change-Id: I8848503d3318038865dd4c8586a81ce82764af0a
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2384318
Reviewed-by: Justin Cohen <justincohen@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2020-08-31 21:16:59 +00:00
Mark Mentovai
bdf9471324 mac: Switch from <AvailabilityMacros.h> to <Availability.h>
The macOS 11.0 SDK, as of Xcode 12b6 12A8189n, has not updated
<AvailabilityMacros.h> with a MAC_OS_X_VERSION_11_0 or
MAC_OS_X_VERSION_10_16 constant. However, the <Availability.h> interface
has been updated to provide both __MAC_11_0 and __MAC_10_16.
<AvailabilityMacros.h>’s MAC_OS_X_VERSION_MAX_ALLOWED, which is supposed
to identify the SDK version, is broken in the 11.0 SDK in that whenever
the deployment target is set to 10.15 or earlier, the SDK will be
mis-identified through this interface as 10.15. When using the
<Availability.h> equivalent, __MAC_OS_X_VERSION_MAX_ALLOWED, the 11.0
SDK is identified as 10.16 (arguably it should be internally versioned
as 11.0, but at least this interface allows it to be detected
unambiguously.) It’s clear that the <AvailabilityMacros.h> interface
provides no meaningful support for the macOS 11.0 SDK at all, but
<Availability.h> does.

<Availability.h> was introduced in the Mac OS X 10.5 SDK, so there is no
relevant SDK version compatibility problem with this interface.

Key differences between these interfaces for the purposes used by
Crashpad:
 - <AvailabilityMacros.h> → <Availability.h>
 - MAC_OS_X_VERSION_MIN_REQUIRED (DT) → __MAC_OS_X_VERSION_MIN_REQUIRED
 - MAC_OS_X_VERSION_MAX_ALLOWED (SDK) → __MAC_OS_X_VERSION_MAX_ALLOWED
 - MAC_OS_X_VERSION_x_y → __MAC_x_y
 - <Availability.h> __MAC_OS_X_VERSION_* SDK/DT macros are only
   available when targeting macOS, while <AvailabilityMacros.h>
   MAC_OS_X_VERSION_* SDK/DT macros are available on all Apple platforms,
   which may be a source of confusion. (<Availability.h> __MAC_* macros
   do remain available on all Apple platforms.)

This change was made mostly mechanically by:

sed -i '' -Ee 's/<AvailabilityMacros.h>/<Availability.h>/g' \
    $(git grep -E -l '<AvailabilityMacros.h>' |
          grep -v AvailabilityMacros.h)

sed -i '' -Ee 's/(MAC_OS_X_VERSION_(MIN_REQUIRED|MAX_ALLOWED))/__\1/g' \
    $(git grep -E -l 'MAC_OS_X_VERSION_(MIN_REQUIRED|MAX_ALLOWED)' |
          grep -v AvailabilityMacros.h)

sed -i '' -Ee 's/(MAC_OS_X_VERSION_(10_[0-9]+))/__MAC_\2/g' \
    $(git grep -E -l 'MAC_OS_X_VERSION_(10_[0-9]+)' |
          grep -v AvailabilityMacros.h)

Bug: crashpad:347
Change-Id: Ibdcd7a6215a82f7060b7b67d98691f88454085fc
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2382421
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2020-08-31 21:11:29 +00:00
Shai Barack
59e8120e7a [Wconversion] Suppress warnings on Fuchsia
Bug: fuchsia:56258

Change-Id: I6bdc0b81a0294040e4dceb18576ab38c45a430e4
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2345384
Reviewed-by: Scott Graham <scottmg@chromium.org>
Commit-Queue: Scott Graham <scottmg@chromium.org>
2020-08-25 00:09:48 +00:00
Joshua Peraza
2f66eefb79 Update language to eliminate 'whitelist'
Change-Id: I6afe27313093c6867d0276274e6b17b195d9d263
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2339536
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2020-08-06 21:03:16 +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
Mark Mentovai
fd001f792e build: Make crashpad_dependencies="external" work in the GN build
…for macOS, at least.

Change-Id: Iba45328d957de17198180d171677a45468c9adc2
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2290842
Reviewed-by: Eric Astor <epastor@google.com>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2020-07-11 03:33:33 +00:00
Mark Mentovai
030c58c295 mac: Add missing #include "build/build_config.h" for ARCH_CPU_*
This #include was omitted from 0c3f50c8e14a.

Bug: crashpad:345
Change-Id: Ic3392bfc611ba847e50743ef7129263bf69c81e2
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2288393
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2020-07-08 21:01:31 +00:00
Mark Mentovai
0c3f50c8e1 mac: Crashpad for macOS on arm64, phase 2: build tests
This gets all tests building. They don’t all pass, and there aren’t any
guarantees that anything else works yet, either.

This is mostly a lot of CPU context shuffling.

Bug: crashpad:345
Change-Id: I684017a5816f44917392964d7fb6d08083770b38
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2285962
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2020-07-08 20:26:51 +00:00
Mark Mentovai
809939c9d1 mac: Crashpad for macOS on arm64, phase 1: build it
This gets all production code for Chrome building, excluding tests.
There aren’t any guarantees that anything works yet.

This is mostly a lot of CPU context shuffling.

In contrast to macOS on x86, there’s no need to support 32-bit arm on
macOS, because this new platform is 64-bit-only from its inception.

Bug: crashpad:345
Change-Id: I187239b6a969005a3458af7fe30c44147a57f95f
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2285961
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2020-07-08 16:18:40 +00:00
Robert Sesek
99ecfd3b52 apple: Convert GN libs lists to frameworks.
GN recently added support for Apple frameworks to link, rather than
overloading the libs lists. This pulls .frameworks out of the libs
lists, so that GN can stop supporting .frameworks in libs in the
future.

Roll mini_chromium ae14a14ab..cd26c5101

$ git log ae14a14ab..cd26c5101 --date=short --no-merges --format='%ad %ae %s'
2020-07-01 rsesek@chromium.org apple: Expand {{framework_dirs}} and {{frameworks}} in the toolchain.

Bug: chromium:1052560
Change-Id: Id70bceb57174a52c6f4a7f72378a3ee0ae89f64d
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2278022
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Robert Sesek <rsesek@chromium.org>
2020-07-01 19:57:26 +00:00
Mark Mentovai
09d1df04bf Use OS_WIN, not OS_WINDOWS; provide crashpad_types traits for Fuchsia
The incorrect macro was used in f4b906c79c02 (at my request when I was
reviewing from a phone).

The Windows and Fuchsia builds are broken, so…

TBR: epastor@google.com
Change-Id: I8aebbbc24db261f3c3377210bb1c477132964828
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2270920
Commit-Queue: Mark Mentovai <mark@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2020-06-27 04:56:14 +00:00
Eric Astor
f4b906c79c Avoid use of a Linux-only header in cross-platform code
Change-Id: I358ee1d7e09868e64df1f1dc6c0f49e40099ff16
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2259336
Reviewed-by: Mark Mentovai <mark@chromium.org>
2020-06-24 17:31:40 +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
Eric Astor
7409adbff3 Make kMaxSendRecvMsgFDs constexpr-accessible in external contexts
Change-Id: I474186f30f38fb61e656315ebcbdc72d6b107d4e
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2259333
Commit-Queue: Eric Astor <epastor@google.com>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2020-06-24 15:34:47 +00:00
Hans Wennborg
9520afb599 Add missing base/logging.h include
Bug: chromium:1031540
Change-Id: I7030ce615105ff96eefba2aee43361888517a846
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2257915
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Hans Wennborg <hans@chromium.org>
2020-06-22 20:12:12 +00:00
Hans Wennborg
161bfed35a Remove/replace unnecessary includes of logging.h
If the file just needs the CHECK/CHECK_OP/NOTREACHED
macros, use the appropriate header for that instead.
Or if logging.h is not needed at all, remove it.

This is both a nice cleanup (logging.h is a big header,
and including it unnecessarily has compile-time costs),
and part of the final step towards making logging.h no
longer include check.h and the others.

Bug: chromium:1031540
Change-Id: Ia46806bd95fe498bcf3cf6d2c13ffa4081678043
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2255361
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Hans Wennborg <hans@chromium.org>
2020-06-22 11:59:03 +00:00
Hans Wennborg
032f1aecc2 Include-what-you-use related to logging.h
Add direct includes for things provided transitively by logging.h
(or by other headers including logging.h).

This is in preparation for cleaning up unnecessary includes of
logging.h in header files (so if something depends on logging.h,
it needs include it explicitly), and for when Chromium's logging.h
no longer includes check.h, check_op.h, and notreached.h.

DEPS is also updated to roll mini_chromium to ae14a14ab4 which
includes these new header files.

Bug: chromium:1031540
Change-Id: I36f646d0a93854989dc602d0dc7139dd7a7b8621
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2250251
Commit-Queue: Hans Wennborg <hans@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2020-06-18 13:51:20 +00:00
Piotr Tworek
a8ff626764 Add a bunch of missing string.h includes.
There are a few files in the tree which use various functions defined
in string.h (memcpy, strlen, strnlen, memmove, etc), but never include
the necessary header file. After I've recently updated one of my systems
to a newer glibc version (2.30) this code failed to build. Adding the
missing includes fixes the problem.

The undeclared functions for each file are:
* simple_address_range_bag.h - memcpy
* http_multipart_builder.cc - strlen
* minidump_context_converter.cc - memcpy
* ptrace_client.cc - strlen
* http_transport_socket.cc - strncpy, strlen, memcpy
* process_memory.cc - memchr
* log_output_stream.cc - strlen

Change-Id: I3108c36b8a6927ac11f6839606cb495926fa9e4e
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2207139
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2020-05-18 13:54:02 +00:00
Mark Mentovai
a45eea40fc Update gtest to e3f0319d89f4cbf32993de595d984183b1a9fc57
I’m most interested in picking up 1b3eb6ef3462, “Explicitly define copy
constructors used in googletest tests.”

This also reorganizes files and rewrites text to refer to this project
as Google Test and googletest (and Google Mock and googlemock), as it
prefers to be known. Some filenames are left at gtest_* following the
precedent set by gtest itself. For example, #include "gtest/gtest.h" is
still used, so #include "test/gtest_death.h" is retained too.
gtest_all_test OutputFileHelpersTest.GetCurrentExecutableName hard-codes
the expected executable name as gtest_all_test among other options that
do not include googletest_all_test, so test executables retain their
names as well.

fb19f57880f6 Add GTEST_BRIEF option
3549237957a1 Ensure that gtest/gmock pkgconfig requirements specify
             version
189299e957bb Merge branch 'master' into quiet-flag
5504ded3ab5c Fix a typo in .travis.yml
6ed4e7168f54 Replace the last instance of `throw()` with `noexcept`. NFC
879fd9b45299 Remove duplicate codes existed in get-nprocessors.sh
644f3a992c28 gtest-unittest-api_test - fix warning in clang build
0b6d567619fe Remove redundant .c_str()
be3ac45cf673 fix signed/unsigned comparison issue (on OpenBSD)
b51a49e0cb82 Merge pull request #2773 from Quuxplusone:replace-noexcept
c2032090f373 Merge pull request #2772 from Quuxplusone:travis
4fe5ac53337e Merge pull request #2756 from Conan-Kudo:fix-pkgconfig-reqs
373d72b6986f Googletest export
4c8e6a9fe1c8 Merge pull request #2810 from ptahmose:master
71d5df6c6b67 Merge pull request #2802 from e-i-n-s:fix_clang_warning
dcc92d0ab6c4 Merge pull request #2805 from pepsiman:patch-1
4f002f1e236c VariadicMatcher needs a non-defaulted move constructor for
             compile-time performance
9d580ea80592 Enable protobuf printing for open-source proto messages
766ac2e1a413 Remove all uses of GTEST_DISALLOW_{MOVE_,}ASSIGN_
11b3cec177b1 Fix a -Wdeprecated warning
01c0ff5e2373 Fix a -Wdeprecated warning
c7d8ec72cc4b Fix a -Wdeprecated warning
1b066f4edfd5 Add -Wdeprecated to the build configuration
4bab55dc54b4 Removed a typo in README.md
a67701056425 Googletest export
fb5d9b66c5b0 Googletest export
1b3eb6ef3462 Googletest export
b0e53e2d64db Merge pull request #2797 from Jyun-Neng:master
d7ca9af0049e Googletest export
955552518b4e Googletest export
ef25d27d4604 Merge pull request #2815 from Quuxplusone:simple
129329787429 Googletest export
b99b421d8d68 Merge pull request #2818 from inazarenko:master
472cd8fd8b1c Merge pull request #2818 from inazarenko:master
3cfb4117f7e5 Googletest export
0eea2e9fc634 Googletest export
a9f6c1ed1401 Googletest export
1a9c3e441407 Merge pull request #2830 from keshavgbpecdelhi:patch-1
e589a3371705 Merge pull request #2751 from calumr:quiet-flag

Change-Id: Id788a27aa884ef68a21bae6c178cd456f5f6f2b0
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2186009
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2020-05-07 14:56:07 +00:00
Justin Cohen
95b4e62768 ios: CaptureContext arm64.
Change-Id: I2db8ead3103391af4d198f213524ea34ffef022b
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2167211
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2020-05-03 19:21:45 +00:00
Mark Mentovai
2f217736a3 ios: Deal with ios_enable_relative_sdk_path in Chromium
Change-Id: Ibb03748d8881c4a71662a7d6ad5743107ccd748d
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2174267
Reviewed-by: Nico Weber <thakis@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2020-05-02 00:34:22 +00:00
Mark Mentovai
174a92d296 mac, ios: Add ExceptionPorts::SwapExceptionPorts
Change-Id: Ia4044c82440af1d05c24ee502d51eef5185cbeec
Test: crashpad_util_test ExceptionPorts.*_Swap*
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2170546
Reviewed-by: Justin Cohen <justincohen@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2020-04-28 16:43:41 +00:00
Mark Mentovai
57e807da6d ios: Build (and test) SymbolicConstantsMach
Bug: crashpad:31
Test: crashpad_util_test SymbolicConstantsMach.*
Change-Id: Ia76a5fb2d5ca2afdd06d99dab9ab1b72cd5a6f0d
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2169867
Reviewed-by: Justin Cohen <justincohen@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2020-04-28 16:43:32 +00:00
Mark Mentovai
ecc41d0229 doc: Update Doxygen to 1.8.18 and fix Doxygen warnings
% doxygen -u doc/support/crashpad.doxy
[…warnings about removing obsolete TCL_SUBST, PERL_PATH, MSCGEN_PATH…]
Configuration file 'doc/support/crashpad.doxy' updated.
% doxygen -v
1.8.18

Change-Id: I771f654713042b0040873355051b9efaf46bffd1
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2165817
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2020-04-27 16:45:20 +00:00
Mark Mentovai
a5a1c3b07f Add .style.yapf and reformat according to yapf, using “google” style
% yapf --in-place $(git ls-files **/*.py)
% yapf --version
yapf 0.30.0

Note that this is not using the “chromium” yapf style because Chromium
is moving to PEP-8.
https://groups.google.com/a/chromium.org/d/topic/chromium-dev/RcJgJdkNIdg
yapf 0.30.0 no longer recognizes “chromium” as a style option.
22ef70f3c4
Since this is a mass reformatting, it might as well move things all the
way into the future all at once.

This uses the “google” style, which is a superset of “pep8”.

Change-Id: Ifa37371079ea1859e4afe8e31d2eef2cfd7af384
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2165637
Commit-Queue: Mark Mentovai <mark@chromium.org>
Reviewed-by: Scott Graham <scottmg@chromium.org>
2020-04-27 13:59:09 +00:00
Mark Mentovai
29b1688c11 Replace remaining uses of NULL with nullptr
I did a mass conversion in 5d74f120fc57 (October 2014) but these few
must have shown up after.

This excludes code in third_party.

Change-Id: I61cb0273804c0424904a516ed5ab735548b6b9cb
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2166725
Reviewed-by: Justin Cohen <justincohen@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2020-04-27 13:58:49 +00:00
Justin Cohen
be57546fea ios: Fix Chromium banned warning about NULL.
Change-Id: I29eefb067b171fb3d8ef9fa93c3bb146a206c9ce
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2166724
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2020-04-27 03:23:29 +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
Scott Graham
069fddf184 fuchsia: Remove unused sysinfo dep
This was previously used, but is no longer required. Delete the one
remaining include at the build rules.

Change-Id: If5083a4fb8a5562d3e40149976bd27fcec0fd302
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2165635
Reviewed-by: Mark Mentovai <mark@chromium.org>
Reviewed-by: Francois Rousseau <frousseau@google.com>
Commit-Queue: Scott Graham <scottmg@chromium.org>
2020-04-24 20:00:17 +00:00
Mark Mentovai
adfd94a357 ios: Use compat to provide items missing from the iOS SDK
This updates the way that the .defs files added in 1bfd7d06ed60 are
treated, by putting them in compat/ios, using compat as intended. The
.defs files in compat forward, via #include, to the ones in
third_party/xnu. Additionally, compat/mac is enabled for iOS, as
everything in compat/mac is sensible on iOS, and will have no effect
when rendered unnecessary by the iOS SDK.

This also changes util:mig_output to a static_library instead of a
source_set. I don’t think there was any reason for it to have been a
source_set to begin with. static_library is preferred for nearly
everything.

Bug: crashpad:31
Change-Id: I7c468d6d6785bf2bc825d45831ebb81e1c9ddfbc
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2160310
Reviewed-by: Justin Cohen <justincohen@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2020-04-22 16:09:05 +00:00
Mark Mentovai
64b8791f45 ios: Build util/mach/exc_server_variants.cc, support code, and tests
This makes UniversalMachExcServer available on iOS.
UniversalMachExcServer is the foundation for a Mach exc and mach_exc
server.

Some code in UniversalMachExcServer needs to be evaluated to ensure that
portions that run in the same process that has sustained the exception
are safe to do so at that time. For example,
SimplifiedExcServer<ExcTraits>::Interface instantiates and appends to a
std::vector<>, which is generally unsafe in this context. However, that
code responds to exc requests. The mach_exc equivalent,
SimplifiedMachExcServer<MachExcTraits>::Interface, does not use a vector
at all.

This also enables support code in the form of CompositeMachMessageServer
and UniversalExceptionRaise, all of the tests for
CompositeMachMessageServer, and most of the test for
exc_server_variants.cc. The multiprocess-based exc_server_variants tests
remain disabled on iOS.

Bug: crashpad:31
Change-Id: I838ed770a33ca29c37383c32245eb340fb3ad2fb
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2159287
Reviewed-by: Justin Cohen <justincohen@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2020-04-21 19:26:24 +00:00
Mark Mentovai
1bfd7d06ed ios: Run mig with the correct SDK and architecture
mig was being invoked without any -arch argument, causing it to assume
the build system’s native architecture, which would be x86_64. This is
not correct for iOS device builds, which use arm64. The -arch argument
must be plumbed to mig for correct behavior.

When building for iOS, mig was being invoked without any -isysroot
argument, causing it to use the root for the build system, which runs
macOS and not iOS. The macOS SDK doesn’t include the ARM definitions
needed for iOS device builds.

<mach/exc.defs> and <mach/mach_exc.defs> depend on a small number of
other .defs files to provide definitions of standard types. All .defs
files are absent from the iOS SDK. These .defs files are borrowed from
xnu and placed in third_party/xnu. An additional --include argument is
added to allow mig to locate these files.

Bug: crashpad:31
Change-Id: I27154310352939ebe2fb6329bbbfda701c369289
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2159291
Reviewed-by: Justin Cohen <justincohen@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2020-04-21 19:24:44 +00:00
Mark Mentovai
3e748e9c4e ios: Provide a copy of mach_exc.defs and run mig on it
This updates (and corrects) 8dbbaff2e1a5, which added exc.defs, by
adding mach_exc.defs too.

The difference betwen the exc and mach_exc subsystems is that the |code|
parameter is int[] in exc and int64_t[] in mach_exc. Many exceptions
carry the exception address in code[1], and a 32-bit int results in the
exception address being truncated in exc. No information is lost in
mach_exc, where a 64-bit int64_t is used.

In 8dbbaff2e1a5, I misremembered the type of the |code| parameter as a
type derived from uintptr_t, such as vm_address_t, an integer as wide as
a pointer. I was wrong, and mach_exc is necessary. I also noted that
Apple normally forbids mach_-prefixed interfaces in favor of the
prefix-less ones for the reasons I mentioned, and that, all else being
equal, it was desirable to adhere to the spirit of that convention.
Because neither exc nor mach_exc are available in the SDK, it’s moot
from a technical perspective, as we need to provide our own stubs either
way.

Bug: crashpad:31
Change-Id: Ied1be470e653b2bead1a283cb8b9283d210c328d
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2159286
Reviewed-by: Justin Cohen <justincohen@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2020-04-21 19:23:24 +00:00
Mark Mentovai
4cb79941fc ios: Build four more Mach message and exception utilities
This enables the following code in util/mach on iOS:
 - exception_behaviors.{cc,h}
 - exception_ports.{cc,h}
 - mach_message.{cc,h}
 - mach_message_server.{cc,h}

Only the ExceptionBehaviors and MachMessage tests are built, because the
other two are tested by multiprocess tests that won’t run on iOS.

The AuditPIDFromMachMessageTrailer function from mach_message.h is
excluded on iOS because it relies on <bsm/libbsm.h>, which is broken on
iOS: it depends on <bsm/audit_record.h>, which is missing from the SDK.
Additionally, the BSM function that Crashpad uses, audit_token_to_au32,
is marked as unavailable on iOS. Crashpad uses it on macOS to
authenticate Mach messages sent by other processes, but this is moot on
iOS.

Bug: crashpad:31
Change-Id: I5ebc4b80543989b9cd0b85b82eb4b3ff98c44e6c
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2155086
Reviewed-by: Justin Cohen <justincohen@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2020-04-18 03:27:59 +00:00
Mark Mentovai
8dbbaff2e1 ios: Provide a copy of exc.defs and run mig on it to generate exc stubs
The iOS SDK doesn’t include a copy of <mach/exc.defs>. It only provides
<mach/exc.h>, which is just the user-side header. To obtain declarations
and implementations of the server-side stubs, a current copy of
<mach/exc.defs> is added to third_party, and the mig action in util is
updated to use it on iOS.

The three other mig subsystems that Crashpad uses are not brought to
iOS:
 - mach_exc is identical to exc except it always uses 64-bit quantities
   for addresses in place of exc’s use of quantiies sized for native
   pointers. Because all iOS work is limited to a single process, there
   is no need to consider cross-process operation with variable bitness,
   so mach_exc is unnecessary. We’re also only targeting 64-bit for iOS,
   so exc will always suffice. This follows the spirit of other
   mach_-prefixed routines on iOS, where Apple forbids mach_vm_read to
   user applications but permits vm_read.
 - notify is primarily used on macOS in the Crashpad handler process to
   receive a no-senders notification, which is used to trigger handler
   shutdown when it has no more clients. This is not believed to be
   useful to Crashpad on iOS, which is restricted to single-process
   operation.
 - child_port is a Crashpad-specific subsystem used to pass Mach rights
   between processes, but is similarly useless when restricted to
   single-process operation as on iOS.

Bug: crashpad:31
Change-Id: Id4cb3cdd529814438d378c20702c82c1e89dd2be
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2154530
Commit-Queue: Mark Mentovai <mark@chromium.org>
Reviewed-by: Justin Cohen <justincohen@chromium.org>
2020-04-17 21:11:57 +00:00
Mark Mentovai
ba24acb86c ios: Split bootstrap out from mach_extensions
mach_extensions is sensible on iOS, but bootstrap is not available
outside of macOS. To allow mach_extensions to be used cleanly on iOS,
the bootstrap code is moved into its own macOS-specific file.

Bug: crashpad:31
Change-Id: I7bf9d5194253b563954a1e55fbf67a16f686e8ff
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2154529
Reviewed-by: Justin Cohen <justincohen@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2020-04-17 20:54:47 +00:00
Mark Mentovai
122a400d7b ios: Enable (and test!) more of util and test
This builds some code in the util and test libraries on iOS that was
previously excluded. It also enables tests for this code, and other
tests that it was possible to enable either previously or as a result of
this change.

Previously, crashpad_util_test ran 178 tests from 46 test suites, and
crashpad_test_test ran 2 tests from 2 test suites. Now,
crashpad_util_test runs 284 tests from 62 test suites, and
crashpad_test_test runs 6 tests from 4 test suites.

The related .gn files also suffered through a slight cleanup.

Bug: crashpad:31
Change-Id: I84cdda5631f0ea4888ada902a8462776ac46fd2a
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2154526
Reviewed-by: Justin Cohen <justincohen@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2020-04-17 20:54:17 +00:00
Justin Cohen
ea4af71c2a Add another iOS library path sinkhole.
Add another sinkhole for _UIGestureEnvironmentUpdate.

Bug: crashpad:31
Change-Id: Ic4a424da034249295b6e45f8fe0860a4d4696b93
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2145017
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
Reviewed-by: Justin Cohen <justincohen@chromium.org>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2020-04-16 15:25:57 +00:00
Mark Mentovai
e621aaa132 Make “gn check” pass
Change-Id: Ia7a215e1a2d0a3b1868b00c5d47b46ef8a675cdc
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2144917
Reviewed-by: Justin Cohen <justincohen@chromium.org>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2020-04-13 18:29:42 +00:00
Justin Cohen
b2fd7d5307 [ios] Bring up first half of UncaughtExceptionHandler.
When code raises an Objective-C exception, unwind the stack looking for
any exception handlers. If an exception handler is encountered, test to
see if it is a function known to be a catch-and-rethrow 'sinkhole'
exception handler. Various routines in UIKit and elsewhere do this, and
they obscure the exception stack, since the original throw location is
no longer present on the stack (just the re-throw) when Crashpad
captures the crash report. In the case of sinkholes, trigger an
immediate exception to capture the original stack.

The is an improvement over the alternative,
NSSetUncaughtExceptionHandler, which passes along the stack frames, but
not the stack memory contents and full exception context itself.

The details of what happens after a fatal exception is triggered are
unresolved in this CL.  For now, simply call std::terminate.

This code was inspired by chromium/src/chrome/browser/mac/
exception_processor.mm.

Bug: crashpad:31
Change-Id: Ieebc6476a0507c466c8219c10f790ec0a624e58c
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2125254
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2020-04-08 20:57:21 +00:00
Joshua Peraza
c4cc4e6ac9 android: initialize signal dispositions
Bionic installs signal handlers which request crash
dumps from Android's debuggerd, but there are errors
in how signals which aren't automatically re-raised
are handled on Marshmallow (API 23).

Before requesting a dump, Bionic acquires a lock to
communicate with debuggerd and expecting imminent
death, never releases it.

While handling the dump request, debuggerd allows
the dying process to continue before
ptrace-detaching it. So, when Bionic manually
re-raises a signal, it is intercepted by debuggerd
and the dying process is allowed to live.

Bionic restores SIG_DFL for the signal it's just
handled, but if a different crash signal is later
recieved, Bionic attempts to reacquire the lock to
communicate with debuggerd and blocks forever.

Disable Bionic's signal handlers for these signals
on Marshmallow.

Bug: chromium:1050178
Change-Id: Ia1fc5a24161a95931684d092ba8fee2f0dfbbdbb
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2134513
Reviewed-by: Mark Mentovai <mark@chromium.org>
2020-04-08 17:21:05 +00:00
Justin Cohen
af62d7fcf6 Correct use of -[NSString UTF8String].
Fixes the chromium presubmit error for UTF8String:
 The use of -[NSString UTF8String] is dangerous as it can return null
 even if |canBeConvertedToEncoding:NSUTF8StringEncoding| returns YES.
 Please use |SysNSStringToUTF8| instead.

Bug: crashpad:31
Change-Id: Iaf939012ea9d342f6a01af58119cef962319aefe
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2119613
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Justin Cohen <justincohen@chromium.org>
2020-03-26 04:19:33 +00:00
Justin Cohen
d9c1ca1216 [ios] Bring up first draft system snapshot and iOS data collector.
Gather most of the necessary information for the system 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 thread_snapshot may end up in a
   different file completely, but until we pick a
   serialization/deserialization method, keep it as-is.

Bug: crashpad:31
Change-Id: Iac82491fdb4a823163f02149f52a1e18e26fa9de
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2090173
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2020-03-25 20:31:06 +00:00
Joshua Peraza
b75c578373 linux: disable arguments test on old kernels
Bug: chromium:1050178
Change-Id: Ideafa5971cbaf76fa6865f671158958e7abb3a8c
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2117366
Reviewed-by: Mark Mentovai <mark@chromium.org>
2020-03-24 21:05:17 +00:00
Nico Weber
2965013518 Prepare crashpad mig stuff for -Wunreachable-code in chromium_code.
Bug: chromium:346399
Change-Id: I5d93a2f6781dd4dd3483009d9c470050d490be3c
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2116252
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Nico Weber <thakis@chromium.org>
2020-03-23 20:18:51 +00:00
John Bauman
9a31d3f8e9 Print thread state after failure to suspend
This may help us debug some issues where the thread is failing to
suspend.

Bug: b/151318587
Change-Id: I0d2d539f769ebb1cdd71606e1d23d8fa66673879
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2103411
Commit-Queue: John Bauman <jbauman@chromium.org>
Reviewed-by: Scott Graham <scottmg@chromium.org>
2020-03-13 22:48:26 +00:00
Joshua Peraza
7500e2ef45 linux: add fallback-modes for memfd_create
Bug: chromium:1051354
Change-Id: I5dbbb3b264c09060429db199aa9f046c2f317c48
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2080651
Reviewed-by: Mark Mentovai <mark@chromium.org>
2020-03-03 18:09:45 +00:00
Justin Cohen
3c573b54ae [ios] Fix iOS device build.
Change-Id: Ib0f5af9680b4b626df2da006789eb846cd38579d
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2081269
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Justin Cohen <justincohen@chromium.org>
2020-03-03 02:11:41 +00:00
Leonard Chan
8bad6f140e [UBSan] Temporarily disable UBSan for gtest and file
These should be the remaining instances of UB errors we see.

Bug: fuchsia:46805
Change-Id: Id8285386fd6cb52518f6076ddb79ac60025f9f87
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2067754
Reviewed-by: Scott Graham <scottmg@chromium.org>
Commit-Queue: Scott Graham <scottmg@chromium.org>
2020-02-24 17:26: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
faed21a286 linux: Log register sizes on mismatch
Bug:1051354
Change-Id: Ia7731a87420e61756b61d109f9c69970ec27c6cb
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2062776
Reviewed-by: Mark Mentovai <mark@chromium.org>
2020-02-18 19:38:58 +00:00
Joshua Peraza
07812f5bd6 android: fix the gyp build
Change-Id: Ic54fd61258f4ea5b3aaa83a252faa0053ca1f552
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2062773
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2020-02-18 19:24:21 +00:00
Nico Weber
7ed4d5c454 arm: Properly mark _ZN8crashpad14CaptureContextEP10ucontext_t as %function
lld wants to remove bl/blx substitution for non-function symbols
(https://reviews.llvm.org/D73542). GNU ld apparently already doesn't
do it.

Since _ZN8crashpad14CaptureContextEP10ucontext_t wasn't marked as a function,
chromium's thumb code would then branch without mode transition into
crashpads non-thumb assembly (in arm32).

So mark the symbol as function, so that things work even if that patch
relands. This should also make things work with GNU ld, though I haven't
verified that it was broken before and works now.

I also did this for aarch64 since it seems like The Right Thing To Do
(assuming the assembler accepts it, which I also haven't checked --
the CQ will hopefully check that).

Bug: chromium:1049649
Change-Id: I3452c16f0d52a2dc0397fd3d60d06b5c39a4b524
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2044144
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Nico Weber <thakis@chromium.org>
2020-02-07 23:42:19 +00:00
Tao Bai
915862984c [log minidump] add option to log minidump in handler_main
- Add option to log minidump in handler_main, also add option to
  disable to dump minidump and generate report.
- Implement log minidump in CrashReportExceptionHandler.

Bug: crashpad:308
Change-Id: I8d2f7e118912011a8416f1ec36c9ee9d561d06e6
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1995825
Commit-Queue: Tao Bai <michaelbai@chromium.org>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2020-01-30 18:06:58 +00:00
Nico Weber
2fd16e3392 Reformat all gn files
Port of chromium-side
https://chromium-review.googlesource.com/c/chromium/src/+/1997899

Bug: chromium:1041419
Change-Id: Ic7afefa0dea024da37fe4bb0f965840a160e2166
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2015428
Commit-Queue: Mark Mentovai <mark@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2020-01-23 13:59:00 +00:00
Tao Bai
b411976ca5 [log minidump] add tool to encode/decode minidump log.
- This tool could compress/encode or decode/decompress the minidump
  log file, will be used by script to symbolize the crash.
- Added FileOutputStream and FileEncoder.

Bug: crashpad:308
Change-Id: I15c3e4908882a09983ec81a90e38249967c29fc4
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1968059
Commit-Queue: Tao Bai <michaelbai@chromium.org>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2019-12-18 22:16:48 +00:00
Joshua Peraza
d3d0c8d3ca android: don't expect code addresses to be readable
Change-Id: I252a93db5f4166216664ae8f67e331fc7eed8852
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1967548
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
2019-12-13 18:58:42 +00:00
Tao Bai
fa28ef896c [log minidump] LogOutputStream implementation
Emit the received data to Android logcat in Android, and noop for
other platforms.

Bug: crashpad:308
Change-Id: I6e46e2fa8bd61f93f614ad0bfb6441a79139b04b
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1958711
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2019-12-12 23:04:38 +00:00
James Forshaw
c6153f0b6e [Windows] Add AppContainer SID to Named Pipe DACL.
This CL modifies the creation of the Named Pipe Security Descriptor to
allow access from AppContainer processes. The DACL only allows access for
the current user and SYSTEM which matches up with the auto-assigned DACL
used previously (the read-only logon SID ACE has been removed). As this
new code uses APIs from ADVAPI32 a check is made to ensure it's not being
called while the loader lock is held to avoid hitting previous similar
issues.

Bug: crashpad: 318
Change-Id: I3f9cf5c788dbadacad21c8a2d57a0188f690ac32
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1955982
Commit-Queue: James Forshaw <forshaw@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2019-12-10 17:16:24 +00:00
Tao Bai
3e4d6a9b7f [log minidump] Base94OutputStream implementation
Add Base94 encoding/decoding implementation and tests.

Bug: crashpad:308
Change-Id: If3f25efcb277eacd5d8cbe1d66f22919872c7d64
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1796682
Commit-Queue: Tao Bai <michaelbai@chromium.org>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2019-12-06 19:27:33 +00:00
Mark Mentovai
31470459b6 Fix line endings on files introduced in 359fc4a1336d
"\r\n" was used instead of "\n" on four new files.

No other "\r" appears in any text file, repository-wide.

Bug: crashpad:316
Change-Id: I94f5d20cd2498e76efdee6062382669362e6e53d
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1954713
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2019-12-06 04:24:30 +00:00
Joshua Peraza
bcab7ad54c linux: handle large mapped files
Chrome on Android normally builds the handler without large file
support because support for large files varies by API level and NDK
version.

https://cs.chromium.org/chromium/src/build/config/compiler/BUILD.gn?rcl=6b5017edcd8544acbdb157086a1645ce36c03057&l=360

https://android.googlesource.com/platform/bionic/+/master/docs/32-bit-abi.md#32_bit-and

The handler still needs to able to handle large files mapped by other
code modules.

Bug: crashpad:312
Change-Id: I1022b706797f41445650f82c425a92e6e2308618
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1954426
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
2019-12-05 21:33:20 +00:00
James Forshaw
359fc4a133 [Windows] Add checks for DLL loader lock.
This CL adds code to check if the current thread holds the DLL loader
lock. This code can be used to enforce the requirement that certain
parts of crashpad, such as process creation are not done during calls
to DllMain which can lead to deadlocks and crashes. Only one check is
current enforced, in client process creation, and only in debug builds.

Bug: crashpad: 316
Change-Id: I5757a264bbf28ce2ab88a0cd7ac9481e46428c17
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1945993
Reviewed-by: Mark Mentovai <mark@chromium.org>
Reviewed-by: Scott Graham <scottmg@chromium.org>
Commit-Queue: James Forshaw <forshaw@chromium.org>
2019-12-03 21:42:32 +00:00
Joshua Peraza
74490f00a4 linux: roll lss and use sys_sigtimedwait/sys_sigprocmask
Bug: crashpad:265
Change-Id: I4b8f566e2a211cca96eef8a2c1098408a38bcf23
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1914840
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
2019-11-13 22:10:54 +00:00
Joshua Peraza
2291bfa32e android, gyp: fix the build
Change-Id: If852448b5719310b73774cac635ef9c52a3efc22
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1914349
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
2019-11-13 21:16:24 +00:00
Joshua Peraza
93f8aa8df9 posix: fix parameter name in signals test
Change-Id: I6e998571171c9a725d88a9529c73d01c62ee984f
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1905146
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
2019-11-08 04:02:38 +00:00