2371 Commits

Author SHA1 Message Date
Justin Cohen
dc2d082b92 ios: Use correct address when storing register memory.
The memory region data saved in the intermediate dump is an address
offset by 128 bytes. However, the MemorySnapshot generated was using the
original address and not the offset address.  The same data is being
captured in the minidump.

Change-Id: Ia34912c035319e79cf446a130e662084f4ab51ea
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/5529059
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Rohit Rao <rohitrao@chromium.org>
(cherry picked from commit 371083179b7b3bc68dc8ff03ac235717805c78bd)
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/5632884
Reviewed-by: Justin Cohen <justincohen@chromium.org>
2024-06-14 16:04:08 +00:00
Ben Hamilton
6ce83d80f7 [ScopedSpinGuard] Use std::atomic::compare_exchange_strong() for spinlock
Previously, ScopedSpinGuard used std::atomic::compare_exchange_weak()
in a loop to implement a spinlock. After looping for the specified
number of nanoseconds, it would give up and return an error.

A few bugs have come in on ARM platforms (https://crbug.com/340980960,
http://b/296082201) which indicate that this can fail even in
single-threaded cases where nothing else has the spinlock.

From https://cbloomrants.blogspot.com/2011/07/07-14-11-compareexchangestrong-vs.html :

> compare_exchange_weak exists for LL-SC (load linked/store
> conditional) type architectures (Power, ARM, basically everything
> except x86), because on them compare_exchange_strong must be
> implemented as a loop, while compare_exchange_weak can be
> non-looping.

and:

https://en.cppreference.com/w/cpp/atomic/atomic/compare_exchange#Notes

> compare_exchange_weak is allowed to fail spuriously, that is, acts
> as if *this != expected even if they are equal. When a
> compare-and-exchange is in a loop, compare_exchange_weak will yield
> better performance on some platforms.
>
> When compare_exchange_weak would require a loop and
> compare_exchange_strong would not, compare_exchange_strong is
> preferable [...]

My conclusion is that this logic needs to use
`compare_exchange_strong` to avoid spurious failures on ARM in the
common case when there's no other thread holding the spinlock.

Change-Id: I2a08031db6b219d7d14a5cd02b3634985f81ab06

Bug: b:340980960,b:296082201
Change-Id: I2a08031db6b219d7d14a5cd02b3634985f81ab06
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/5545257
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Ben Hamilton <benhamilton@google.com>
(cherry picked from commit d588c50b16f735b0c069538651d06bdd9490c6f3)
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/5631682
Reviewed-by: Justin Cohen <justincohen@chromium.org>
2024-06-14 16:01:04 +00:00
Ben Hamilton
8df174c64c [ios] Fix TSAN issue and Mach port leak in CrashpadClient
There were two issues with the iOS implementation of CrashpadClient
which I reported in https://crbug.com/crashpad/481:

1) TSAN found a data race in ResetForTesting() when it modified the
ScopedMachReceiveRight while the Mach exception port thread was
reading it

2) The Mach port connected to the exception server was never deallocated

This CL fixes both issues.

Change-Id: I5bd4f79ae6d0eccca954d663be7a36f8ceb0a0e8
Bug: https://crbug.com/crashpad/481
Bug: b:332305593
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/5410301
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Justin Cohen <justincohen@chromium.org>
2024-04-11 17:00:05 +00:00
Justin Cohen
f9cee5c147 Roll mini_chromium to pick up the latest version of base::span.
Also enables C++20 as span now depends on it.

Roll buildtools to grab a newer libc++ that supports C++20.

Explicitly capture `this` in lambdas in cpp-httplib as the implicit
capture through `=` is deprecated and causes an error in C++20.

Update the MacOS version to "Mac-13|Mac-14" which is the current
value of `os.MAC_DEFAULT` in Chromium infra in order to have
C++20 support in the std library on iOS.

Moves iOS tests to run on iPhone 13 and includes a mini_chromium roll
to fix Xcode 14.3 egtests.

