173 Commits

Author SHA1 Message Date
Peter Kasting
6419a2e697 Make use of base::fixed_extent<>.
Bug: none
Change-Id: Ia07ebfdd5927e545e3c19b98dc545e7f75ef46ac
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/6091638
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2024-12-13 14:14:57 -08:00
Mark Mentovai
3b0a429371 Fix #includes
- Where std::nullptr_t is used (in namespace std), #include <cstddef>,
   even if it appears alongside <stddef.h> because types like intptr_t
   are used (in the root namespace).
 - Where math library functions are used, #include <cmath> to get and
   use the versions of functions in namespace std which are overloaded
   by argument type, such as std::isinf and std::isnan.

third_party is excluded.

Change-Id: Ic9c143f407e5a9c5cff4098cf566ba5caf4bf6d8
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/6021439
Commit-Queue: Mark Mentovai <mark@chromium.org>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2024-11-14 17:06:54 +00:00
Peter Kasting
f9fa2d112b [reland] Don't redefine macros from base/compiler_specific.h.
`DISABLE_CFI_ICALL` is already defined in that header; use it.

This is both simpler and less likely to trigger macro redefinition
errors.

This was previously landed in crrev.com/c/5805458, but reverted due to
crbug.com/362787700.

Bug: chromium:362787700
Change-Id: I1fc8d9dc0b099c67ea7d774034b7691691ff2a50
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/5825328
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2024-08-28 22:57:49 +00:00
Mark Mentovai
50faaf111e Revert "Don't redefine macros from base/compiler_specific.h."
This reverts commit 458bdec9852280f091a72f9d90eb75f04d0af05f.

Reason for revert: Crashpad roll into Chrommium failed.

https://chromium-review.googlesource.com/c/5805903
https://ci.chromium.org/ui/p/chromium/builders/try/android-x64-rel/171929/
https://logs.chromium.org/logs/chromium/buildbucket/cr-buildbucket/8738938901079891665/+/u/compile__with_patch_/stdout

While linking libcrashpad_handler_trampoline.so:

```
ld.lld: error: undefined symbol: std::__Cr::__libcpp_verbose_abort(char const*, ...)
>>> referenced by ascii.cc
>>>               obj/third_party/abseil-cpp/absl/strings/strings/ascii.o:(std::__Cr::__throw_out_of_range(char const*))
>>> referenced by lightweight_quarantine.cc
>>>               allocator_core/lightweight_quarantine.o:(partition_alloc::internal::LightweightQuarantineBranch::~LightweightQuarantineBranch()) in archive obj/base/allocator/partition_allocator/src/partition_alloc/liballocator_core.a
>>> referenced by lightweight_quarantine.cc
>>>               allocator_core/lightweight_quarantine.o:(partition_alloc::internal::LightweightQuarantineBranch::Purge()) in archive obj/base/allocator/partition_allocator/src/partition_alloc/liballocator_core.a
>>> referenced 1 more times
[…]
ld.lld: error: undefined symbol: std::get_new_handler()
[…]
ld.lld: error: undefined symbol: _Unwind_Backtrace
[…]
ld.lld: error: undefined symbol: _Unwind_GetIP
[…]
ld.lld: error: undefined symbol: __cxa_guard_acquire
[…]
ld.lld: error: undefined symbol: __cxa_guard_release
[…]
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
```

Original change's description:
> Don't redefine macros from base/compiler_specific.h.
>
> `DISABLE_CFI_ICALL` is already defined in that header; use it.
>
> This is both simpler and less likely to trigger macro redefinition
> errors.
>
> Bug: none
> Change-Id: I3ecfe9b6dc4ac42c6a69b3fd9c6d2c68fe8e62a2
> Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/5805458
> Reviewed-by: Mark Mentovai <mark@chromium.org>

Bug: none
Change-Id: Ie225e03e07ab3d0a00933217b377cee14fcdb8b7
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/5806223
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2024-08-22 16:33:50 +00:00
Peter Kasting
458bdec985 Don't redefine macros from base/compiler_specific.h.
`DISABLE_CFI_ICALL` is already defined in that header; use it.

This is both simpler and less likely to trigger macro redefinition
errors.

Bug: none
Change-Id: I3ecfe9b6dc4ac42c6a69b3fd9c6d2c68fe8e62a2
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/5805458
Reviewed-by: Mark Mentovai <mark@chromium.org>
2024-08-22 02:47:50 +00:00
Daniel Cheng
aef7de4e93 [MSan] "Fix" use-after-dtor in InitializationState.InitializationState
Since the test is specifically trying to exercise UB by testing the
state of an object it is already destroyed, unpoison the memory to
suppress MSan errors.

