2410 Commits

Author SHA1 Message Date
David Benjamin
d5b2eea537 Fix another argument-dependent-lookup dependency
Missed this the first time around because it was Windows-only.

Bug: chromium:691162
Change-Id: Ic98a5943957f77fbf17d92a93409eaa35910ae0e
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4297482
Commit-Queue: David Benjamin <davidben@chromium.org>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2023-03-15 16:54:50 +00:00
Justin Cohen
3cd7b5bf7f ios: Fix crash in ObjcExceptionPreprocessor.
ObjcExceptionPreprocessor is a 'reasonable effort' attempt to catch an
NSException minidump at time the exception is thrown as opposed to when the application terminates due to the exception. If multiple
exceptions are thrown at the same time, Crashpad should correctly
report the final uncaught exception, but the minidump may not
represent the full `caught-at-thrown` minidump.

 - Don't assume ObjcExceptionPreprocessor throws an NSException.
 - Don't retain/release the exception. Instead of calling isEqual,
   just use a simple pointer comparison.
 - Make last_exception atomic.

Bug: crashpad: 445, 446
Change-Id: I9f2f2041e96aa9818c63937025e507487ae9d03d
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4317110
Reviewed-by: Ben Hamilton <benhamilton@google.com>
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2023-03-15 00:49:36 +00:00
Peter Kasting
322eaa5850 Use thread_local instead of ThreadLocalStorage::Slot.
This also significantly simplifies the implementation, since we don't
really need the ThreadLogMessagesMaster class at all.

Bug: chromium:1416710
Change-Id: I85849230015f901dfbf084d140e639f14cb872a7
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4313281
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Peter Kasting <pkasting@chromium.org>
2023-03-07 02:40:30 +00:00
Joemer Ramos
3e54a2cd1b ios: Support minimum deployment targets of iOS15
The windows property of UIApplication is unavailable in iOS15.

Bug: 1406561 crashpad:
Change-Id: I19642067a13801142cd3f24586bab6958a81635d
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4304398
Reviewed-by: Justin Cohen <justincohen@chromium.org>
Commit-Queue: Joemer Ramos <joemerramos@chromium.org>
2023-03-03 19:56:37 +00:00
Miriam Zimmerman
707d0d4dac Restrict new crash_reporter flag to valid versions
Lacros can be up to 2 milestones ahead of ash (and consequently the
platform code), so until the crash_reporter change has been in for 2
milestones, we need to manually check version compatibility.

BUG=chromium:1420445
TEST=Build, deploy, check that flag is set only on right version

Change-Id: Ic99d5ac58840814f7eeecd47c628ea0e8107f675
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4308129
Commit-Queue: Mark Mentovai <mark@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2023-03-03 18:47:42 +00:00
David Benjamin
90bba04e22 Fix some accidental uses of argument-dependent lookup
StringToInt(string_piece) works because base::StringPiece is in
namespace base, but when it is switched to std::string_view, this won't
work anymore. Use the idiomatic spelling.

Bug: chromium:691162
Change-Id: Ic45e0d2729fa5fc7c3e7a56fe159957b1bdcdf94
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4298113
Commit-Queue: David Benjamin <davidben@chromium.org>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2023-02-28 22:02:28 +00:00
Justin Cohen
9830fbf3b4 ios: Suppress log-if-missing for kSourceVersion intermediate dump key.
It's not required that LC_SOURCE_VERSION be present in every module, and
common for it to be missing. Suppress recording its absence.

Fixed: crashpad:443
Change-Id: Iae10c38c78514e78af6c3176cc809d95a3ae3811
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4294861
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Justin Cohen <justincohen@chromium.org>
2023-02-27 21:08:24 +00:00
Miriam Zimmerman
7a997fb253 Report exception number in metadata on CrOS.
In order to determine in crash_reporter whether a crash was fatal, we
need the exception number (-1 is not an actual crash).

BUG=b:269159625
TEST=deploy to DUT; chrome://crashdump; verify metadata present.

Change-Id: I83d3c9cc839a685af2f50d143d627cf9fcfaf3ac
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4265253
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Miriam Zimmerman <mutexlox@chromium.org>
2023-02-27 15:57:05 +00:00
bsheedy
448d2d90da Add dump_minidump_annotations
Adds the dump_minidump_annotations tool (modified from jperaza's WIP
code). This works similarly to Breakpad's minidump_dump tool, but:

