Crashpad currently has a circular dependency: client->snapshot->client.
The dependency from snapshot -> client only exists to pull in a single
constant for Windows (CrashpadClient::kTriggeredExceptionCode), so this
change breaks the dependency by splitting the constant out into a new
file util/win/exception_codes.h.
Change-Id: I6b74b367df716e097758e63a44c53cb92ea5e04d
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3450763
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Justin Cohen <justincohen@chromium.org>
When trying to update Chromium's copy of crashpad I got this error
message:
Banned functions were used.
third_party\crashpad\crashpad\client\crashpad_client_ios_test.mm:33:
testing::Test should not be used in Objective-C++ code as it does
not drain the autorelease pool at the end of the test. Use
PlatformTest instead.
So, I'm fixing the code as requested.
The change was introduced in crrev.com/c/3418581
Change-Id: I4888febbd41b6365d9bde5ad062565770496243f
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3459403
Reviewed-by: Justin Cohen <justincohen@chromium.org>
Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
When updating Chromium's copy of crashpad I received this very
reasonable warning:
client\ios_handler\exception_processor.h: Includes STL header(s) but does not reference std::
So, this change removes the #include of vector.
Change-Id: I22f05b542fd4e0b582351072a3e3bb4af402b836
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3459402
Reviewed-by: Mark Mentovai <mark@chromium.org>
Reviewed-by: Justin Cohen <justincohen@chromium.org>
Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
kernel32.dll no longer works as a source of truth for Windows versions
because it is not updated with every Windows update. This change grabs
the last two version numbers from the registry, if possible.
This also copies some code cleanup from Chromium (crrev.com/c/3205913).
Bug: chromium:1248324
Change-Id: I9d6745084060f033cd54c56f832aed4ac163e6be
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3434090
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
This patch adds optional support for Arm Pointer Authentication Codes.
X30/LR is not stored to stack at any place and restored for usage.
Therefore only adding PAC flag to .note.gnu.property section.
Change-Id: I9581059dfa1eed88af5a73df15b6a0d299caea13
Bug: crashpad: 1145581
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3440070
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Adenilson Cavalcanti <cavalcantii@chromium.org>
xnu turns hardware faults into Mach exceptions, so the only signal left
to register is SIGABRT, which never starts off as a hardware fault.
Installing a handler for other signals would lead to recording
exceptions twice. As a consequence, Crashpad will not generate
intermediate dumps for anything manually calling raise(SIG*). In
practice, this doesn’t actually happen for crash signals that originate
as hardware faults.
Change-Id: I1be669d10e89b8e8ebcc69cfdf79c1ee20c96f76
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3403042
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Justin Cohen <justincohen@chromium.org>
The badAccess test may return different mach exception codes depending
on optimization levels. Simplify by this by turning off optimization
for this particular test.
Also removes testSegv, which was duplicative and not really testing
SIGSEGV.
Change-Id: Idb92731da6a86545ed83c2bbdd200a0b792c579f
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3403040
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Justin Cohen <justincohen@chromium.org>
https://crrev.com/c/3399252 fixed a heap overrun in iOS intermediate
dump processing.
This is a follow-up to that change to harden `CrashHandler` against
similar crashes:
1) Ensure the destructor of `ScopedAlternateWriter` is invoked
to restore `InProcessHandler::writer_` state before processing
the intermediate dump (otherwise, a signal raised by the intermediate
dump handler would dereference the empty `std::unique_ptr` in
`InProcessHandler::writer_`).
2) Harden `InProcessHandler` to check if `writer_` is empty before
handling signals or exceptions
Change-Id: I1e63a496395b26681632302e8915b4433897037a
Bug: 391
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3401766
Reviewed-by: Justin Cohen <justincohen@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
Handle multiple simultaneous crashes among threads by having
the first crashing thread set an atomic flag and subsequently crashing
threads check the flag before requesting a dump. If a dump has already
been requested, the threads pause on a futex with a timeout in case the
crashing thread crashes again or otherwise fails to WakeThreads().
The thread_local disabled_for_thread_ is removed and combined with this
flag because accessing thread_locals produces undefined behavior in
signal handlers.
Bug:crashpad:384, chromium:861730
Change-Id: I83bce36e1010d0635ba8aeac937e150c43a4166f
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3403017
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Both running first chance handlers and checking for disabled signal
handlers should no longer interact with DumpWithoutCrashing().
First-chance-handlers should also run even with disabled crashpad
signal handlers or else those signals would be reported by the next
chained signal handlers as crashes.
Change-Id: I64b3da42c400a1c431c6228d4da181ed56bfda89
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3403413
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Use BUILDFLAG(IS_*) instead of defined(OS_*).
This was generated mostly mechnically by performing the following steps:
- sed -i '' -E -e 's/defined\(OS_/BUILDFLAG(IS_/g' \
-e 's%([ !])OS_([A-Z]+)%\1BUILDFLAG(IS_\2)%g' \
$(git grep -l 'OS_'
'**/*.c' '**/*.cc' '**/*.h' '**/*.m' '**/*.mm')
- sed -i '' -e 's/#ifdef BUILDFLAG(/#if BUILDFLAG(/' \
$(git grep -l '#ifdef BUILDFLAG('
'**/*.c' '**/*.cc' '**/*.h' '**/*.m' '**/*.mm')
- gsed -i -z -E -e \
's%(.*)#include "%\1#include "build/buildflag.h"\n#include "%' \
$(git grep -l 'BUILDFLAG(IS_'
'**/*.c' '**/*.cc' '**/*.h' '**/*.m' '**/*.mm')
- Spot checks to move #include "build/buildflag.h" to the correct parts
of files.
- sed -i '' -E -e \
's%^(#include "build/buildflag.h")$%#include "build/build_config.h"\n\1%' \
$(grep -L '^#include "build/build_config.h"$'
$(git grep -l 'BUILDFLAG(IS_'
'**/*.c' '**/*.cc' '**/*.h' '**/*.m' '**/*.mm'))
- Add “clang-format off” around tool usage messages.
- git cl format
- Update mini_chromium to 85ba51f98278 (intermediate step).
TESTING ONLY).
- for f in $(git grep -l '^#include "build/buildflag.h"$'
'**/*.c' '**/*.cc' '**/*.h' '**/*.m' '**/*.mm'); do \
grep -v '^#include "build/buildflag.h"$' "${f}" > /tmp/z; \
cp /tmp/z "${f}"; done
- git cl format
- Update mini_chromium to 735143774c5f (intermediate step).
- Update mini_chromium to f41420eb45fa (as checked in).
- Update mini_chromium to 6e2f204b4ae1 (as checked in).
For ease of review and inspection, each of these steps is uploaded as a
new patch set in a review series.
This includes an update of mini_chromium to 6e2f204b4ae1:
f41420eb45fa Use BUILDFLAG for OS checking
6e2f204b4ae1 Include what you use: string_util.h uses build_config.h
Bug: chromium:1234043
Change-Id: Ieef86186f094c64e59b853729737e36982f8cf69
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3400258
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
To avoid unnecessary duplication of potentially large memory regions,
the iOS MemorySnapshot data is owned by the intermediate dump. When
merging two iOS memory snapshots, it's necessary to copy the merged
data into a vector owned by the memory snapshot itself.
Previously the merged snapshot just contained the original data, which
leads to a heap overrun.
Bug: 1288544
Change-Id: I4eb392800141451db188d17c7b9f9ca9bd3bb603
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3399252
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Mig-generated files contain mig identifiers, which include timestamp and mig build info.
To improve build determinism and goma cachehits we can replace these lines with something stable.
Bug: crashpad:390
Change-Id: Iedb2f6e64428612899587c2ac4d488baf439961f
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3394052
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
Right now there's no clear way to differentiate between Signal and Mach
exceptions. Instead, set EXC_SOFT_SIGNAL as the top level exception for
signal exceptions, moving the signal number to ExceptionInfo() and
and the signal code plus the two previous values into Codes().
Fixed:crashpad:389
Change-Id: Ia57f402b98be2a648febb58b9dee0cb80d9e5954
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3388874
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Justin Cohen <justincohen@chromium.org>
- Formatted util/misc/initialization_state_dcheck.h
- Included build/build_config.h file in
util/stdlib/aligned_allocator_test.cc as it uses an
OS_* macro.
Change-Id: I8fb67f1ae440834d1b60f390658513a341789428
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3390648
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Avi Drissman <avi@chromium.org>
6562d2d0b2a8 Compile as C++17 by using -std=c++17 (and /std:c++17 on
Windows)
Change-Id: I10c209e8147425af77392e7649210ab68a5d27a7
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3371781
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
From the Fuchsia build:
```
ERROR at //third_party/crashpad/util/BUILD.gn:658:7: Undefined identifier.
defines += [ "CRASHPAD_USE_BORINGSSL" ]
^------
See //src/developer/forensics/crash_reports/BUILD.gn:127:5: which caused the file to be included.
"//third_party/crashpad/util",
^----------------------------
```
Change-Id: I1f563e5bb599b3a7a83ee8211037ee1d7464bd62
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3370891
Reviewed-by: Francois Rousseau <frousseau@google.com>
Commit-Queue: Francois Rousseau <frousseau@google.com>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Fuchsia is currently pulling in lss twice, this rolls crashpad up to
HEAD and redirects the Fuchsia build to use the existing copy in our
dependencies.
Change-Id: Ib698ee72d3d1881d22128bc94a1f6f17185a0755
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3364805
Reviewed-by: Francois Rousseau <frousseau@google.com>
Commit-Queue: Francois Rousseau <frousseau@google.com>
googletest is rolled to 5bcd8e3bb929714e031a542d303f818e5a5af45d to pick
up changes that affect how process information is read on fuchsia. The
existing pin is from April 26 2021 and the new one is from June 8: this
is a conservative roll - and the new pin matches that of other fuchsia
SDK partners.
Bug: fuchsia:30751
Change-Id: Ie1c4d075cfc2968c0984671c3afd0bc50fe00d3f
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3335589
Reviewed-by: Francois Rousseau <frousseau@google.com>
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Francois Rousseau <frousseau@google.com>
_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS is needed to bring
back std::unexpected, which is removed in C++17, but still needed
for libc++abi for backward compatibility.
Bug: 1274565
Change-Id: I5b5687ef7a49e90bf6937ade8b02ff4484690e09
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3307905
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Justin Cohen <justincohen@chromium.org>
This fixes a _LIBCPP_ASSERT vector[] index out of bounds error, caught
by fuzzer.
Bug: 1274178
Change-Id: I95f3fbe450209a24ccc0229741ea752990e18ed6
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3307697
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
Previously we would rely on implicit re-raising to deliver signals to
the underlying handler on POSIX systems if the signal is detected as
being re-raisable via WillSignalReraiseAutonomously(). This detection
mechanism is imperfect, as it will misclassify signals delivered as
a result of kill(2) when passing a signal number usually used for
synchronous signals, but now also asynchronous MTE tag check faults,
which are delivered as SIGSEGV signals on Linux. As a result, these
signals would not be re-raised and therefore would be discarded.
Although we could, for example, teach WillSignalReraiseAutonomously()
about MTE faults, the signal would still be re-raised via raise(3)
and therefore we would lose the information in siginfo.
We can avoid discarding these signals on Linux while at the
same time preserving the siginfo by making use of the syscall
rt_tgsigqueueinfo(2) which delivers a signal together with a
user-provided siginfo. The problem still exists on non-Linux POSIX
systems because this syscall is Linux-specific.
With kernel versions prior to 3.9, the kernel will reject the
rt_tgsigqueueinfo() syscall with EPERM. If that happens, follow
the non-Linux code path.
Change-Id: Ia410fbd651a756945c9402e361edfd5c520453d6
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3300991
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Peter Collingbourne <pcc@chromium.org>
Following https://crev.com/d3d85ce0b330b11f73f0495b7b99cea0d04d8c63,
the compiler now does not build an unwind library into the ASAN
runtime, nor is one available from the NDK in r23. Restoring Chrome's
standard dependencies (libcxx, libunwind) prevents a link error.
Bug: 1271628
Change-Id: I62d1c066bd7037276d78e2533dd5e4c3cf14f8c7
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3298826
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Richard Townsend <richard.townsend@arm.com>
Causes test failures on older versions of Android (e.g. Marshmallow).
Also reverts follow-up CL "Fix dead-code warning in util/posix/signals.cc".
This reverts commits ab9a87fb5463e5d1579e16bacb1f79d0dd71119b and
04431eccfe878570b1c74a5b376d96b4c9c7e0e8.
Bug: 1272877
Change-Id: Id9ef420516c932147b6c8b67d9f4daf9d31d9b03
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3300986
Reviewed-by: Peter Boström <pbos@chromium.org>
Commit-Queue: Peter Collingbourne <pcc@chromium.org>