Bug: 40222690
Change-Id: I840e944f5e8b39668ac05d8d641fdd5f2e3db5ac
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/5716150
Reviewed-by: Mark Mentovai <mark@chromium.org>
2024-07-17 17:08:24 +00:00
danakj
84c87739e8 Use the span version of RandBytes
Some unique_ptr<T[]> are also changed to HeapArray in order to
facilitate the change.

Bug: chromuim: 40284755
Change-Id: I30b9d55ff81f23c63ad4958786740f67ee612024
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/5512569
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: danakj <danakj@chromium.org>
2024-05-06 14:12:00 +00:00
Andrew Williams
da189353b6 Replace std::is_pod usage
Replacing std::is_pod usage as per the following compilation error:
```
../../util/misc/uuid.cc:44:20: error: 'is_pod<crashpad::UUID>' is deprecated: use 'is_standard_layout && is_trivial' instead [-Werror,-Wdeprecated-declarations]
static_assert(std::is_pod<UUID>::value, "UUID must be POD");
                   ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/type_traits:818:5: note: 'is_pod<crashpad::UUID>' has been explicitly marked deprecated here
    _GLIBCXX20_DEPRECATED_SUGGEST("is_standard_layout && is_trivial")

```

Bug: None
Change-Id: I1d61ee12261877f7f1f84f0ea15d262d22959766
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/5472885
Commit-Queue: Andrew Williams <awillia@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2024-05-03 21:22:37 +00:00
danakj
7e0af1d4d4 Use byte conversions over the byte swap functions
base/sys_byteorder.h is going away. Instead, use the byte conversions
in base::numerics to convert from a byte array in big endian to an
integer. This avoids putting big endian data into integer types at all.

mini_chromium was rolled and crashpad updated to work with newer
mac/windows toolchains in order to support C++20 in
f9cee5c147db30dc8fa1a048aabd165965b5cb60.

Bug: 40284755
Change-Id: If690847b7aa54b0216e73ec297eae3d0bca2fa57
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/5402184
Commit-Queue: danakj <danakj@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2024-04-11 17:31:35 +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
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
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
Avi Drissman
6a9e2e6003 Adjust to movement of base/ files to base/apple
This CL rolls mini_chromium to pick up the move of a bunch of files
to base/apple, and makes changes to adjust.

Bug: chromium:1444927
Change-Id: Ib692e2a1628e2c0c8228795eaecdb7f35b1c09fa
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4786387
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Avi Drissman <avi@chromium.org>
2023-08-16 21:05:16 +00:00
Peter Kasting
419f995aab Ban [w]ctype.h: crashpad
Bug: chromium:1361094
Change-Id: Ia5dacb9038cd74b5d490282a8070fb4579ebe3ae
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4750179
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Peter Kasting <pkasting@chromium.org>
2023-08-04 16:50:05 +00:00
Thomas Gales
8dcf2b216f [fuchsia] Don't build CaptureContext
CaptureContext isn't actually used on Fuchsia and there is a desire to
remove `ucontext_t` from Fuchsia as it isn't a real concept on Fuchsia
and was only added as a placeholder. Moreover, `ucontext_t` won't ever
be added to Fuchsia for RISC-V.

Bug: fuchsia:123052
Fixed: fuchsia:131112
Fixed: fuchsia:127655
Tested: `fx test crashpad` on core.x64 emulator
Tested: `fx test crashpad` on ARM64 device
Tested: `fx shell crasher` @ 16b19a9891978487 on ARM64 device, ran
through Breakpad stackwalker locally as well
Tested: `fx build crashpad_tests` for minimal.riscv64
Change-Id: I4695054426df78a9deff8c9ea9c478b5bf9701b1
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4717085
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Thomas Gales <tgales@google.com>
2023-07-31 20:03:40 +00:00
Thomas Gales
2cf938a41d [riscv][fuchsia] Add RISC-V Fuchsia support
Only RV64GC is supported.

RISC-V Fuchsia is not able to serve packages yet so unit testing is not
possible.

Bug: fuchsia:127655

Tested: `crasher` with crashpad added to crashsvc, ran minidump through
Breakpad stackwalker

Change-Id: I1b6d79128759281aee348e333ea15434ab397001
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4602412
Reviewed-by: Mark Mentovai <mark@chromium.org>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2023-06-12 21:13:43 +00:00
Thomas Gales
4f5dd67229 [riscv] Add RISC-V Linux support
Only RV64GC is supported.

Bug: fuchsia:127655

Tested: `python build/run_tests.py` on RISC-V emulator
Tested: Created minidump via self-induced crash on RISC-V emulator,
ran through Breakpad stackwalker