1. Is available on Windows
2. Only dumps simple/vectored annotations and annotation objects instead
   of the entire minidump contents.

Current use case for this is to be able to get a minidump's process
type on Windows without having to go through symbolization, but there
may be other use cases in the future.

Bug: chromium:1006331
Change-Id: I392024e230c10ea18673b3cf0d0ad4793d21f5eb
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4287994
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Brian Sheedy <bsheedy@chromium.org>
2023-02-24 22:38:24 +00:00
Robert Sesek
3e8727238b win: Only process up to EXCEPTION_MAXIMUM_PARAMETERS in an EXCEPTION_RECORD
The EXCEPTION_RECORD contains a NumberParameters field, which could
store a value that exceeds the amount of space allocated for the
ExceptionInformation array.

Bug: chromium:1412658
Change-Id: Ibfed8eb6317e28d3addf9215cda7fffc32e1030d
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4284559
Reviewed-by: Alex Gough <ajgo@chromium.org>
Commit-Queue: Robert Sesek <rsesek@chromium.org>
2023-02-23 00:47:44 +00:00
Justin
70e0f92153 Fix StringPiece compile issue in Chromium.
Change-Id: I5a29f690a4512252d0d5730492f7fd4cec16ffaa
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4262547
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2023-02-16 20:19:10 +00:00
Elly Fong-Jones
04b2ab5bba port: fix non-glibc desktop linux build
This is the only change needed to build crashpad against musl, yay! The
reason this change is needed is that user_vfp is bionic-specific, and
does not exist in glibc, dietlibc, uclibc, or musl.

I have not (yet) tried running the tests against another libc.

Bug: chromium:1380656
Change-Id: I2247352e1611a300dff995156d393508c8257039
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4255370
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Elly Fong-Jones <ellyjones@chromium.org>
2023-02-15 22:41:03 +00:00
Ben Hamilton
485805c6fe Fix test that relied on NDEBUG always disabling DCHECK
The test BaseAnnotationShouldNotSupportSpinGuard assumed NDEBUG builds
always disabled DCHECK()s, but DCHECK_ALWAYS_ON overrides this.

This CL fixes the test for NDEDBUG + DCHECK_ALWAYS_ON builds by using
the DCHECK_IS_ON() macro to skip the test when DCHECKs are enabled.

Change-Id: I7b64729568c5d3139ca777e27462d81eba931834
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4255429
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Ben Hamilton <benhamilton@google.com>
2023-02-15 20:42:52 +00:00
Justin Cohen
0adab59836 ios: Validate exception code buffer size before read.
Bug: 1415371
Change-Id: I9e1bd902494a664d4f07829e686803712fa8e7a8
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4255568
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Justin Cohen <justincohen@chromium.org>
2023-02-15 18:13:45 +00:00
Ben Hamilton
c7d9c710f2 [ios] Support guarding concurrent reads and writes to Annotations
Since iOS reads Annotations in-process, this CL updates the iOS
intermediate dump handler to check each Annotation to see if it supports
guarding concurrent reads and writes using ScopedSpinGuard.

For any such Annotation, the in-process dump handler now tries (without
spinning) to obtain the ScopedSpinGuard for the Annotation before
reading its memory.

If the ScopedSpinGuard cannot immediately be obtained, the in-process
dump handler just skips writing the memory of the Annotation to the
intermediate dump. (I'd like to follow up and thread down a Params
object so we can experiment with adding an optional timeout to make
this more reliable.)

Change-Id: Ie6c9849fac94ab89b36364b07aea62326cabe552
Bug: crashpad:437
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4031730
Commit-Queue: Ben Hamilton <benhamilton@google.com>
Reviewed-by: Mark Mentovai <mark@chromium.org>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2023-02-01 19:27:26 +00:00
Ben Hamilton
212b8f6b8c [client] New RingBufferAnnotation
This CL integrates the new ScopedSpinGuard with the new
LengthDelimitedRingBuffer into a new class, RingBufferAnnotation.

RingBufferAnnotation is thread-safe both for reading and writing, and is
suitable for streaming logs, trace events, and other high-throughput
data streams.

I included a load test (ring_buffer_annotation_load_test) which launches
two threads which simultaneously write to and read from the
RingBufferAnnotation.

By default, reads and writes are serialized using ScopedSpinGuard, but
passing the flag "--disable_spin_guard" to the test disables the spin
guard on the reading side (which is expected to make the test fail).