Bug: 40284755
Change-Id: Ic078f07d12473f2aaed5e84df0f0a7fb7b8c35c3
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/5443384
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Reviewed-by: danakj <danakj@chromium.org>
2024-04-11 16:00:45 +00:00
danakj
bbb99bfa37 Move crashpad to using Mac-13|Mac-14 (like chromium) and latest win sdk
This should give crashpad a newer xcode and msvc that support C++20.

These changes need to land separately from the C++20 usage, as they do
not get applied until after landing, so can't affect the CQ from inside
the CQ.

Bug: 40284755
Change-Id: I3ae72befa008bfb37bac882de0986c5bcf9de079
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/5425460
Commit-Queue: danakj <danakj@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2024-04-04 19:50:08 +00:00
Justin Cohen
1cea0473a5 ios: Capture signal exception context memory regions correctly.
Previously, Crashpad would only capture iOS thread context memory regions by iterating the task_threads->thread_get_state's. For Mach
exception this worked as intended.  However, for signal exceptions this
missed the registers from the actual signal context. This change
correctly captures these regions and stores them in the exception
snapshot.

Change-Id: I494e753a25c2687e61b5183ed0135f520ca8bf52
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/5380505
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Justin Cohen <justincohen@chromium.org>
2024-03-21 20:10:05 +00:00
Justin Cohen
ccd20652bc ios: Update exception test for Chromium release builds.
After https://crrev.com/c/5375084, Chromium __libcpp_verbose_abort is
handled differently for official non-dcheck builds. This change fixes
the test expectation for release non-official builds.

Bug: 330168249
Change-Id: Iceb6d327f9e93fd366cc07abe27eefd1adf06472
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/5378380
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Justin Cohen <justincohen@chromium.org>
2024-03-18 18:21:32 +00:00
André Kempe
6bf5e1b5c5 Fix invalid check for valid key of Pointer Authentication
Arm's Pointer Authentication uses two keys for signing pointers, A-key
and B-key. Although by default Clang uses the A-key if PAC support is
enabled at compile time, this behaviour might be overridden via compiler
command line.

This CL fixes the check for the B-key being enabled. The key that shall
be used for Pointer Authentication is denoted by bits 0 (A-key) or
1 (B-key) of __ARM_FEATURE_PAC_DEFAULT. Hence, the previous way of
checking by using bits 0 and 2 does not correctly identify the B-key.

Bug: 40608466
Change-Id: Ib2f226baa12a7145fa0b6e486e49d36e6b0a3cd7
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/5341090
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2024-03-15 14:10:46 +00:00
André Kempe
dea283a7eb Make AnnotationList's iterator compliant to input iterator
This CL make the iterators implemented by AnnotationList compliant to
the requirements imposed by the C++ standard on input iterators.

Change-Id: I263c94a97f5bcd7edd5ef4d8b65fa28b11876974
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/5093147
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2024-03-15 14:08:58 +00:00
Justin Cohen
c4d4a4d83e ios: Disable annotations tests on older simulators on macOS 14.3
There appears to be a change in dyld in macOS 14.3 that iOS 17
accounts for, but older simulators do not. This causes the main
binary to be listed twice when iterating modules, breaking some
tests.

Bug: crbug.com/328282286

Change-Id: I71909fbc13bee6de23b10ffd92a791067f8ea909
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/5353754
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Justin Cohen <justincohen@chromium.org>
2024-03-08 22:44:08 +00:00
Ian Barkley-Yeung
9c58b668ff Increase kMaxNumberOfAnnotations
Chrome on ChromeOS is starting to run into problems where there are more
than 200 annotations, primarily because we use a lot of command-line
switches (40 or more) and commandline-enabled-features as well, each of
which takes up an annotation. It's still rare (100s a day) but will
probably become worse over time as more CrashKey uses are added.

Increase kMaxNumberOfAnnotations to 400.

BUG=296821415

Change-Id: Iba7049014ee3c5ae9c45c4022600eaba50acd403
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/5354336
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Ian Barkley-Yeung <iby@chromium.org>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2024-03-07 22:17:03 +00:00
Peter Boström
bc4fd34fe2 Log argv[0] for failing spawns
This adds argv[0] for PLOG(FATAL) calls following a failed posix_spawn
or execve call to make logs more useful.