Change-Id: I713797cd623b0a758269048e01696cbce502ca6c
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4581050
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2023-06-12 21:13:24 +00:00
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
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
Justin Cohen
df86075acc ios: Prevent duplicate uploads and watchdog kills with slow uploads.
On iOS, holding a lock during a slow upload can lead to watchdog kills
if the app is suspended mid-upload. Instead, if the client can obtain
the lock, the database sets a lock-time file attribute and releases the
flock. The file attribute is cleared when the upload is completed. The
lock-time attribute can be used to prevent file access from other
processes, or to discard reports that likely were terminated mid-upload.

Bug:chromium:1342051
Change-Id: Ib878f6ade8eae467ee39acb52288296759c84582
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3739019
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2022-07-14 18:47:58 +00:00
Nico Weber
7c30a508eb Build actual crashpad .asm files in win/cross builds
Now that we have llvm-ml, we no longer need the workaround for this.

This upstreams
https://chromium-review.googlesource.com/c/chromium/src/+/3708412

Bug: chromium:762167
Change-Id: Iadc8ba9753bb7dd079415ee744f3b176b7e2f629
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3707748
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2022-06-17 13:48:37 +00:00
Daniel Cheng
0affe61689 Migrate base::{size,empty,data} to STL equivalents in crashpad.
Bug: chromium:1299695
Change-Id: I95187a425b08c96430c659f843c379d506972f0f
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3496462
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2022-03-01 12:06:49 +00:00
André Kempe
45cc0da93a arm64: Add Armv8.3-A PAC support to assembly files
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>
2022-02-08 08:42:05 +00:00
Mark Mentovai
50ed179e9a Use BUILDFLAG for OS checking
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>
2022-01-19 20:21:19 +00:00
Avi Drissman
824ddb2de1 Fix presubmit issues
- 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>
2022-01-15 00:09:21 +00:00
Avi Drissman
b560edd484 Remove ALLOW_UNUSED_LOCAL from Crashpad
Bug: 1286390
Change-Id: I9755258960c55bef84e01812a14067ffaf89d2b1
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3388879
Commit-Queue: Avi Drissman <avi@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2022-01-14 23:11:32 +00:00
Salome Thirot
fe19de6e1d arm64: Add Armv8.5-A BTI support to assembly files.
Change-Id: Ic9c2d252829a39b0331e436df16effe7d0607996
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3241142
Commit-Queue: Jonathan Wright <jonathan.wright@arm.com>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2021-12-01 10:47:56 +00:00
Nico Weber
281ba70a13 Fix build with /std:c++17 on 32-bit Windows
Bug: chromium:1274168
Change-Id: I31c300f5cb078e90f25c5752c821f756dedd8591
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3304552
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Nico Weber <thakis@chromium.org>
2021-11-27 01:26:14 +00:00
Justin Cohen
92f6c21242 Retry UploadReport on http upload failures.
This implements a per-report retry rate limit (as opposed to per upload
rate limit in ShouldRateLimitUpload). When a report upload ends in a
retry state, an in-memory only timestamp is stored with the next
possible retry time. This timestamp is a backoff from the main thread
work interval, doubling on each attemt. Because this is only stored in
memory, on restart reports in the retry state will always be tried
once, and then fall back into the next backoff. This continues until
5 retry attempts are reached.

Change-Id: Ibde8855a8a9f0743f0b0bd4d5e3de8a45c64bcb6
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3087723
Reviewed-by: Mark Mentovai <mark@chromium.org>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Commit-Queue: Justin Cohen <justincohen@chromium.org>
2021-11-19 19:58:55 +00:00
Peter Boström
1aa478d161 Remove DISALLOW_* macros in crashpad
This change was partially scripted and partially done manually with vim
regex + manually placing the deleted constructors.

The script change looked for destructors in the public: section of a
class, if that existed the deleted constructors would go before the
destructor.

For manual placement I looked for any constructor in the public: section
of the corresponding class. If there wasn't one, then it would ideally
have gone as the first entry except below enums, classes and typedefs.
This may not have been perfect, but is hopefully good enough. Fingers
crossed.

#include "base/macros.h" is removed from files that don't use
ignore_result, which is the only other thing defined in base/macros.h.

Bug: chromium:1010217
Change-Id: I099526255a40b1ac1264904b4ece2f3f503c9418
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3171034
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Peter Boström <pbos@chromium.org>
2021-09-21 15:09:44 +00:00
Joshua Peraza
1db7e2b547 Avoid use of UMA_HISTOGRAM_COUNTS
UMA_HISTOGRAM_COUNTS is documented as deprecated and defaults to
creating larger histograms than are needed by Crashpad.

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

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

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

Bug: chromium:1210983
Change-Id: Ie3dc4c189dcdfcac030b95fe285f94abb29a27bf
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2917779
Commit-Queue: Lei Zhang <thestig@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2021-05-25 21:44:52 +00:00
Joshua Peraza
b1c36e7478 Resurrect http_transport_libcurl
Bug: chromium:1077284
Change-Id: I19eed6072dd7854b81f7fa8c25470b18b3bc1ffd
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2037803
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2021-04-07 17:19:18 +00:00
Joshua Peraza
5368dc6389 handle potentially throwing functions in no_cfi_icall
Define templates for potentially throwing functions at C++17
when noexcept becomes part of a function's type.