Change-Id: Ic8e28866d085d57e778c4f86bcb7492ef0638ab9
Bug: crashpad:437
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4023619
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Ben Hamilton <benhamilton@google.com>
2023-02-01 19:23:51 +00:00
Ben Hamilton
3215ed9086 [client] Optionally support ScopedSpinGuard in Annotation
This CL optionally integrates ScopedSpinGuard (an atomic boolean) with
crashpad::Annotation.

Subclasses of Annotation can choose to integrate ScopedSpinGuard into
their Set(...) methods to ensure reads and writes are serialized.

I didn't integrate this into StringAnnotation in this CL, but it'd be
pretty trivial to do in a follow-up.

Change-Id: I1c5b8982576b03f9780a57acb7627c9194f8f0ff
Bug: crashpad:437
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4022484
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Ben Hamilton <benhamilton@google.com>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2023-01-31 22:37:44 +00:00
Vaibhav Nagarnaik
9158eb7caa handle num_handled_exceptions == 0 case
from documentation of `ProcessException` in `crashpad_wer.h`:

```
//! \param[in] handled_exceptions is an array of exception codes that the helper
//!     should pass on to crashpad handler (if possible). Pass nullptr and set
//!     num_handled_exceptions to 0 to pass every exception on to the crashpad
//!     handler.
```

fix the check to handle `num_handled_exceptions == 0` case to not filter
out any exceptions.

Bug: crashpad:439
Change-Id: Ic4559a730a26e37c7a8f13e6bcae7595d743924a
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4206503
Commit-Queue: Alex Gough <ajgo@chromium.org>
Reviewed-by: Alex Gough <ajgo@chromium.org>
2023-01-31 04:56:47 +00:00
Ben Hamilton
28354d11c3 [ios] New class ScopedVMMap
This CL introduces a new class ScopedVMMap, a fork of ScopedVMRead
which maps the memory using vm_remap() instead of reading it.

This is useful for Annotations which use ScopedSpinGuard to
protect reads from simultaneous writes; the in-process intermediate
dump handler can try to take the spin guard when reading such
an Annotation and skip reading it if it the spin guard could not
be obtained.

Change-Id: I60d7a48d1ba4e5d2dfdb44307b78b4d9ffb73560
Bug: crashpad:437
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4114550
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Ben Hamilton <benhamilton@google.com>
2023-01-30 22:19:37 +00:00
Ben Hamilton
8071d3019e [client] Clean up types and code style in LengthDelimitedRingBuffer
This CL cleans up types and code style comments from post-submit code
review comments on https://crrev.com/c/4023618 .

I also added fixes for potential overflows in varint length decoding
and included new tests.

Bug: crashpad:437
Change-Id: I0a3585036028d81f42d0d36e87cce4264f4ed9ad
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4199705
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Reviewed-by: Justin Cohen <justincohen@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2023-01-30 21:18:59 +00:00
Justin Cohen
c11d49db88 Add a mask to MinidumpCrashpadInfo to indicate valid pointer addresses.
ARM64 supports storing pointer authentication codes in the upper bits of
a pointer. This mask can be used by LLDB to mimic ptrauth_strip and
strip the pointer authentication codes. To recover an address from
pointer with an authentication code, `AND` this mask with the pointer.

If the platform does not support pointer authentication, or the range of
valid addressees for a pointer was unaccessible, this field will be 0
and should be ignored.

Change-Id: Ie5cef90802dd1e892d456195ab8874223eac6a1b
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2773358
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2023-01-30 18:27:02 +00:00
Leonard Grey
85b7d3dd6f Mac: more robust __crash_info on 13+
It looks like macOS 13 only *sometimes* puts __crash_info in
__DATA_DIRTY. Instead of splitting by version check, let's just look
in __DATA_DIRTY if we can't find it in __DATA.

Bug: chromium:1372165
Change-Id: I99d2e759c66841d982039449e83f8658259d7ed1
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4197706
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Leonard Grey <lgrey@chromium.org>
2023-01-27 20:02:14 +00:00
Leonard Grey
ad2e043288 Mac: Look for crash annotations in __DATA_DIRTY on macOS 13+
Bug: chromium:1373664
Change-Id: I948eac3a46e8ad0d6fe70413111641e77c7ae57c
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4196074
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Leonard Grey <lgrey@chromium.org>
2023-01-26 15:36:34 +00:00
Leonard Chan
84627e1ac7 [fuchsia] Temporarily disable hwasan from crashpad tests
Much of crashpad's unittests propagate tagged pointers to fuchsia
syscalls which do not accept tagged values. Rather than fixing them all
right now, just ensure that the tests do not build with the hwasan
variant if enabled.