Bug: chromium:324982367
Change-Id: I179928ec9f791ce5b365b3444aa3bb667f4ec4b3
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/5315332
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Peter Boström <pbos@chromium.org>
2024-02-22 19:28:55 +00:00
Joshua Peraza
37afd37401 Properly update iterator
Bug: 325296797
Change-Id: I39f76519c46804ad663172abf91ef582bde135e7
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/5310754
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Justin Cohen <justincohen@chromium.org>
2024-02-21 03:06:39 +00:00
Hzj_jie
29ac83caeb [Fuchsia] remove use of fuchsia mac sdk
Bug: b/325495632
Change-Id: I19df5b44b76efcdb050344e79bcc2dfd18d8e289
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/5299466
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2024-02-15 22:18:40 +00:00
Jesse McKenna
940e8a3445 Fix leaky CrashpadInfo test
CrashpadInfo::AddUserDataMinidumpStream() and
UpdateUserDataMinidumpStream() allocate memory for the newly added
streams. This change makes the CrashpadInfo test free that allocated
memory to prevent memory leaks from these tests.

This is intended to fix the ASAN failures seen on crrev.com/c/5285881:
https://ci.chromium.org/ui/p/chromium/builders/try/linux_chromium_asan_rel_ng/1839072/overview

Bug: crashpad:474
Change-Id: I6e030291594d22e316942a58805a177ce448053b
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/5292137
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Jesse McKenna <jessemckenna@google.com>
2024-02-13 18:34:48 +00:00
Sylvain Defresne
5075fb617a Honor ios_is_app_extension chromium build flag
If building for chromium, honor the ios_is_app_extension gn variable
that is set per toolchain. When it is defined, the code is built for
an application extension (i.e. -fapplication-extension is passed to
the compiler).

Use CRASHPAD_IS_IOS_APP_EXTENSION build guard to not compile code
that use unavailable extension when ios_is_app_extension is set. If
the variable is not set, then check at runtime whether the API can
be used or not (if the crashpad client uses the same toolchain for
the main application and its application extensions).

This is required to pass -fapplication-extension to the compiler when
building application extensions (which allow catching API that is not
available to application extensions).

Bug: 40120082
Change-Id: I28d545fcfd0f8662430c40ff202b79b0c2b2ff8b
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/5286216
Reviewed-by: Justin Cohen <justincohen@chromium.org>
Commit-Queue: Sylvain Defresne <sdefresne@chromium.org>
2024-02-12 15:43:24 +00:00
Jesse McKenna
c576bf35ea Add Update method to CrashpadInfo
This change adds a method to update a CrashpadInfo stream.

As part of this change, AddUserDataMinidumpStream() now returns a handle
to the added stream. This handle can be passed to
UpdateUserDataMinidumpStream() if a new version of the stream needs to
be attached to the crash report.

This method is needed for e.g., allowing Chrome's System Profile to
update, as it contains some data that takes a while to collect.

Bug: crashpad:474
Change-Id: I19e935a6904d8843215582e5606b189479ee338b
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/5260024
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Jesse McKenna <jessemckenna@google.com>
2024-02-09 21:32:29 +00:00
Justin Cohen
5d81482aea ios: Read dyld modules in reverse order.
The change in macOS 14's dyld to insert new modules in the front of
`dyld_all_image_infos` means that if the any images are loaded
during an exception while iterating the modules list, the primary
executable will be missed. Instead, read the modules in reverse
order.


Change-Id: I49f6468173f18ef4bd0f326c84e4b48cfc696cd3
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/5249275
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2024-02-01 22:08:46 +00:00
Mitchell Kember
27b460cc7e [fxbug.dev] Migrate bug numbers
This changes fxbug.dev/ URLs from Monorail bug numbers to the new
Fuchsia Issue Tracker numbers.

The migration to the new issue tracker was announced here:
https://groups.google.com/a/fuchsia.dev/g/announce/c/GOYfJozEqmk/m/qsGsaJ7UAAAJ

Bug: 298074672
Change-Id: I5f4b7a26a3f41bf539fa79d15e1a108ea35a5b29
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/5246697
Commit-Queue: Mark Mentovai <mark@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2024-02-01 19:39:27 +00:00
danakj
a02e4935bd Avoid assuming string_view iterators are char*
This assumption is non-portable and prevents Chromium from using
bounded iterators in libc++.

