2291 Commits

Author SHA1 Message Date
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
Alan Zhao
cca548be84 Minor fixes for crashpad_wer_main.cc
These were suggested after https://crrev.com/c/3864248 was submitted.

Change-Id: I73c451a3ea52721d8476e229cff7a0aded6746ac
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3902210
Commit-Queue: Alan Zhao <ayzhao@google.com>
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2022-09-19 21:01:38 +00:00
Alex Gough
ca928c8d6b Work around pre 19041 SDK definition
SDK definition of WER_RUNTIME_EXCEPTION_INFORMATION changed in SDK 19041
to add the bIsFatal field which we use. This adds a local definition of
the newer structure to allow the WER handler to build on earlier SDKs.

Bug: crashpad:423
Change-Id: I23bb69cc002ac8d469227e549f29b0af4849c893
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3880663
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Alex Gough <ajgo@chromium.org>
2022-09-19 17:52:23 +00:00
Ben Hamilton
833219f1ad [ios] Add optional UploadBehavior enum to InProcessHandler::StartProcessingPendingReports()
Previously, StartProcessingPendingReports() only started the prune and
upload threads if it thought the application was actively running in
the foreground.

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

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

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

Change-Id: I4f13f3a3006d636dd3e511b21ccc23a90b2ea639
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3894230
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Reviewed-by: Justin Cohen <justincohen@chromium.org>
2022-09-15 20:16:25 +00:00
Fabrice de Gans
9f472e5a18 [code-health] Remove .vpython file
This file only applies to python 2 and is no longer valid.

Bug: 1336295
Change-Id: I55e56275250f28fb7fbe3a2423b934f678c34fa9
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3900797
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
Commit-Queue: Fabrice de Gans <fdegans@chromium.org>
2022-09-15 19:46:14 +00:00
Alan Zhao
02399418fc Fix comment in crashpad_wer.h
Empty arrays aren't allowed in C/C++, so we advise callers to pass
nullptr instead.

Change-Id: If6724fa5a8b657207337df8b36fa2b3b4fddd955
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3894498
Reviewed-by: Ben Hamilton <benhamilton@google.com>
Commit-Queue: Alan Zhao <ayzhao@google.com>
2022-09-13 21:46:33 +00:00
Ben Hamilton
ca3cf2f4e3 [ios] Add an optional upload complete observation callback to the in-process handler
Breakpad offers a callback when uploads complete:
    https://source.chromium.org/chromium/chromium/src/+/main:third_party/breakpad/breakpad/src/client/ios/BreakpadController.h;l=103;drc=1fc9cc0d0e1dfafb8d29dba8d01f09587d870026

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

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

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

Bug: chromium:1098010
Change-Id: I8d6138469ddbe3d281a5d83f64cf918ec2491611
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3878262
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2022-09-06 23:54:07 +00:00
Alan Zhao
261679b3d2 Move registration_protocol_win structs to their own header file
registration_protocol_win.h includes <string>, which adds an
unacceptable dependency on libc++ in //components/crash/win:chrome_wer
in Chrome as that file is included in crashpad_wer.cc. Rather than
remove <string>, which would require doing a lot of transitive
refactoring work in Crashpad, we just extract the data structures into
another file, as crashpad_wer.cc only includes
registration_protocol_win.h for its struct definitions.

Bug: chromium:1357827
Change-Id: Ic20c2952be07ea75d063702cd346cdca0ab65038
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3864251
Commit-Queue: Alan Zhao <ayzhao@google.com>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2022-08-31 18:06:58 +00:00
Alan Zhao
54da37c2d2 Remove std::vector from crashpad_wer
When assertions were enabled in Chrome in https://crrev.com/c/3833545,
crashpad_wer now requires libc++ to be explicitly included if compiled
with -std=c++20 because <vector> would now reference symbols defined
outside the libc++ headers. We attempted to add libc++ as a dependency
in https://crrev.com/c/3862974; however, that was deemed unacceptable
because the library needs to be kept small in order for Windows to load
it to handle crashes. Therefore, the only alternative is to update the
library to remove std::vector