Bug: fxbug.dev/108368
Change-Id: Ib32eb95ba671a6b55694075b68c7fbbb733cf501
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4175438
Reviewed-by: Francois Rousseau <frousseau@google.com>
Commit-Queue: Francois Rousseau <frousseau@google.com>
2023-01-18 00:33:10 +00:00
Avi Drissman
1e10a2370e Update header includes for /base/functional in Crashpad
bind.h, callback.h, callback_forward.h, and callback_helpers.h
moved into /base/functional/. Update the include paths to
directly include them in their new location.

Bug: chromium:1364441
Change-Id: I23aaa16644c10ac5b607ea29d25799fbb08dfaca
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4163072
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Avi Drissman <avi@chromium.org>
2023-01-13 19:47:47 +00:00
Jay Zhuang
43eac93aef [fuchsia] Import buildconfig from fuchsia
... when build is targeting Fuchsia

Change-Id: I03fab9368bd5e8687899a2efeb51736707bce81e
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4137733
Commit-Queue: Jay Zhuang <jayzhuang@google.com>
Reviewed-by: Francois Rousseau <frousseau@google.com>
2023-01-09 22:58:19 +00:00
Jay Zhuang
a0b4e88a9f [snapshot] Use Fuchsia specific header
... when compile target is Fuchsia

Change-Id: Id77babbd3dffff26c75a52296ac91101780e4c33
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4132464
Reviewed-by: Francois Rousseau <frousseau@google.com>
Commit-Queue: Jay Zhuang <jayzhuang@google.com>
2023-01-04 22:55:45 +00:00
Mark Mentovai
21035861b5 mac: Don’t cater to gcc-4.2 libstdc++ brokenness
The try and catch macros were conditionally defined by libstdc++ pre-gcc
4.4 (2009-04-21), fixed in
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25191. Surely none of this
code would build with such an old libstdc++ any more, since Crashpas has
adopted modern C++ (C++11 and later). Remove this obsolete nod to
history.

Change-Id: Ie3cea1ecc1cfd358f27ea48f8111791e7f08bfa5
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4136890
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2023-01-04 17:48:55 +00:00
Jay Zhuang
a41e599f33 [fuchsia] Update crashpad location
... as we move crashpad from //third_party/crashpad to
//third_party/crashpad/src

Change-Id: I081520ad44334cc83397234e5d16535d0db4806d
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4132465
Reviewed-by: Francois Rousseau <frousseau@google.com>
Commit-Queue: Jay Zhuang <jayzhuang@google.com>
2023-01-04 01:39:33 +00:00
Ben Hamilton
bd479a1202 [ios] Fix --gtest_filter for non-xcuitest targets
Change-Id: I477919feec68d317ca3cb8a0d07022e9405156dd
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4118347
Reviewed-by: Justin Cohen <justincohen@chromium.org>
Commit-Queue: Ben Hamilton <benhamilton@google.com>
2022-12-21 16:20:05 +00:00
Ben Hamilton
62a0099c0e [ios] Support --gtest_filter for iOS tests
Change-Id: I5511911110b58b7accd0f78cc1094924bfbda71e
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4114702
Reviewed-by: Justin Cohen <justincohen@chromium.org>
Commit-Queue: Ben Hamilton <benhamilton@google.com>
2022-12-20 20:22:39 +00:00
Justin Cohen
0e7dae459f Roll gn to 5e19d2fb.
GN now does more iOS xcode project generation natively.

Change-Id: I0a133e648a9426cfc822e40af36c2626ddb58f68
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4111089
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Justin Cohen <justincohen@chromium.org>
2022-12-16 20:25:54 +00:00
Ben Hamilton
1a7918b716 [client] New class LengthDelimitedRingBuffer
This CL implements LengthDelimitedRingBuffer, a general-purpose
ringbuffer suitable for use as a Crashpad Annotation.

This ringbuffer supports writing variably-sized data delimited by a Base
128 varint-encoded length separator.

LengthDelimitedRingBuffer is backed by a std::array, so it has a fixed
maximum size. It supports reading via RingBufferReader as well as
writing via RingBufferWriter.