Bug: chromium: 1519908
Change-Id: Iafe6639ef3bc896d6fa4fb3ceb7ac0b546363017
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/5237292
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: danakj <danakj@chromium.org>
2024-01-26 14:03:07 +00:00
Justin Cohen
22c386d1ac ios: Allow missing exception thread id from thread list.
It's expected that iOS intermediate dumps can be written with
missing information, but it's better to try and report as much as
possible rather than drop the incomplete minidump.

Bug: b/284959148
Change-Id: I04110b576a4ee552814234d559c9ba85db0382f0
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4582167
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2024-01-22 19:57:50 +00:00
Mark Mentovai
305b648e71 doc: Upgrade the crashpad-home App Engine app to the go121 flex runtime
Change-Id: I0a30b816e2550e7df6d7777c6d27e6104fc2f9fa
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/5206711
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2024-01-17 17:45:43 +00:00
Peter Boström
5183bef5f3 Remove should-be-dead code after PLOG(FATAL)
This will trigger dead-code warnings in chromium once LOG(FATAL) is
understood as [[noreturn]], which needs to be fixed in crashpad first.

Bug: 1409729
Change-Id: I75cb4d93e648ca9804f1299345e52bb3e2834cd9
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/5193351
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Peter Boström <pbos@chromium.org>
2024-01-12 21:41:10 +00:00
Justin Cohen
30b2f4ba38 ios: Add crashpad_uptime_ns crash key to iOS reports.
This CL introduces a new crash key 'crashpad_uptime_ns' that records the
number of nanoseconds between when Crashpad was initialized and when a
snapshot is generated.

Crashpad minidumps record the MDRawMiscInfo process_create_time using a
sysctl(KERN_PROC).kp_proc.p_starttime. This time is used to display the
'uptime' of a process.  However, iOS 15 and later has a feature that
'prewarms' the app to reduce the amount of time the user waits before
the app is usable. This mean crashes that may happen immediately on
startup would appear to happen minutes or hours after process creation
time.

While initial implementations of prewarming would include some parts of
main, since iOS16 prewarming is complete before main, and therefore
before Crashpad is typically initialized.

Bug: crashpad:472
Change-Id: Iff960e37ae40121bd5927d319a2767d1cafce846
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/5171091
Reviewed-by: Ben Hamilton <benhamilton@google.com>
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Justin Cohen <justincohen@chromium.org>
2024-01-11 16:42:54 +00:00
Peter Boström
98d0d86e76 Add [[noreturn]] version of NtstatusLogMessage
This will be used by base/logging.h in chromium to make sure that
LOG(FATAL) variants never return and are properly understood as
[[noreturn]] by the compiler.

Once that's landed in chromium it'll be up/downstreamed into
mini_chromium as well.

Bug: chromium:1409729
Change-Id: I75340643fe075475f997bbc45250fa10df63c9fa
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/5185996
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Peter Boström <pbos@chromium.org>
2024-01-11 16:15:20 +00:00
Peter Boström
d256de3171 Roll crashpad/third_party/mini_chromium/mini_chromium/ c7fccaa8e..203a01130 (1 commit)
c7fccaa8ec..203a01130f

$ git log c7fccaa8e..203a01130 --date=short --no-merges --format='%ad %ae %s'
2024-01-10 pbos Fix base::ImmediateCrash() IWYU

Created with:
  roll-dep crashpad/third_party/mini_chromium/mini_chromium

Bug: chromium:1409729
Change-Id: Ic9fee112a48b66c92b8446270280d5f2a3d0ef59
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/5187485
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Peter Boström <pbos@chromium.org>
2024-01-10 23:38:24 +00:00
Peter Boström
4426ed9991 Roll crashpad/third_party/mini_chromium/mini_chromium/ 1e64ecb51..c7fccaa8e (1 commit)
1e64ecb51e..c7fccaa8ec

$ git log 1e64ecb51..c7fccaa8e --date=short --no-merges --format='%ad %ae %s'
2024-01-10 pbos Implement base::ImmediateCrash()