Bug: chromium:1357827
Change-Id: I1494204a7bd679fa1632a0f08597cb7e93267196
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3864248
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Alan Zhao <ayzhao@google.com>
2022-08-30 20:51:37 +00:00
Justin Cohen
fc2e7c06b8 Upgrade LUCI configs to use Mac-12
Fixed: 1353832, 1355592
Change-Id: I677983b8414398fbb27f02f75fad25ff9ad8388b
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3848799
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Justin Cohen <justincohen@chromium.org>
2022-08-23 23:59:41 +00:00
Leonard Grey
a2d0cefe01 Mac: account for PTHREAD_T_OFFSET in arm64 tests
Bug: chromium:1319307
Change-Id: I3d462b7f143b63eb3173eb7245a6c0df4f75e778
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3842365
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Leonard Grey <lgrey@chromium.org>
2022-08-19 22:18:11 +00:00
Francois Rousseau
43ea32b6fe [fuchsia] remove dependency on libcurl
* crashpad_http_transport_impl is "socket" when targeting Fuchsia
  so the dependency on //third_party/curl:libcurl isn't actually
  ever added - we might as well remove it to prevent confusion

Bug: fuchsia:107235

TESTED=`fx build` in Fuchsia checkout

Change-Id: I75da6e7505f8ab09f9978472e93c48600f4c35cb
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3840964
Commit-Queue: Francois Rousseau <frousseau@google.com>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2022-08-19 16:57:18 +00:00
Leonard Grey
3e80b95054 Run clang-format on process_reader_mac_test
Missed this in https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3833512

Bug: None
Change-Id: I90a122f3b671999464e6a62e1df7d654573d9f05
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3840479
Reviewed-by: Mark Mentovai <mark@chromium.org>
2022-08-18 22:07:24 +00:00
Leonard Grey
1d4447645d Mac: Fix shadow warning
This caused a warning with `-Wshadow` on due to the loop below.

Bug: None
Change-Id: I63c4252d7ff66c416d8f0edde868a9b0a6aeb65e
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3838745
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Leonard Grey <lgrey@chromium.org>
2022-08-18 20:41:08 +00:00
Leonard Grey
af96fcd576 Mac: use pthread_get_stack{addr,size}_np in process reader tests
Currently, these tests take a pointer to a stack variable to get
an address in the stack. ASAN recently enabled `detect_stack_use_after_return` by default, which breaks this approach.

Bug: chromium:1319307

Change-Id: Ia828a92389cf0d45f31f9a7b999badea398f56ec
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3838735
Reviewed-by: Mark Mentovai <mark@chromium.org>
2022-08-18 20:02:47 +00:00
Leonard Grey
05e3bd85eb Mac: Expect timestamp for main executable in macOS 12+ in process reader
dyld4 *does* record a timestamp for the main executable (confirmed with
a test app).

Bug: chromium:1268776
Change-Id: I13380181903be7b4886dfdf37f1aa42018a0ef55
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3833512
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Leonard Grey <lgrey@chromium.org>
2022-08-17 19:10:43 +00:00
Leonard Grey
0c369760bd Mac: update MachOImageAnnotationsReader tests for dyld4
ASAN passes locally for me with this patch in Chromium, so re-enabling
it upstream as well.

Bug: chromium:1334418
Change-Id: I9c9b20d7c309795cb147656374bae1229be6b418
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3833503
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Leonard Grey <lgrey@chromium.org>
2022-08-17 18:03:53 +00:00
Bruce Dawson
1876c67497 Record memory near EIP/RIP first
Checking for code-corruption is an important process in crash analysis
so it is important to record code bytes first. This was already done for
ARM and other processors so this change just moves EIP/RIP to the top of
the list.

This is important in scenarios where only a small amount of extra memory
is recorded such as in the stable channel of Chrome.

Bug: 1339513
Change-Id: I26367214ee66795c81000a0487987a130f2ea23a
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3812374
Commit-Queue: Mark Mentovai <mark@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2022-08-09 14:56:02 +00:00
Alex Pankhurst
6c6c2ae563 [fuchsia] migrate test to CFv2
Fuchsia is undergoing a change to how programs are run and the Crashpad
tests must be migrated to the new system.

Bug: fuchsia:102371

TESTED=`fx test crashpad-test` (540 passing, 1 skipped)

Change-Id: I4daf7d160045b28b876a5f1aa93b0bd596461e0d
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3817783
Commit-Queue: Alex Pankhurst <pankhurst@google.com>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2022-08-08 19:03:20 +00:00