Change-Id: I23ecb4a85ee8e846e1efc6937a5cb089a494d50a
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4023618
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Commit-Queue: Ben Hamilton <benhamilton@google.com>
2022-12-15 17:30:43 +00:00
Ben Hamilton
f7b5e00268 [util] New class ScopedSpinGuard
To support a new crashpad::RingBufferAnnotation type which can be safely
written to and read from simultaneously by different threads/processes,
this CL introduces a new class ScopedSpinGuard, which is a simple RAII
wrapper around an atomic boolean.

Change-Id: I5bafe6927a8dc2a3e25734cb941fd9fce9a8d139
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4031729
Commit-Queue: Ben Hamilton <benhamilton@google.com>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2022-12-15 17:06:55 +00:00
Nathan Mulcahey
5a8a43a992 [fuchsia] Update mini_chromium location as well
Bug: b/258565335
Change-Id: I49f05fb9a8eaf1b0c3d9c8c302ceb3c5340799c9
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4099724
Commit-Queue: Nathan Mulcahey <nmulcahey@google.com>
Reviewed-by: Francois Rousseau <frousseau@google.com>
2022-12-13 01:12:06 +00:00
Nathan Mulcahey
d5aa5d4f1b [fuchsia] Move mini_chromium and lss
These third_party dependencies need to move to the `.../src` folder for Fuchsia.

Bug: b/258565335
Change-Id: I36a87cf0cca6461fa09fffc7a8c642e1b24edbaa
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4097194
Commit-Queue: Nathan Mulcahey <nmulcahey@google.com>
Reviewed-by: Francois Rousseau <frousseau@google.com>
2022-12-12 21:21:25 +00:00
Ben Hamilton
c902f6b1c9 Fix Crashpad CI failures on mac, linux, and fuchsia
Crashpad CI is currently failing the mac, linux, and fuchsia builds:

https://ci.chromium.org/ui/p/crashpad/builders/try/crashpad_mac_x64_rel/811/overview
https://ci.chromium.org/ui/p/crashpad/builders/try/crashpad_linux_x64_rel/828/overview
https://ci.chromium.org/ui/p/crashpad/builders/try/crashpad_fuchsia_x64_rel/802/overview

The breakage was introduced by https://crrev.com/c/3990128, but CI
didn't start failing until depot_tools started using it in
https://crrev.com/c/3925341 .

This CL fixes two issues in that CL:

1) Bash-specific syntax in the third_party/ninja/ninja script
2) host_cpu in DEPS is x64, not amd64, for x86_64 platforms

Change-Id: If5723b4389b6abbb0a70eccaa5f06990594ebf90
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4052882
Commit-Queue: Ben Hamilton <benhamilton@google.com>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2022-11-23 20:15:55 +00:00
Tom Anderson
f742c1aa4a Fix build failure on Linux/amd64
This is necessary to roll Crashpad in Chromium.  Fixes the following:

[5984/6587] CXX obj/third_party/crashpad/crashpad/client/client_test/crashpad_client_linux_test.o
FAILED: obj/third_party/crashpad/crashpad/client/client_test/crashpad_client_linux_test.o
python3 ../../build/toolchain/clang_code_coverage_wrapper.py --target-os=linux --files-to-instrument...(too long)
../../third_party/crashpad/crashpad/client/crashpad_client_linux_test.cc:522:20: error: code will never be executed [-Werror,-Wunreachable-code]
struct utsname uname_info;
^~~~~~~~~~
1 error generated.

Bug: chromium:1260217
Change-Id: Ie63881ed82faec84e8d45bb30dfc8ef10cfdbd6d
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4028794
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Thomas Anderson <thomasanderson@chromium.org>
2022-11-16 00:21:29 +00:00
Mitch Phillips
fca8871ca3 Add SA_EXPOSE_TAGBITS to crashpad's signal handler.
SA_EXPOSE_TAGBITS is a Linux >= 5.11 feature that allows si_addr to
contain the upper tag bits. This is a feature that allows signal
handlers to see the full upper address bits on aarch64, which consist of
TBI and MTE nibbles. For MTE, preserving these bits is of significant
importance, as it allows for precise use-after-free and buffer-overflow
diagnosis that's impossible without seeing these bits in the fault
address.

We unconditionally enable this feature on all kernels, as it's ignored
when unsupported (even on older kernels).