Created with:
  roll-dep crashpad/third_party/mini_chromium/mini_chromium

Bug: chromium:1409729
Change-Id: Iaa4f4d81027cb0ddafe85bab8d186949eb7f852e
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/5186004
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Peter Boström <pbos@chromium.org>
2024-01-10 22:37:43 +00:00
Peter Boström
65f2a2bcfe Roll crashpad/third_party/mini_chromium/mini_chromium/ cc2ae8eb0..1e64ecb51 (1 commit)
cc2ae8eb01..1e64ecb51e

$ git log cc2ae8eb0..1e64ecb51 --date=short --no-merges --format='%ad %ae %s'
2024-01-10 pbos Make ~LogMessage virtual

Created with:
  roll-dep crashpad/third_party/mini_chromium/mini_chromium

Bug: chromium:1409729
Change-Id: Ib0011b85c35c781ea35e0d399cccb81b54916ca4
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/5186000
Commit-Queue: Peter Boström <pbos@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2024-01-10 19:31:40 +00:00
Peter Boström
bbb721fd5b Roll crashpad/third_party/mini_chromium/mini_chromium/ ac3e73239..cc2ae8eb0 (1 commit)
ac3e732395..cc2ae8eb01

$ git log ac3e73239..cc2ae8eb0 --date=short --no-merges --format='%ad %ae %s'
2024-01-10 pbos Add Flush() method to LogMessage

Created with:
  roll-dep crashpad/third_party/mini_chromium/mini_chromium

Bug: chromium:1409729
Change-Id: I59b4c9fc9701f3a504b89f396de9da49b333712f
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/5185844
Commit-Queue: Peter Boström <pbos@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2024-01-10 18:37:45 +00:00
David Fang
2905784a7d [build] Re-enable action tracing
Avoid unconditionally running mig in incremental builds,
and causing un-necessary re-build of downstream targets.

Bug: b/42147841
Bug: b/42084680
Change-Id: I961189870aec8f0b1a1ced22105730218664e109
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/5171755
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: David Fang <fangism@google.com>
2024-01-06 04:24:21 +00:00
Ben Hamilton
3a20cc2447 [ios] Add arm64e support to in_process_intermediate_dump_handler
Change-Id: Ifc373d313db71872cc0fd7706da2bdc07cf4ba1b
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/5126940
Reviewed-by: Justin Cohen <justincohen@chromium.org>
Commit-Queue: Ben Hamilton <benhamilton@google.com>
2023-12-18 18:34:11 +00:00
Avi Drissman
9f896f2581 Qualify bit_cast with base::
The real Chromium base/bit_cast.h is in the base namespace.
mini_chromium's version was just changed to be in the base namespace
as well. Roll to the latest mini_chromium and scope all calls to
bit_cast.

Bug: chromium:1506769
Change-Id: I7b25ee512f67694ef6ed3d0250e4f6a6db151eb3
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/5116880
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Avi Drissman <avi@chromium.org>
2023-12-12 22:52:47 +00:00
Ben Hamilton
337b4f7971 [mac] mach_absolute_time() -> clock_gettime_nsec_np(CLOCK_UPTIME_RAW)
https://developer.apple.com/documentation/kernel/1462446-mach_absolute_time

> Prefer to use the equivalent clock_gettime_nsec_np(CLOCK_UPTIME_RAW) in nanoseconds.

The two are equivalent:

c5a3293354/gen/clock_gettime.c (L118)

Change-Id: I1c7a08d821d1840b74fc5eaa0e9ceca2ade5bbfc
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/5085307
Commit-Queue: Ben Hamilton <benhamilton@google.com>
Reviewed-by: Justin Cohen <justincohen@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2023-12-12 18:08:21 +00:00
Avi Drissman
7049d966b5 Fix improper use of bit_cast
bit_cast should never be used on pointers, as it doesn't avoid UB and
can lose qualifiers.

Fortunately, the only use of bit_cast on a pointer was to cast
nullptr into a function pointer, and because nullptr will implicitly
behave as any kind of pointer, that cast isn't needed.