Change-Id: I8e9cbf4b0702ad6b9b9a9d7560418908045fd11a
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2454835
Reviewed-by: Eric Astor <epastor@google.com>
2020-10-26 18:11:33 +00:00
Joshua Peraza
79d43b8ac3 Add noexcept to no_cfi_icall templates
Change-Id: I8115406303813c983bb4bb627e3b25adbdb3efee
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2441392
Reviewed-by: Mark Mentovai <mark@chromium.org>
2020-10-02 17:46:48 +00:00
Eric Astor
865ba27672 Remove unnecessary macro from CaptureContext code
The Windows implementation of CaptureContext used a macro to refer to
the offset of a field in a struct.

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

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

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

Change-Id: Ie0344b7ead9c019cdda8a6e37ea8ec9cd5bf72b0
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2405650
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2020-09-21 21:25:08 +00:00
Jan Wilken Dörrie
a98ee20e57 [crashpad] Prepare crashpad for base::string16 switch
This change prepares crashpad for the upcoming switch of base::string16
to std::u16string on all platforms. It does so by replacing Windows-only
instances of base::string16 with std::wstring, and using appropriate
string utility functions.

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

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

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

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

Change-Id: Ib29dabfe714f2ee9cc06a5d17e6899ff81a06df4
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2339332
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2020-09-10 22:15:29 +00:00
Sean McAllister
3965bc7d78 Refactor OS_LINUX usage for coming LaCrOs update.
We're working to decouple ChromeOS and Linux builds of Chrome.

Currently OS_CHROMEOS sets OS_LINUX, so we need to refactor
current OS_LINUX usage to make this explicit.

More information can be found at go/cros_is_linux_os_linux

BUG=chromium:1110266
TEST=manual build

Change-Id: Ie765da1ab6a0bf0286538ae1df3697abaa29aeaa
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2391116
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
2020-09-03 19:12:04 +00:00
Avi Drissman
4ae896bad0 Migrate to OS_MAC and OS_APPLE in Crashpad
This migrates:

 defined(OS_MACOSX) -> defined(OS_APPLE)
 defined(OS_MACOSX) && !defined(OS_IOS) -> defined(OS_MAC)
 !defined(OS_MACOSX) || defined(OS_IOS) -> !defined(OS_MAC)

Bug: chromium:1105907
Change-Id: I1b4abc19bbbe8df90e9c6e64cd29324b40b8ab71
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2321777
Commit-Queue: Avi Drissman <avi@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2020-07-28 02:35:48 +00:00
Hans Wennborg
161bfed35a Remove/replace unnecessary includes of logging.h
If the file just needs the CHECK/CHECK_OP/NOTREACHED
macros, use the appropriate header for that instead.
Or if logging.h is not needed at all, remove it.

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

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

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

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

Bug: chromium:1031540
Change-Id: I36f646d0a93854989dc602d0dc7139dd7a7b8621
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2250251
Commit-Queue: Hans Wennborg <hans@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2020-06-18 13:51:20 +00:00
Mark Mentovai
a45eea40fc Update gtest to e3f0319d89f4cbf32993de595d984183b1a9fc57
I’m most interested in picking up 1b3eb6ef3462, “Explicitly define copy
constructors used in googletest tests.”

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

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

Change-Id: Id788a27aa884ef68a21bae6c178cd456f5f6f2b0
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2186009
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2020-05-07 14:56:07 +00:00
Justin Cohen
95b4e62768 ios: CaptureContext arm64.
Change-Id: I2db8ead3103391af4d198f213524ea34ffef022b
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2167211
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2020-05-03 19:21:45 +00:00
Justin Cohen
17a515d33d [ios] Bring up first draft Mach exception server.
Add Mach exception server and fill out exceptions snapshot.

Note that:
 - The 'capture' portion of this CL will be moved out of the snapshot
   interface and into a separate in-process dump to disk location.
 - All of the pointer dereferences need to be wrapped in vm_read.
 - The read-fast-and-dump logic in exception_snapshot will end up in a
   different file completely, but until we pick a
   serialization/deserialization method, keep it as-is.

Bug: crashpad:31
Change-Id: I44203aa44036a341d6b4517fde7ab0cb9d7e94d7
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2160122
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2020-04-25 23:38:48 +00:00
Justin Cohen
3c573b54ae [ios] Fix iOS device build.
Change-Id: Ib0f5af9680b4b626df2da006789eb846cd38579d
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2081269
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Justin Cohen <justincohen@chromium.org>
2020-03-03 02:11:41 +00:00