Tested on:
 1. Linux x86 host, which is a no-op.
 2. Android device with Linux 4.14, which is a no-op.
 3. Android device with Linux 5.15, which passes. For posterity, my
    config was:
 |  $ gn args out_arm64
 |  target_os = "android"
 |  android_ndk_root = "~/Android.sdk/ndk/21.4.7075529"
 |  android_api_level = 26
 |  target_cpu = "arm64"
 |  # NDK builds push libc++_shared.so, which is not present on newer Android
 |  # versions, so I hacked the runner to push the file. Maybe this should be
 |  # upstreamed at some point as well.
 |  $ git diff
 |  diff --git a/build/run_tests.py b/build/run_tests.py
 |  index 8ad19e34..64269c90 100755
 |  --- a/build/run_tests.py
 |  +++ b/build/run_tests.py
 |  @@ -273,7 +273,8 @@ def _RunOnAndroidTarget(binary_dir, test, android_device, extra_command_line):
 |          _adb_shell(adb_mkdir_command)
 |
 |          # Push the test binary and any other build output to the device.
 |  -        local_test_build_artifacts = []
 |  +        local_test_build_artifacts = [
 |  +            '~/Android.sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/aarch64-linux-android/libc++_shared.so']
 |          for artifact in test_build_artifacts:
 |              local_test_build_artifacts.append(os.path.join(
 |                  binary_dir, artifact))
 |  @@ -294,6 +295,7 @@ def _RunOnAndroidTarget(binary_dir, test, android_device, extra_command_line):
 |          # The list of TERM values comes from Google Test’s
 |          # googletest/src/gtest.cc testing::internal::ShouldUseColor().
 |          env = {'CRASHPAD_TEST_DATA_ROOT': device_temp_dir}
 |  +        env = {'LD_LIBRARY_PATH': device_out_dir}
 |          gtest_color = os.environ.get('GTEST_COLOR')
 |          if gtest_color in ('auto', None):
 |              if (sys.stdout.isatty() and
 |  $ ninja -C out_arm64 && python build/run_tests.py out_arm64/ \
 |    --gtest_filter=*StartHandlerForSelfTestSuite*

Change-Id: I293b36fcd08ffaca593dae8042299a39756defa0
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4024204
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Mitch Phillips <mitchp@google.com>
2022-11-14 23:44:52 +00:00
Tom Anderson
72e51701c7 [MSAN] Suppress false-positive in HTTPTransportLibcurl::WriteResponseBody
This bug was found when trying to upgrading the MSAN bots from Ubuntu
18.04 (where this codepath was not hit) to 20.04.  The following MSAN
error is produced when running HTTPTransport/HTTPTransport.*

==3496553==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x5616c540ad7d in __is_long buildtools/third_party/libc++/trunk/include/string:1674:33
    #1 0x5616c540ad7d in size buildtools/third_party/libc++/trunk/include/string:1069:17
    #2 0x5616c540ad7d in crashpad::(anonymous namespace)::HTTPTransportLibcurl::WriteResponseBody(char*, unsigned long, unsigned long, void*) third_party/crashpad/crashpad/util/net/http_transport_libcurl.cc:528:50
    ...
    SUMMARY: MemorySanitizer: use-of-uninitialized-value buildtools/third_party/libc++/trunk/include/string:1674:33 in __is_long
  ORIGIN: invalid (0). Might be a bug in MemorySanitizer origin tracking.

The memory is initialized in http_transport_test.cc:293, but MSAN gets
confused.  Given the message output by MSAN (ORIGIN: invalid (0).
Might be a bug in MemorySanitizer origin tracking), this appears
to be a bug in MSAN, not crashpad, so this CL suppresses the error.

Bug: chromium: 1260217
Change-Id: I2d6a46e3489816270cc1fee776793ffafe0147e4
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4015160
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Thomas Anderson <thomasanderson@chromium.org>
2022-11-14 23:10:18 +00:00
Benoît Lizé
a91f197a26 [tests] Make the infinite recursion actually recurse with clang
On gLinux, tests don't pass in the default configuration (empty GN
args), because the infinite recursion test doesn't crash
anymore. Locally, forcing the function to stay out of line is sufficient
to fix it. This is inherently brittle, and may need to be revisited at a
later point.