Bug: none
Change-Id: I3ad79b36b7fb5ab53d4b4b6dfc82dea883ec8b53
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/5106728
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Avi Drissman <avi@chromium.org>
2023-12-08 22:15:17 +00:00
Daniel Cheng
5fc60aeb3b Use googletest flag macros to access googletest flags.
The implementation details of flags can change; fixing this proactively
makes it easier to roll googletest in chromium.

Bug: chromium:1409870
Change-Id: Ib27a922a5b3147386a36f98b42e60950e2215190
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/5081703
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2023-12-04 16:10:52 +00:00
Lei Zhang
5613499bbd Replace base::WStringPiece with std::string_view
Bug: chromium:691162
Change-Id: I2d34bcfd3b97d59d1811183d62b893b875b08bb4
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/5010942
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
2023-11-07 21:04:05 +00:00
Peter Kasting
573918571f Roll crashpad/third_party/mini_chromium/mini_chromium/ e508a6010..450b10118 (1 commit)
e508a6010e..450b101187

$ git log e508a6010..450b10118 --date=short --no-merges --format='%ad %ae %s'
2023-11-06 pkasting Rename WCHAR_T_IS_UTF* to WCHAR_T_IS_*BIT

Created with:
  roll-dep crashpad/third_party/mini_chromium/mini_chromium

Change-Id: Id39911a5dbd1275199400848428ab024bb62cf2a
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/5008818
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Peter Kasting <pkasting@chromium.org>
2023-11-07 03:23:08 +00:00
Lei Zhang
1675ce7c58 Add missing base/check.h includes
Do not rely on base/logging.h to provide it.

Change-Id: I8b7d733bcf66abe9b46eabd3703b7ed549d02db7
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/5007844
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2023-11-06 22:00:17 +00:00
Justin Cohen
3ba2403a73 ios: Fix leak in iOS NSException preprocessor.
Call __cxa_free_exception after __cxa_allocate_exception usage.

Change-Id: I0cd5043b945652e6ac28c3bf79486c071d3aa09e
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4990028
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2023-10-31 17:06:02 +00:00
André Kempe
c39206f699 Provide a way to iterate over a const AnnotationList
This CL implements a const iterator to allow for iteration over a const
AnnotationList. This way, the annotation list can passed as a const
reference in search only situations.

Change-Id: I53bd7871f3d914e7e7e627b6b464aa7fa79597f4
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4984053
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Andre Kempe <andre.kempe@arm.com>
2023-10-31 08:24:31 +00:00
David Benjamin
c5e2b0313c Fix UB when saving an StringAnnotation
memcpy and memchr on NULL, 0 is UB due to a C language bug. Instead, use
the C++ functions, which do not have this bug.

Bug: chromium:1394755
Change-Id: I82023aa038c53905f9867c635b26f3b26d9994f5
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4987148
Commit-Queue: David Benjamin <davidben@chromium.org>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2023-10-30 19:33:13 +00:00
David Benjamin
41f6ad560f Fix crashpad tests under UBSan
These are slightly frustrating. First, when a struct is packed, some of
its fields may be underaligned. This is fine for direct access
(foo.bar), but if one takes the address if the field, this creates an
unaligned pointer. Dereferencing that pointer is then UB. (I'm not sure
if creating that pointer is UB.)

Crashpad seemingly doesn't do this, but it uses EXPECT_EQ from GTest.
EXPECT_EQ seems to internally take pointers to its arguments. I'm
guessing it binds them by const reference. This then trips UBSan. To
avoid this, we can copy the value into a temporary before passing to
EXPECT_EQ.

Second, the test to divide by 0 to trigger SIGFPE is undefined behavior.
The compiler is not actually obligated to trip SIGFPE. UBSan prints one
of its errors instead. Instead, since this file is only built on POSIX
anyway, use GCC inline assembly to do the division. That one is
well-defined.

Finally, casting a string to uint32_t* is undefined both by alignment
and by strict aliasing (although Chromium doesn't enable the latter).
Instead, type-punning should be done with memcpy.

Bug: chromium:1394755
Change-Id: I79108773a04ac26f5189e7b88a0acbf62eb4401d
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4985905
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Commit-Queue: David Benjamin <davidben@chromium.org>
2023-10-30 19:31:22 +00:00
Avi Drissman
4a93d7f4c4 Revert "Add an option to start a Windows client with global hooks disabled."
This reverts commit e17518a9e879f63b578db6c184c6bb17f1b13a06.

Reason for revert:

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

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

Change-Id: I3a41238cf0960899fac19d1e6d0ed0e527dfe13f
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4985124
Reviewed-by: Mark Mentovai <mark@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Avi Drissman <avi@chromium.org>
2023-10-27 20:45:09 +00:00
Avi Drissman
188ad79298 Roll crashpad/third_party/mini_chromium/mini_chromium/ 707c87bd2..98bbdbe49 (1 commit) + changes
707c87bd25..98bbdbe49f

$ git log 707c87bd2..98bbdbe49 --date=short --no-merges --format='%ad %ae %s'
2023-10-27 avi Update ScopedTypeRef

Created with:
  roll-dep crashpad/third_party/mini_chromium/mini_chromium

---

In addition, change implicit unwrapping of ScopedCFTypeRef to be
explicit.

Bug: chromium:1495438, chromium:1495439
Change-Id: I47dd12f94f71caaad74cf23be9da9d03a59772db
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4984741
Commit-Queue: Avi Drissman <avi@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2023-10-27 16:15:49 +00:00
Eric Astor
59fc31ce00 Update mini_chromium & use its new support for wide streaming in file_path
Fixes a pending issue when we eventually move to C++20.

Original author: Dean Sturtevant

Change-Id: I7bb0648c73df6b6a28a3a4debdb4524d3cd27b38
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4979733
Reviewed-by: Justin Cohen <justincohen@chromium.org>
Commit-Queue: Eric Astor <epastor@google.com>
2023-10-26 22:15:17 +00:00
Rich Mckeever
e17518a9e8 Add an option to start a Windows client with global hooks disabled.
Change-Id: I645d6136788ca4ccebfc73005c8c2455dc4b2cee
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4949671
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Rich Mckeever <mckeever@google.com>
2023-10-26 19:40:30 +00:00
Peter Kasting
376e8c0e69 Eliminate call to StringPrintf() with non-constexpr format string.
Bug: 1371963
Change-Id: Ic3cc2010e48c399de8d19b94c3b515b53e2d18a3
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4953795
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2023-10-19 00:33:53 +00:00
Peter Kasting
b6d3cdcc4d Roll crashpad/third_party/mini_chromium/mini_chromium/ 42f1fddfe..bc8dca83b (3 commits)
42f1fddfec..bc8dca83bd

$ git log 42f1fddfe..bc8dca83b --date=short --no-merges --format='%ad %ae %s'
2023-10-18 pkasting Add iter_reference_t to template_util.h.
2023-10-18 thestig Remove check_op.h from base/logging.h
2023-10-17 pkasting Add base::StrCat().

Created with:
  roll-dep crashpad/third_party/mini_chromium/mini_chromium

Bug: 1371963
Change-Id: I19a74661930c733814403c9813fe544fe0540b1f
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4953853
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Peter Kasting <pkasting@chromium.org>
2023-10-19 00:33:28 +00:00
Lei Zhang
c63c073d27 Do IWYU for check_op.h
Include check_op.h directly, instead of relying on the transitive
include from logging.h. This transitive include does not exist in
Chromium's //base.

Change-Id: I15962a9cdc26ac206032157b8d2659cf263ad695
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4950200
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
2023-10-18 20:01:37 +00:00
Peter Kasting
ce4e3d6ee0 Roll crashpad/third_party/mini_chromium/mini_chromium/ 276f2ac53..42f1fddfe (1 commit)
276f2ac531..42f1fddfec

$ git log 276f2ac53..42f1fddfe --date=short --no-merges --format='%ad %ae %s'
2023-10-16 pkasting Use POSIX format specifiers on Windows.

Created with:
  roll-dep crashpad/third_party/mini_chromium/mini_chromium

Bug: 1371963
Change-Id: I7210b416b5e498b9888d1c942084c07ef177b667
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4944315
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2023-10-17 01:24:23 +00:00