Change-Id: Ica88a0b3a2151af95c64c490b5afcdc05cf3be4e
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4020321
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Benoit Lize <lizeb@chromium.org>
2022-11-10 19:07:47 +00:00
Benoît Lizé
9ca1fb932e [tests] MINSIGSTKSZ is no longer a constant, update tests
glibc 2.34 makes MINSIGSTKSZ a runtime value, as noted in the changelog:
https://sourceware.org/git/?p=glibc.git;a=blob;f=NEWS;h=85e84fe53699fe9e392edffa993612ce08b2954a;hb=HEAD.

This prevents tests from building on these systems, remove constexpr to
fix it.

Change-Id: I83b19aa7c075f0d9b02875aef8985fac6fce18a5
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4020320
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Benoit Lize <lizeb@chromium.org>
2022-11-10 18:22:19 +00:00
Junji Watanabe
58c68181ea Install ninja to crashpad using DEPS
Ninja will be installed to the following paths.
- Linux: third_party/ninja/linux/ninja
- Mac: third_party/ninja/mac/ninja
- Windows: third_party/ninja/ninja.exe

This supports a workflow with VMs on the same host machine.

On Unix, `ninja` command wrapper in depot_tools will trigger third_party/ninja/ninja, which call linux or mac ninja.
On Windows, the depot_tools wrapper will trigger third_party/ninja/ninja.exe.

See the the discussions on the previous CL https://crrev.com/c/3924593 for more context.

See also chromium/src's CL https://crrev.com/c/3869740 for CIPD ninja migration.

Bug: chromium:1340825
Change-Id: Ia4ff83b4fdc5cb07b5c737cb9d00eaa167f0ffb0
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3990128
Commit-Queue: Junji Watanabe <jwata@google.com>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2022-11-08 01:32:40 +00:00
Brian Sheedy
0729b08ace Fix NOTREACHED availability
Fixes NOTREACHED not being available in client/settings.cc. This was
available when compiling Crashpad standalone, but not as part of
Chromium.

Bug: chromium:1358240
Change-Id: Ie61d3beabf9ab953369f8fd25556d6a602c0c043
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4009734
Commit-Queue: Brian Sheedy <bsheedy@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2022-11-07 20:01:15 +00:00
Brian Sheedy
bce9a58c66 Fix locking on certain Android partitions
Copy of crrev.com/c/3952963.

Fixes locking not working on some Android filesystems due to flock not
being available. Instead, we now use the same approach as Fuchsia with
a dedicated lock file. This is an issue when running tests on
non-rooted Android devices, as we need files to be written to a
location accessible without root, but the chosen location might not
have flock support.

Bug: chromium:1358240
Change-Id: Ie910481be472403a8b0e9e36100594b0618f85e6
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3999273
Commit-Queue: Brian Sheedy <bsheedy@chromium.org>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2022-11-03 22:22:19 +00:00
Joshua Peraza
2b618565e5 Fix copyright message in third_party/edo/BUILD.gn
Change-Id: I53ccbba67d79b834e86d2ef30f6ba5aca9062182
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3994211
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
2022-10-31 19:29:48 +00:00
Joshua Peraza
30ca5564f8 Validate number of bytes read
Bug: chromium:1380083
Change-Id: I54a0dfb72b586638124ecc4150f0b90b9e1aa1d5
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3994208
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
2022-10-31 18:53:36 +00:00
Mark Mentovai
31af46b91e Update copyright boilerplate in third_party/edo
From
https://chromium-review.googlesource.com/c/3936784/1/third_party/crashpad/crashpad/third_party/edo/BUILD.gn.

Bug: chromium:1098010
Change-Id: Ia18db07d4d9be43c0dae5eb84d91dd68531a75e3
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3938565
Commit-Queue: Mark Mentovai <mark@chromium.org>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2022-10-10 17:11:35 +00:00
Justin Cohen
b00da64ac8 ios: Correct iOS forbidden allocators on iOS 16.1
There's a new try_free_default in malloc zone 13, and tests now need to
replace zone functions in all zones, not just the default zone.

Change-Id: I5a9893a73f8c9f7068e52bf25f57632f9e409aa2
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3934555
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Justin Cohen <justincohen@chromium.org>
2022-10-05 17:39:16 +00:00
Stephan Hartmann
0acdadf032 snapshot: remove redundant template parameter
GCC 12 does not allow it in C++20 mode anymore.

Bug: chromium:819294
Change-Id: I025dda8046739fefc4ff449d4496ef496374eff5
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3929186
Commit-Queue: Mark Mentovai <mark@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2022-09-30 15:07:02 +00:00