985 Commits

Author SHA1 Message Date
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
Mark Mentovai
2f217736a3 ios: Deal with ios_enable_relative_sdk_path in Chromium
Change-Id: Ibb03748d8881c4a71662a7d6ad5743107ccd748d
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2174267
Reviewed-by: Nico Weber <thakis@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2020-05-02 00:34:22 +00:00
Mark Mentovai
174a92d296 mac, ios: Add ExceptionPorts::SwapExceptionPorts
Change-Id: Ia4044c82440af1d05c24ee502d51eef5185cbeec
Test: crashpad_util_test ExceptionPorts.*_Swap*
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2170546
Reviewed-by: Justin Cohen <justincohen@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2020-04-28 16:43:41 +00:00
Mark Mentovai
57e807da6d ios: Build (and test) SymbolicConstantsMach
Bug: crashpad:31
Test: crashpad_util_test SymbolicConstantsMach.*
Change-Id: Ia76a5fb2d5ca2afdd06d99dab9ab1b72cd5a6f0d
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2169867
Reviewed-by: Justin Cohen <justincohen@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2020-04-28 16:43:32 +00:00
Mark Mentovai
ecc41d0229 doc: Update Doxygen to 1.8.18 and fix Doxygen warnings
% doxygen -u doc/support/crashpad.doxy
[…warnings about removing obsolete TCL_SUBST, PERL_PATH, MSCGEN_PATH…]
Configuration file 'doc/support/crashpad.doxy' updated.
% doxygen -v
1.8.18

Change-Id: I771f654713042b0040873355051b9efaf46bffd1
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2165817
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2020-04-27 16:45:20 +00:00
Mark Mentovai
a5a1c3b07f Add .style.yapf and reformat according to yapf, using “google” style
% yapf --in-place $(git ls-files **/*.py)
% yapf --version
yapf 0.30.0

Note that this is not using the “chromium” yapf style because Chromium
is moving to PEP-8.
https://groups.google.com/a/chromium.org/d/topic/chromium-dev/RcJgJdkNIdg
yapf 0.30.0 no longer recognizes “chromium” as a style option.
22ef70f3c4
Since this is a mass reformatting, it might as well move things all the
way into the future all at once.

This uses the “google” style, which is a superset of “pep8”.

Change-Id: Ifa37371079ea1859e4afe8e31d2eef2cfd7af384
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2165637
Commit-Queue: Mark Mentovai <mark@chromium.org>
Reviewed-by: Scott Graham <scottmg@chromium.org>
2020-04-27 13:59:09 +00:00
Mark Mentovai
29b1688c11 Replace remaining uses of NULL with nullptr
I did a mass conversion in 5d74f120fc57 (October 2014) but these few
must have shown up after.

This excludes code in third_party.

Change-Id: I61cb0273804c0424904a516ed5ab735548b6b9cb
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2166725
Reviewed-by: Justin Cohen <justincohen@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2020-04-27 13:58:49 +00:00
Justin Cohen
be57546fea ios: Fix Chromium banned warning about NULL.
Change-Id: I29eefb067b171fb3d8ef9fa93c3bb146a206c9ce
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2166724
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2020-04-27 03:23:29 +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
Scott Graham
069fddf184 fuchsia: Remove unused sysinfo dep
This was previously used, but is no longer required. Delete the one
remaining include at the build rules.

Change-Id: If5083a4fb8a5562d3e40149976bd27fcec0fd302
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2165635
Reviewed-by: Mark Mentovai <mark@chromium.org>
Reviewed-by: Francois Rousseau <frousseau@google.com>
Commit-Queue: Scott Graham <scottmg@chromium.org>
2020-04-24 20:00:17 +00:00
Mark Mentovai
adfd94a357 ios: Use compat to provide items missing from the iOS SDK
This updates the way that the .defs files added in 1bfd7d06ed60 are
treated, by putting them in compat/ios, using compat as intended. The
.defs files in compat forward, via #include, to the ones in
third_party/xnu. Additionally, compat/mac is enabled for iOS, as
everything in compat/mac is sensible on iOS, and will have no effect
when rendered unnecessary by the iOS SDK.

This also changes util:mig_output to a static_library instead of a
source_set. I don’t think there was any reason for it to have been a
source_set to begin with. static_library is preferred for nearly
everything.

Bug: crashpad:31
Change-Id: I7c468d6d6785bf2bc825d45831ebb81e1c9ddfbc
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2160310
Reviewed-by: Justin Cohen <justincohen@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2020-04-22 16:09:05 +00:00
Mark Mentovai
64b8791f45 ios: Build util/mach/exc_server_variants.cc, support code, and tests
This makes UniversalMachExcServer available on iOS.
UniversalMachExcServer is the foundation for a Mach exc and mach_exc
server.

Some code in UniversalMachExcServer needs to be evaluated to ensure that
portions that run in the same process that has sustained the exception
are safe to do so at that time. For example,
SimplifiedExcServer<ExcTraits>::Interface instantiates and appends to a
std::vector<>, which is generally unsafe in this context. However, that
code responds to exc requests. The mach_exc equivalent,
SimplifiedMachExcServer<MachExcTraits>::Interface, does not use a vector
at all.

This also enables support code in the form of CompositeMachMessageServer
and UniversalExceptionRaise, all of the tests for
CompositeMachMessageServer, and most of the test for
exc_server_variants.cc. The multiprocess-based exc_server_variants tests
remain disabled on iOS.

Bug: crashpad:31
Change-Id: I838ed770a33ca29c37383c32245eb340fb3ad2fb
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2159287
Reviewed-by: Justin Cohen <justincohen@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2020-04-21 19:26:24 +00:00
Mark Mentovai
1bfd7d06ed ios: Run mig with the correct SDK and architecture
mig was being invoked without any -arch argument, causing it to assume
the build system’s native architecture, which would be x86_64. This is
not correct for iOS device builds, which use arm64. The -arch argument
must be plumbed to mig for correct behavior.

When building for iOS, mig was being invoked without any -isysroot
argument, causing it to use the root for the build system, which runs
macOS and not iOS. The macOS SDK doesn’t include the ARM definitions
needed for iOS device builds.

<mach/exc.defs> and <mach/mach_exc.defs> depend on a small number of
other .defs files to provide definitions of standard types. All .defs
files are absent from the iOS SDK. These .defs files are borrowed from
xnu and placed in third_party/xnu. An additional --include argument is
added to allow mig to locate these files.

Bug: crashpad:31
Change-Id: I27154310352939ebe2fb6329bbbfda701c369289
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2159291
Reviewed-by: Justin Cohen <justincohen@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2020-04-21 19:24:44 +00:00
Mark Mentovai
3e748e9c4e ios: Provide a copy of mach_exc.defs and run mig on it
This updates (and corrects) 8dbbaff2e1a5, which added exc.defs, by
adding mach_exc.defs too.

The difference betwen the exc and mach_exc subsystems is that the |code|
parameter is int[] in exc and int64_t[] in mach_exc. Many exceptions
carry the exception address in code[1], and a 32-bit int results in the
exception address being truncated in exc. No information is lost in
mach_exc, where a 64-bit int64_t is used.

In 8dbbaff2e1a5, I misremembered the type of the |code| parameter as a
type derived from uintptr_t, such as vm_address_t, an integer as wide as
a pointer. I was wrong, and mach_exc is necessary. I also noted that
Apple normally forbids mach_-prefixed interfaces in favor of the
prefix-less ones for the reasons I mentioned, and that, all else being
equal, it was desirable to adhere to the spirit of that convention.
Because neither exc nor mach_exc are available in the SDK, it’s moot
from a technical perspective, as we need to provide our own stubs either
way.

Bug: crashpad:31
Change-Id: Ied1be470e653b2bead1a283cb8b9283d210c328d
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2159286
Reviewed-by: Justin Cohen <justincohen@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2020-04-21 19:23:24 +00:00
Mark Mentovai
4cb79941fc ios: Build four more Mach message and exception utilities
This enables the following code in util/mach on iOS:
 - exception_behaviors.{cc,h}
 - exception_ports.{cc,h}
 - mach_message.{cc,h}
 - mach_message_server.{cc,h}

Only the ExceptionBehaviors and MachMessage tests are built, because the
other two are tested by multiprocess tests that won’t run on iOS.

The AuditPIDFromMachMessageTrailer function from mach_message.h is
excluded on iOS because it relies on <bsm/libbsm.h>, which is broken on
iOS: it depends on <bsm/audit_record.h>, which is missing from the SDK.
Additionally, the BSM function that Crashpad uses, audit_token_to_au32,
is marked as unavailable on iOS. Crashpad uses it on macOS to
authenticate Mach messages sent by other processes, but this is moot on
iOS.

Bug: crashpad:31
Change-Id: I5ebc4b80543989b9cd0b85b82eb4b3ff98c44e6c
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2155086
Reviewed-by: Justin Cohen <justincohen@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2020-04-18 03:27:59 +00:00
Mark Mentovai
8dbbaff2e1 ios: Provide a copy of exc.defs and run mig on it to generate exc stubs
The iOS SDK doesn’t include a copy of <mach/exc.defs>. It only provides
<mach/exc.h>, which is just the user-side header. To obtain declarations
and implementations of the server-side stubs, a current copy of
<mach/exc.defs> is added to third_party, and the mig action in util is
updated to use it on iOS.

The three other mig subsystems that Crashpad uses are not brought to
iOS:
 - mach_exc is identical to exc except it always uses 64-bit quantities
   for addresses in place of exc’s use of quantiies sized for native
   pointers. Because all iOS work is limited to a single process, there
   is no need to consider cross-process operation with variable bitness,
   so mach_exc is unnecessary. We’re also only targeting 64-bit for iOS,
   so exc will always suffice. This follows the spirit of other
   mach_-prefixed routines on iOS, where Apple forbids mach_vm_read to
   user applications but permits vm_read.
 - notify is primarily used on macOS in the Crashpad handler process to
   receive a no-senders notification, which is used to trigger handler
   shutdown when it has no more clients. This is not believed to be
   useful to Crashpad on iOS, which is restricted to single-process
   operation.
 - child_port is a Crashpad-specific subsystem used to pass Mach rights
   between processes, but is similarly useless when restricted to
   single-process operation as on iOS.

Bug: crashpad:31
Change-Id: Id4cb3cdd529814438d378c20702c82c1e89dd2be
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2154530
Commit-Queue: Mark Mentovai <mark@chromium.org>
Reviewed-by: Justin Cohen <justincohen@chromium.org>
2020-04-17 21:11:57 +00:00
Mark Mentovai
ba24acb86c ios: Split bootstrap out from mach_extensions
mach_extensions is sensible on iOS, but bootstrap is not available
outside of macOS. To allow mach_extensions to be used cleanly on iOS,
the bootstrap code is moved into its own macOS-specific file.

Bug: crashpad:31
Change-Id: I7bf9d5194253b563954a1e55fbf67a16f686e8ff
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2154529
Reviewed-by: Justin Cohen <justincohen@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2020-04-17 20:54:47 +00:00
Mark Mentovai
122a400d7b ios: Enable (and test!) more of util and test
This builds some code in the util and test libraries on iOS that was
previously excluded. It also enables tests for this code, and other
tests that it was possible to enable either previously or as a result of
this change.

Previously, crashpad_util_test ran 178 tests from 46 test suites, and
crashpad_test_test ran 2 tests from 2 test suites. Now,
crashpad_util_test runs 284 tests from 62 test suites, and
crashpad_test_test runs 6 tests from 4 test suites.

The related .gn files also suffered through a slight cleanup.

Bug: crashpad:31
Change-Id: I84cdda5631f0ea4888ada902a8462776ac46fd2a
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2154526
Reviewed-by: Justin Cohen <justincohen@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2020-04-17 20:54:17 +00:00
Justin Cohen
ea4af71c2a Add another iOS library path sinkhole.
Add another sinkhole for _UIGestureEnvironmentUpdate.

Bug: crashpad:31
Change-Id: Ic4a424da034249295b6e45f8fe0860a4d4696b93
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2145017
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
Reviewed-by: Justin Cohen <justincohen@chromium.org>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2020-04-16 15:25:57 +00:00
Mark Mentovai
e621aaa132 Make “gn check” pass
Change-Id: Ia7a215e1a2d0a3b1868b00c5d47b46ef8a675cdc
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2144917
Reviewed-by: Justin Cohen <justincohen@chromium.org>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2020-04-13 18:29:42 +00:00
Justin Cohen
b2fd7d5307 [ios] Bring up first half of UncaughtExceptionHandler.
When code raises an Objective-C exception, unwind the stack looking for
any exception handlers. If an exception handler is encountered, test to
see if it is a function known to be a catch-and-rethrow 'sinkhole'
exception handler. Various routines in UIKit and elsewhere do this, and
they obscure the exception stack, since the original throw location is
no longer present on the stack (just the re-throw) when Crashpad
captures the crash report. In the case of sinkholes, trigger an
immediate exception to capture the original stack.

The is an improvement over the alternative,
NSSetUncaughtExceptionHandler, which passes along the stack frames, but
not the stack memory contents and full exception context itself.

The details of what happens after a fatal exception is triggered are
unresolved in this CL.  For now, simply call std::terminate.

This code was inspired by chromium/src/chrome/browser/mac/
exception_processor.mm.

Bug: crashpad:31
Change-Id: Ieebc6476a0507c466c8219c10f790ec0a624e58c
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2125254
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2020-04-08 20:57:21 +00:00
Joshua Peraza
c4cc4e6ac9 android: initialize signal dispositions
Bionic installs signal handlers which request crash
dumps from Android's debuggerd, but there are errors
in how signals which aren't automatically re-raised
are handled on Marshmallow (API 23).

Before requesting a dump, Bionic acquires a lock to
communicate with debuggerd and expecting imminent
death, never releases it.

While handling the dump request, debuggerd allows
the dying process to continue before
ptrace-detaching it. So, when Bionic manually
re-raises a signal, it is intercepted by debuggerd
and the dying process is allowed to live.

Bionic restores SIG_DFL for the signal it's just
handled, but if a different crash signal is later
recieved, Bionic attempts to reacquire the lock to
communicate with debuggerd and blocks forever.

Disable Bionic's signal handlers for these signals
on Marshmallow.

Bug: chromium:1050178
Change-Id: Ia1fc5a24161a95931684d092ba8fee2f0dfbbdbb
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2134513
Reviewed-by: Mark Mentovai <mark@chromium.org>
2020-04-08 17:21:05 +00:00
Justin Cohen
af62d7fcf6 Correct use of -[NSString UTF8String].
Fixes the chromium presubmit error for UTF8String:
 The use of -[NSString UTF8String] is dangerous as it can return null
 even if |canBeConvertedToEncoding:NSUTF8StringEncoding| returns YES.
 Please use |SysNSStringToUTF8| instead.

Bug: crashpad:31
Change-Id: Iaf939012ea9d342f6a01af58119cef962319aefe
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2119613
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Justin Cohen <justincohen@chromium.org>
2020-03-26 04:19:33 +00:00
Justin Cohen
d9c1ca1216 [ios] Bring up first draft system snapshot and iOS data collector.
Gather most of the necessary information for the system 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 thread_snapshot may end up in a
   different file completely, but until we pick a
   serialization/deserialization method, keep it as-is.

Bug: crashpad:31
Change-Id: Iac82491fdb4a823163f02149f52a1e18e26fa9de
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2090173
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2020-03-25 20:31:06 +00:00
Joshua Peraza
b75c578373 linux: disable arguments test on old kernels
Bug: chromium:1050178
Change-Id: Ideafa5971cbaf76fa6865f671158958e7abb3a8c
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2117366
Reviewed-by: Mark Mentovai <mark@chromium.org>
2020-03-24 21:05:17 +00:00
Nico Weber
2965013518 Prepare crashpad mig stuff for -Wunreachable-code in chromium_code.
Bug: chromium:346399
Change-Id: I5d93a2f6781dd4dd3483009d9c470050d490be3c
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2116252
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Nico Weber <thakis@chromium.org>
2020-03-23 20:18:51 +00:00
John Bauman
9a31d3f8e9 Print thread state after failure to suspend
This may help us debug some issues where the thread is failing to
suspend.

Bug: b/151318587
Change-Id: I0d2d539f769ebb1cdd71606e1d23d8fa66673879
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2103411
Commit-Queue: John Bauman <jbauman@chromium.org>
Reviewed-by: Scott Graham <scottmg@chromium.org>
2020-03-13 22:48:26 +00:00
Joshua Peraza
7500e2ef45 linux: add fallback-modes for memfd_create
Bug: chromium:1051354
Change-Id: I5dbbb3b264c09060429db199aa9f046c2f317c48
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2080651
Reviewed-by: Mark Mentovai <mark@chromium.org>
2020-03-03 18:09:45 +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
Leonard Chan
8bad6f140e [UBSan] Temporarily disable UBSan for gtest and file
These should be the remaining instances of UB errors we see.

Bug: fuchsia:46805
Change-Id: Id8285386fd6cb52518f6076ddb79ac60025f9f87
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2067754
Reviewed-by: Scott Graham <scottmg@chromium.org>
Commit-Queue: Scott Graham <scottmg@chromium.org>
2020-02-24 17:26:35 +00:00
Justin Cohen
9ed8290547 Bring up skeleton crashpad_client_ios.
First steps at bringing up the crashpad_client on iOS.  Also updates
the XCUITest to trigger various crashes, with some swizzling
necessary to allow crashes.

Change-Id: I87dd36bed1c052b509d14bfa29679ed81e58a377
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2039470
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
Reviewed-by: Rohit Rao <rohitrao@chromium.org>
2020-02-18 20:03:41 +00:00
Joshua Peraza
faed21a286 linux: Log register sizes on mismatch
Bug:1051354
Change-Id: Ia7731a87420e61756b61d109f9c69970ec27c6cb
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2062776
Reviewed-by: Mark Mentovai <mark@chromium.org>
2020-02-18 19:38:58 +00:00
Joshua Peraza
07812f5bd6 android: fix the gyp build
Change-Id: Ic54fd61258f4ea5b3aaa83a252faa0053ca1f552
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2062773
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2020-02-18 19:24:21 +00:00
Nico Weber
7ed4d5c454 arm: Properly mark _ZN8crashpad14CaptureContextEP10ucontext_t as %function
lld wants to remove bl/blx substitution for non-function symbols
(https://reviews.llvm.org/D73542). GNU ld apparently already doesn't
do it.

Since _ZN8crashpad14CaptureContextEP10ucontext_t wasn't marked as a function,
chromium's thumb code would then branch without mode transition into
crashpads non-thumb assembly (in arm32).

So mark the symbol as function, so that things work even if that patch
relands. This should also make things work with GNU ld, though I haven't
verified that it was broken before and works now.

I also did this for aarch64 since it seems like The Right Thing To Do
(assuming the assembler accepts it, which I also haven't checked --
the CQ will hopefully check that).

Bug: chromium:1049649
Change-Id: I3452c16f0d52a2dc0397fd3d60d06b5c39a4b524
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2044144
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Nico Weber <thakis@chromium.org>
2020-02-07 23:42:19 +00:00
Tao Bai
915862984c [log minidump] add option to log minidump in handler_main
- Add option to log minidump in handler_main, also add option to
  disable to dump minidump and generate report.
- Implement log minidump in CrashReportExceptionHandler.

Bug: crashpad:308
Change-Id: I8d2f7e118912011a8416f1ec36c9ee9d561d06e6
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1995825
Commit-Queue: Tao Bai <michaelbai@chromium.org>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2020-01-30 18:06:58 +00:00
Nico Weber
2fd16e3392 Reformat all gn files
Port of chromium-side
https://chromium-review.googlesource.com/c/chromium/src/+/1997899

Bug: chromium:1041419
Change-Id: Ic7afefa0dea024da37fe4bb0f965840a160e2166
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2015428
Commit-Queue: Mark Mentovai <mark@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2020-01-23 13:59:00 +00:00
Tao Bai
b411976ca5 [log minidump] add tool to encode/decode minidump log.
- This tool could compress/encode or decode/decompress the minidump
  log file, will be used by script to symbolize the crash.
- Added FileOutputStream and FileEncoder.

Bug: crashpad:308
Change-Id: I15c3e4908882a09983ec81a90e38249967c29fc4
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1968059
Commit-Queue: Tao Bai <michaelbai@chromium.org>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2019-12-18 22:16:48 +00:00
Joshua Peraza
d3d0c8d3ca android: don't expect code addresses to be readable
Change-Id: I252a93db5f4166216664ae8f67e331fc7eed8852
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1967548
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
2019-12-13 18:58:42 +00:00
Tao Bai
fa28ef896c [log minidump] LogOutputStream implementation
Emit the received data to Android logcat in Android, and noop for
other platforms.

Bug: crashpad:308
Change-Id: I6e46e2fa8bd61f93f614ad0bfb6441a79139b04b
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1958711
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2019-12-12 23:04:38 +00:00
James Forshaw
c6153f0b6e [Windows] Add AppContainer SID to Named Pipe DACL.
This CL modifies the creation of the Named Pipe Security Descriptor to
allow access from AppContainer processes. The DACL only allows access for
the current user and SYSTEM which matches up with the auto-assigned DACL
used previously (the read-only logon SID ACE has been removed). As this
new code uses APIs from ADVAPI32 a check is made to ensure it's not being
called while the loader lock is held to avoid hitting previous similar
issues.

Bug: crashpad: 318
Change-Id: I3f9cf5c788dbadacad21c8a2d57a0188f690ac32
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1955982
Commit-Queue: James Forshaw <forshaw@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2019-12-10 17:16:24 +00:00
Tao Bai
3e4d6a9b7f [log minidump] Base94OutputStream implementation
Add Base94 encoding/decoding implementation and tests.

Bug: crashpad:308
Change-Id: If3f25efcb277eacd5d8cbe1d66f22919872c7d64
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1796682
Commit-Queue: Tao Bai <michaelbai@chromium.org>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2019-12-06 19:27:33 +00:00
Mark Mentovai
31470459b6 Fix line endings on files introduced in 359fc4a1336d
"\r\n" was used instead of "\n" on four new files.

No other "\r" appears in any text file, repository-wide.

Bug: crashpad:316
Change-Id: I94f5d20cd2498e76efdee6062382669362e6e53d
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1954713
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2019-12-06 04:24:30 +00:00
Joshua Peraza
bcab7ad54c linux: handle large mapped files
Chrome on Android normally builds the handler without large file
support because support for large files varies by API level and NDK
version.

https://cs.chromium.org/chromium/src/build/config/compiler/BUILD.gn?rcl=6b5017edcd8544acbdb157086a1645ce36c03057&l=360

https://android.googlesource.com/platform/bionic/+/master/docs/32-bit-abi.md#32_bit-and

The handler still needs to able to handle large files mapped by other
code modules.

Bug: crashpad:312
Change-Id: I1022b706797f41445650f82c425a92e6e2308618
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1954426
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
2019-12-05 21:33:20 +00:00
James Forshaw
359fc4a133 [Windows] Add checks for DLL loader lock.
This CL adds code to check if the current thread holds the DLL loader
lock. This code can be used to enforce the requirement that certain
parts of crashpad, such as process creation are not done during calls
to DllMain which can lead to deadlocks and crashes. Only one check is
current enforced, in client process creation, and only in debug builds.

Bug: crashpad: 316
Change-Id: I5757a264bbf28ce2ab88a0cd7ac9481e46428c17
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1945993
Reviewed-by: Mark Mentovai <mark@chromium.org>
Reviewed-by: Scott Graham <scottmg@chromium.org>
Commit-Queue: James Forshaw <forshaw@chromium.org>
2019-12-03 21:42:32 +00:00
Joshua Peraza
74490f00a4 linux: roll lss and use sys_sigtimedwait/sys_sigprocmask
Bug: crashpad:265
Change-Id: I4b8f566e2a211cca96eef8a2c1098408a38bcf23
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1914840
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
2019-11-13 22:10:54 +00:00
Joshua Peraza
2291bfa32e android, gyp: fix the build
Change-Id: If852448b5719310b73774cac635ef9c52a3efc22
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1914349
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
2019-11-13 21:16:24 +00:00
Joshua Peraza
93f8aa8df9 posix: fix parameter name in signals test
Change-Id: I6e998571171c9a725d88a9529c73d01c62ee984f
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1905146
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
2019-11-08 04:02:38 +00:00
Joshua Peraza
6dadd492b8 linux: fix proc stat reader flakiness
ProcStatReader.Threads is flaky because it relies on an internal,
imprecise measurement of boot time. The flaky test asserts that a
thread started after the main thread should have a start time >= the
main thread. The start time is returned in a timeval, with microsecond
precision, but the measurement of boot time requires two system calls
and the time between those system calls can be approximately a
microsecond. An unlucky event such as a change in system time could
make this imprecision arbitrarily bad.

This patch lets the caller of ProcStatReader.StartTime() inject the
boot time, allowing ProcStatReader to guarantee that threads have
correctly ordered time, given the same input boot time.

Bug: 1016765
Change-Id: I6e4a944a1d58c3916090bab6a4b99573e71a89fc
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1891588
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
2019-11-07 16:54:17 +00:00
Francois Rousseau
27322abb7e [net] specify parameter name in parameterized test suite
* this renders as "HTTPTransport/HTTPTransport.ValidFormData_Gzip/http"
  instead of the default "HTTPTransport/HTTPTransport.ValidFormData_Gzip/0"
* switch the parameter type from a base::FilePath::StringType to a string

Change-Id: I19743966406f92176c566827d74a79aef5a87bb5
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1900324
Reviewed-by: Scott Graham <scottmg@chromium.org>
Commit-Queue: Francois Rousseau <frousseau@google.com>
2019-11-06 01:35:18 +00:00
Joshua Peraza
1b60c8172c commit test ssl certificate to testdata
Chromium requires build artifacts to be generated deterministically so
commit a long-lived (10 years) test certificate to the repository.

Change-Id: I7a6e2441f506196ca58fbbf757648fa0ac70bc9a
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1872188
Reviewed-by: Mark Mentovai <mark@chromium.org>
Reviewed-by: Scott Graham <scottmg@chromium.org>
2019-11-05 17:47:01 +00:00
Joshua Peraza
661a07a41b linux: add deps for boringssl in chromium
Change-Id: Icc0acddd7218c85950874555405c8f8b5c3149dd
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1869251
Reviewed-by: Mark Mentovai <mark@chromium.org>
2019-10-18 15:37:06 +00:00
Joshua Peraza
47a342133d linux: use boringssl in chromium
Or else the uploader will check fail when uploading to https://...

Change-Id: I88a765215cc7bff5809b8effd92f4e39bebd1e5b
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1860940
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
2019-10-15 15:58:26 +00:00
Joshua Peraza
7289acb78a linux: don't assume vdso exists
AT_SYSINFO_EHDR may be defined even if no vdso is used. e.g. 32-bit ARM
processes have a vdso on 64-bit ARM cpus, but not on 32-bit cpus.

Change-Id: I4d9ce029bb47efc33ea16cb4c5c2055c1b9330c9
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1860935
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
2019-10-15 15:58:06 +00:00
Mark Mentovai
c009b85449 Use GTEST_SKIP() instead of custom DISABLED_TEST()
Since gtest 00938b2b228f, gtest has built-in first-class support for
skipping tests, which is functionally identical (at least in Crashpad’s
usage) to the home-grown support for run-time dynamically disabled tests
introduced in Crashpad 5e9ed4cb9f69.

Use the new standard pattern, and remove all vestiges of the custom
local one.

This was done previously in 79f4a3970a64, but was reverted in
bba9d0819c12 because Chromium’s test launcher did not support
GTEST_SKIP() at the time. The deficiency is on file as
https://crbug.com/912138.

While that bug was never specifically marked as “fixed” and I haven’t
found what changed in Chromium, I do now see some use of GTEST_SKIP() in
Chromium. I also prototyped this change in Chromium at
https://chromium-review.googlesource.com/c/1854691/ and found that
GTEST_SKIP() does indeed now appear to work.

Change-Id: I13fef8fe8bfd9854a40dfa5910a3282d1a85bc45
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1855380
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2019-10-11 16:45:34 +00:00
Joshua Peraza
eff0680c13 linux: silence logs on client disconnect
When all Crashpad clients have closed their crash handling sockets,
the handler's recvmsg() returns 0 and doesn't include any credentials.
Silence error logs for this normally occurring case.

Change-Id: I56acf3b38c8e95a9bbaa9bff04e0a6859a194e66
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1816286
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
2019-09-20 18:45:57 +00:00
Alex Pankhurst
2bfd3c4edc [POSIX] stop logging on ENOENT
This change stops IsRegularFile and IsDirectory from logging
an error in the instance that a file or directory cannot be found.

Change-Id: I9f3c409933245708db775f566a27f5e49b2c71f3
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1795924
Commit-Queue: Francois Rousseau <frousseau@google.com>
Reviewed-by: Scott Graham <scottmg@chromium.org>
2019-09-13 16:16:18 +00:00
Joshua Peraza
e97cf7b29c update gyp_crashpad_android.py
This patch updates gyp_crashpad_android.py to function with NDK r20,
removes the requirement to generate a standalone toolchain, and updates
documentation on building for Android.

Also some gyp build fixes.

Change-Id: Ide338417ab2a21eca7a4bf42c1fb834e5639c186
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1798746
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
2019-09-11 19:05:30 +00:00
Francois Rousseau
abeccef1ef [fuchsia] fix crashpad_use_boringssl_for_http_transport_socket path
* https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1745355/17/util/BUILD.gn#184 defines "defines" earlier in the target
* this only affects Fuchsia in the Fuchsia tree, not the Crashpad tree

TESTED=`fx build` in Fuchsia tree

Change-Id: I5ac454828f958d6de4e4c6788d7c9a31408dc732
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1796964
Reviewed-by: Scott Graham <scottmg@chromium.org>
Commit-Queue: Francois Rousseau <frousseau@google.com>
2019-09-10 22:12:44 +00:00
Joshua Peraza
fc44a3747c linux: Allow configuring unhandled signals
Change-Id: I621555f892a3064c5cba09120309bc900da237f9
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1793563
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
2019-09-10 17:57:21 +00:00
Tao Bai
9a62344612 [Log minidump] OutputStream interface and zlib implementation
This is the 1st patch for logging minidump in Android. it adds
OutputStream interface and zlib implementation for output pipline.

Bug: crashpad:308
Change-Id: I4738b8f223886049e6e259b9b25c00e5120156e5
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1745355
Commit-Queue: Tao Bai <michaelbai@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2019-09-06 22:07:32 +00:00
Joshua Peraza
e1e55e2246 linux: initialize crash_loop_before_time member
Change-Id: I8910d0700056232afb82afc4ef1463212053f7e2
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1782737
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
2019-09-03 19:44:53 +00:00
Joshua Peraza
cd92fba233 linux: Move Cros crash handling to CrosCrashReportExceptionHandler
Change-Id: I80686ddc35b03fa213481e35dc494a40fbdd551a
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1775222
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
2019-08-30 19:49:26 +00:00
Tim Zheng
726ab2a655 Integrate Crashpad with Chrome OS
This CL adds modification to Crashpad to integrate Crashpad reporting
for Chrome on Chrome OS.

Design doc: go/cros-crashpad
BUG=chromium:944123

Change-Id: I22e2f2a93f32c2dc149c9c011fa8134cf6d5b74f
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1707369
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2019-08-19 23:28:00 +00:00
Vlad Tsyrklevich
bde5196af5 Add ProcessMemorySanitized
The ProcessMemorySanitized implementation only allows reads to a given
process if it falls within a given whitelist of memory ranges. This
ensures that 'sanitized' snapshots only allow reading memory that was
explicitly allowed.

Bug: crashpad:263, chromium:973167
Change-Id: I72712d7ea3cabfd49cc91ffbe563cb349e6fcfdb
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1752593
Commit-Queue: Vlad Tsyrklevich <vtsyrklevich@chromium.org>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2019-08-15 00:02:53 +00:00
Scott Graham
1b2f448720 Fuchsia: de-port generate_dump
generate_dump is not being used on Fuchsia (because only the system-reporter
version of Fuchsia Crashpad is actively used).

GetProcessFromKoid() is becoming increasingly difficult to implement, so simply
de-port generate_dump until we actually need it again in the future (if ever).

Removes GetRootJob().

Change-Id: Ib5e5d8e79177506da4b2e0e0382f3fdd2502840b
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1726695
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: Francois Rousseau <frousseau@google.com>
2019-07-31 15:43:46 +00:00
Istvan Romai
63782c8333 Added Windows on ARM support to SystemSnapshot::CPUVendor
Bug: crashpad:297
Change-Id: I1430f86986efdd7bc3c5494ce1838653c64524d6
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1647167
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2019-07-24 14:01:42 +00:00
Adam Kallai
79b59b0a8f Add support for capture CPU context on Windows on ARM64
Most Crashpad builds use Microsoft's armasm64.exe macro assembler
for .asm source files. When building in Chromium, clang-cl is used
as the assembler instead. Since the two assemblers recognize different
assembly dialects, the same .asm file can't be used for each.
As a workaround, use a prebuilt .obj file when the Microsoft-dialect
assembler isn't available.

The obj file is generated from the capture_context_win_arm64.asm
by armasm64 macro assembler. If this asm file is modified,
the obj file needs to be updated.

Change-Id: Id5a4a949997a27b04815aeb79b2540d30a52d34c
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1632749
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2019-07-17 18:08:42 +00:00
David Pursell
137506bf1e [fuchsia] transition off deprecated exception APIs
Removes the remaining references to the old port-based exception APIs in
favor of the new channel-based APIs.

Bug: fuchsia:ZX-4031
Test: runtests on emulator and device
Change-Id: Ieac5b66c2f676966d1018d771cab6c8635f12a8f
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1700321
Reviewed-by: Francois Rousseau <frousseau@google.com>
Commit-Queue: Francois Rousseau <frousseau@google.com>
2019-07-12 19:32:53 +00:00
Vlad Tsyrklevich
1644b7724d Add missing build/build_config.h include
Change-Id: I1fa215d0d7c3925c27cf45702634269f4f6f2322
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1684438
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Vlad Tsyrklevich <vtsyrklevich@chromium.org>
2019-07-01 22:43:26 +00:00
Vlad Tsyrklevich
b19842d25c Fix MSan failures
Bug: 932205
Change-Id: Ic31986d270634e42bf8c2620f37c434a4cb79b33
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1474271
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Vlad Tsyrklevich <vtsyrklevich@chromium.org>
2019-06-28 23:00:24 +00:00
Joshua Peraza
d98690a182 android: enable upload
This patch also updates WorkerThread to execute DoWork() when
DoWorkNow() has been called, which is relevant when DoWorkNow() and
Stop() have both been called. This occurs regularly on Android where
the handler's current normal mode is to dump a single process and exit.
This change ensures the upload thread has a chance to upload the report
before the handler exits.

This change should not affect upload on Chrome/WebView/Chromecast which
don't pass Crashpad a --url option and are still responsible for their
own uploads.

Change-Id: Ie5553eafc13714f0438b4b133a92516f7abec153
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1643710
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2019-06-18 22:07:14 +00:00
Erik Chen
e0e83ad18a Use explicit paths when using hermetic toolchain.
Previously, both the invocation to mig and mig's internal code would use xcrun
to locate binaries. When we're using the hermetic toolchain, we want to
explicitly specify the binaries to use and we want to avoid calls to xcrun.

Bug: chromium:971452
Change-Id: I8527368e0846bc72789e6454fcd626b028d297ff
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1650147
Commit-Queue: Erik Chen <erikchen@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2019-06-07 19:23:49 +00:00
Adam Kallai
949a022939 win: Fix 64-bit detection in ProcessInfo
The ProcessInfo initialization fails on ARM on Windows with
'ReadProcessData failed'.

The 64-bit detection logic only checks whether it's on x64 and ignores
ARM64. On ARM64, the ReadProcessData template should be instantiated
with internal::Traits64 as it is on x64.

Test: Run crashpad_tests on ARM, 'ReadProcessData failed' is gone
Change-Id: I0f47d8601a39aaa1b8ba07d34d1f41b7739233e7
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1615024
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2019-05-16 22:22:37 +00:00
Joshua Peraza
e23286dc37 linux: extend handler protocol with credential messages
This message type allows the browser to determine the handler's process
ID to be used with `prctl(PR_SET_PTRACER, ...)`.

Bug: crashpad:284
Change-Id: I2664f3e8aee269b159de9074e389397346c808f0
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1577704
Reviewed-by: Mark Mentovai <mark@chromium.org>
2019-05-02 20:58:38 +00:00
Joshua Peraza
a11243e8f1 linux: add wrappers for send/recvmsg
sendmsg() and recvmsg() are complicated to use. Refactor their usage
into functions with a simpler, tested interface and use those instead.
This also adds CreateCredentialSocketpair() to create a pair of
connected sockets with SO_PASSCRED set. This option should be set
before the possibility of any calls to sendmsg() with the socket pair
to avoid race conditions in properly setting credentials.

Also update the handler to use Strategy::kNoPtrace (which causes the
crash dump to fail without breaking the socket connection) if the
credentials were invalid, which can happen if SO_PASSCRED was set after
the call to sendmsg() or if the sending process does not exist in this
namespace.

Change-Id: Id09f87125540255687a3c35d5bed7fa01ec07cff
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1584639
Reviewed-by: Mark Mentovai <mark@chromium.org>
2019-05-02 20:56:08 +00:00
Joshua Peraza
59cdfbb031 linux: support multi client sockets in ExceptionHandlerServer
Multi client socket connections allow multiple clients to request crash
dumps from a handler process using a single, shared socket connection.

This connection mode does not support using a broker process which
requires a dedicated socket connection to ensure handler messages
aren't intercepted by the wrong clients.

The handler uses SIGCONT to indicate to the crasher when a crash dump
is complete (or has failed) and may continue.

Bug: crashpad:284
Change-Id: I2031029cd254f17497cbf7e7d8740c289581e8aa
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1559306
Reviewed-by: Mark Mentovai <mark@chromium.org>
2019-05-02 20:54:41 +00:00
Eric Astor
48675b4bd3 Remove pid_t in platform-independent code.
Change-Id: Ia58e07bf85a09cd7e63784220800431ad1366584
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1565273
Commit-Queue: Eric Astor <epastor@google.com>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2019-04-24 16:02:00 +00:00
Joshua Peraza
c96226c6ba linux: move handler protocol types into a class
This patch adds the class ExceptionHandlerProtocol to contain all the
relevant types, but should not make any functional changes.

Change-Id: I65ada239a6bf3195899fdd96f005c042cdd59749
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1575796
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2019-04-23 17:49:16 +00:00
Casey Dahlin
5f77cf41b6 Add CodeViewRecordBuildId
Until now we've been stuffing ELF debug symbol link information into a
CodeViewPDB70. This has reached the limits of its usefulness. We now add
a CodeViewRecord that can contain a proper ELF build ID.

Change-Id: Ice52cb2a958a1b9031943f280d9054da02d2f17d
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1574107
Commit-Queue: Casey Dahlin <sadmac@google.com>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2019-04-22 23:16:22 +00:00
Joshua Peraza
c31a86a340 linux: Identify requesting threads
When a crashing process is in a different PID namespace than the
handler, the crasher doesn't have a way of knowing its own thread ID in
the handler's namespace and the kernel lacks mechanisms to perform this
translation before Linux 4.1 (where the information is present in
/proc/<pid>/status:NSPid).

This patch gives the handler a way of identifying the requesting thread
by sending a stack address along with the crash dump request, which
the handler can search for in each of the process' threads.

This information is useful both for attaching exception information
to the right thread and to allow the handler to send signals to the
correct thread when using a shared socket connection.

Bug: crashpad:284, crashpad:286
Change-Id: I4fa366c8fb17f932b056265cf71a4af160ba342f
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1558828
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2019-04-16 18:29:20 +00:00
Eric Astor
e50676dcf2 Switch all string-number conversion to use fundamental types, and add long to the list.
Change-Id: I9244df09415f9d46262e2b8d04b64d7c4f786436
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1565287
Commit-Queue: Eric Astor <epastor@google.com>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2019-04-12 18:26:02 +00:00
Egor Pasko
ad49fcfad6 directory_reader_posix: more verbosity in PLOG
Bug: chromium:949321
Change-Id: I0c73d730ede912a7be0b22ea3ab384a8fda2e528
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1564512
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Egor Pasko <pasko@chromium.org>
2019-04-11 17:17:37 +00:00
Francois Rousseau
0730f0c60c [fuchsia] rename gn group to fuchsia
now that we import fuchsia-sysinfo and fdio, this isn't really just zx anymore

Change-Id: Ic42359ce3d230e214ebdbbefb880ccb021434a0f
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1555533
Reviewed-by: Scott Graham <scottmg@chromium.org>
Commit-Queue: Francois Rousseau <frousseau@google.com>
2019-04-05 23:33:12 +00:00
Joshua Peraza
7d5d5ff25f Avoid triggering buffer overflow detectors
Writing directly into buf.tmp causes the nul-terminator to overflow
into buf.crlf, which upsets some overflow detectors.

Bug: crashpad:289
Change-Id: I241f1ae239ed8360ac5dfd245cb70e919ae73cd1
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1545014
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
2019-03-29 15:34:02 +00:00
Francois Rousseau
3cc7ceaac5 [fuchsia] do not try to suspend crashed thread
* a thread blocked in an exception is technically not suspended on Fuchsia
* this will take care of the spurious error message "thread failed to suspend: ZX_ERR_TIMED_OUT (-21)" introduced in https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1536268

Bug: fuchsia/ZX-3772
Tested: `fx run-test crashpad_test` on Fuchsia; verified with `fx shell crasher` no error message
Change-Id: I5306732ef7c5a4f2c0fe84bc072506d57a43931e
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1538558
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Francois Rousseau <frousseau@google.com>
2019-03-25 20:45:09 +00:00
Adam Barth
aa160f6581 [fuchsia] Update header include
Previously, we included lib/fdio/util.h, but that header is being
removed. The declarations we need are in lib/fdio/fdio.h now.

Change-Id: I094b328766f1c67571044f85717b788eded1d142
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1508635
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Adam Barth <abarth@chromium.org>
2019-03-07 18:21:15 +00:00
Mark Mentovai
708367f5ba POSIX: ScopedMmap length refinement
9d26012e9c73 relaxed the requirement on ScopedMmap such that the length
of the region supervised no longer needed to be provided as a round
number of pages. This was accomplished by internally rounding up the
provided length to a page length. Unfortunately, this made

ScopedMmap::len() return something other than the passed-in length,
which is undesirable. This change makes ScopedMmap store the passed-in
length internally, making it available unmodified via the accessor, and
rounding it up to page length at internal points of use.

Change-Id: I827925af68e38f33bfa3cee535db0f098884fc6b
Reviewed-on: https://chromium-review.googlesource.com/c/1492774
Commit-Queue: Mark Mentovai <mark@chromium.org>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2019-02-28 01:51:41 +00:00
Mark Mentovai
2271f00fe0 Add missing BUILD.gn for third_party/apple_cf
apple_cf is just a header, but we’ve got a BUILD.gn for
third_party/cpp-httplib, which is also just a header.

Change-Id: Ib42c25657b5964678d14682a0a802ebef0e4cb2f
Reviewed-on: https://chromium-review.googlesource.com/c/1489182
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2019-02-26 16:39:24 +00:00
Mark Mentovai
9d26012e9c POSIX: don’t be overly restrictive about mmap() region length
ScopedMmap was asserting that the length of a mapped region must be an
exact number of pages, but this is not required or useful.

Change-Id: I6141712a1980a217565e31ddcd4c23cf6a32503c
Reviewed-on: https://chromium-review.googlesource.com/c/1480440
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2019-02-25 17:48:47 +00:00
Vlad Tsyrklevich
25ba1d6895 Explicitly check mach_vm_read() size out parameter
Explicitly check that mach_vm_read() successfully read the entire
requested region. This is a speculative fix for an infrequent crash that
occurs in the wild where only part of the region read by ReadMapped()
was actually mapped into memory.

Bug: chromium:918626
Change-Id: I4f4b3902d11480dc4a003608cfb1d371ec89425b
Reviewed-on: https://chromium-review.googlesource.com/c/1455170
Commit-Queue: Vlad Tsyrklevich <vtsyrklevich@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2019-02-20 21:45:51 +00:00
Petr Hosek
4dbd8c75d5 Fix issues revealed by -ftrivial-auto-var-init=pattern
-ftrivial-auto-var-init=pattern automatically initializes all variables
with a pattern. This revealed two issues:

1. Unitialized read of field from CrashpadInfoClientOptions.
2. The PC distance check in TestCaptureContext (due to additional
instrumentation, the distance is now 76 on x86-64 and 92 on aarch64).

Change-Id: I528e5f21c70d2849c9300776da783fde59411e9e
Reviewed-on: https://chromium-review.googlesource.com/c/1471691
Reviewed-by: Mark Mentovai <mark@chromium.org>
Reviewed-by: Nico Weber <thakis@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2019-02-14 16:41:57 +00:00
Mark Mentovai
bba9d0819c Revert "Use GTEST_SKIP() instead of custom DISABLED_TEST()"
This reverts commit 79f4a3970a6425ef0475263974bf9a012279ba4f.

Chromium’s test launcher is not prepared to handle GTEST_SKIP().

Bug: chromium:912138
Change-Id: Iaeffaedcd92093ec61b013f2a919dc4670094581
Reviewed-on: https://chromium-review.googlesource.com/c/1464099
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2019-02-11 17:12:40 +00:00
Mark Mentovai
ff5a25e11f Remove a few unnecessary semicolons.
Patch by Nico Weber <thakis@chromium.org>, originally
https://crrev.com/c/1463405.

Bug: chromium:926235
Change-Id: I7e0ba822aa8dd104768d7ad6e603539576ae96a9
Reviewed-on: https://chromium-review.googlesource.com/c/1463744
Commit-Queue: Mark Mentovai <mark@chromium.org>
Reviewed-by: Nico Weber <thakis@chromium.org>
2019-02-11 16:21:20 +00:00
Mark Mentovai
79f4a3970a Use GTEST_SKIP() instead of custom DISABLED_TEST()
Since gtest 00938b2b228f3, gtest has built-in first-class support for
skipping tests, which is functionally identical (at least in Crashpad’s
usage) to the home-grown support for run-time dynamically disabled tests
introduced in Crashpad 5e9ed4cb9f69.

Use the new standard pattern, and remove all vestiges of the custom
local one.

Change-Id: Ia332136c356d523885fc5d86bc8f06fefbe6a792
Reviewed-on: https://chromium-review.googlesource.com/c/1427242
Commit-Queue: Mark Mentovai <mark@chromium.org>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2019-01-22 21:00:06 +00:00
Mark Mentovai
6a209070e4 Change deprecated gtest TEST_CASE macros to TEST_SUITE
No functional change. See
https://github.com/google/googletest/blob/master/googletest/docs/primer.md#beware-of-the-nomenclature
(as of 5d3a2cd9c854).

Change-Id: I0f6dc59f014b01d18a09a92f016351a7402d8e6c
Reviewed-on: https://chromium-review.googlesource.com/c/1427499
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2019-01-22 20:58:58 +00:00
Victor Costan
0dde0ef81c Add missing using statement in notify_server_test.cc.
The test currently compile because of ADL (argument-dependent lookup). It
does not compile with a more recent googletest version. See associated
bug for linked to failed builds and compiler error messages.

Bug: crashpad:274
Change-Id: I7f2dd736453deb2a1af7bcacefc421961e1eb95e
Reviewed-on: https://chromium-review.googlesource.com/c/1422786
Commit-Queue: Victor Costan <pwnall@chromium.org>
Reviewed-by: Scott Graham <scottmg@chromium.org>
2019-01-19 05:20:21 +00:00
Vlad Tsyrklevich
fe05eb7c99 Update ASan disabled tests to exclude all platforms
Use-after-return detection happens to currently be enabled on Linux and
Android but is not exclusive to those platforms. Disable tests
incompatible with ASan UAR detection on all platforms.

Bug: 915245
Change-Id: I40447c126dac9dc7d0f72e400136afb8c292324d
Reviewed-on: https://chromium-review.googlesource.com/c/1414614
Commit-Queue: Vlad Tsyrklevich <vtsyrklevich@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2019-01-16 18:56:06 +00:00
Scott Graham
922b5750c1 fuchsia: Update for zx_task_suspend() supporting processes
zx_task_suspend() now supports suspending processes. This is somewhat
more reliable than suspending the constituent threads because after the
call returns and the token is being held, any subsequently started
threads will start in the the suspended state.

However, because the suspend is asynchronous the threads of the process
still need to be iterated to wait for them to assert ZX_THREAD_SUSPENDED
(and that can and does still fail to happen for a number of reasons). So
while improved, this class is still only best-effort.

Additionally, as the version of ScopedTaskSuspend that took a thread
wasn't being used, remove that.

Bug: crashpad:269
Change-Id: Ifb3f8e0d780a5e22af33613f92a61d25459f5139
Reviewed-on: https://chromium-review.googlesource.com/c/1377201
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Scott Graham <scottmg@chromium.org>
2019-01-14 22:32:15 +00:00
Mark Mentovai
eb3f371879 mac: Update comment describing using Mach receive rights with kqueue()
The prohibition on using Mach receive rights with kqueue() was lifted in
10.12. Add the source code reference that should have been here all
along, and explain how xnu has changed. When the minimum runtime target
is 10.12 or later, the port set in this code will be unnecessary, and it
will be possible to remove it.

Change-Id: I8fdf91a124efb081e4748ccf60680b12a38c4d18
Reviewed-on: https://chromium-review.googlesource.com/c/1406894
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2019-01-11 19:08:46 +00:00
Vlad Tsyrklevich
732768cc9d Upstream change from chromium
This was part of a change to delete base::ThreadLocalStorage::StaticSlot.

Bug: crashpad:271
Change-Id: I0df76318aef05cbaecab660253cb388e3929f693
Reviewed-on: https://chromium-review.googlesource.com/c/1405788
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Vlad Tsyrklevich <vtsyrklevich@chromium.org>
2019-01-10 23:15:29 +00:00
Joshua Peraza
ec676b3f67 linux: Use bit_cast to convert types
Change-Id: Ie7a5be80169850bbfa188b1f141f97d79683f9a5
Reviewed-on: https://chromium-review.googlesource.com/c/1401103
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
2019-01-08 17:20:23 +00:00
Joshua Peraza
fb667c9892 linux: Handle negative offsets in MemoryMap
offsets in the MemoryMap are expressed as two's complement while
Crashpad's and mini_chromium's string conversion functions expect
negative numbers to be expressed with a '-' character.

Convert the string as unsigned and then re-interpret to signed when
necessary.

Bug: 914246
Change-Id: I76aaf092ea7ad98806be7a3f380dab4ca0425ed6
Reviewed-on: https://chromium-review.googlesource.com/c/1399372
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
2019-01-08 05:49:46 +00:00
Reid Kleckner
b3eeffaa18 Use << instead of , to log "NtQueryInformationProcess"
Fixes a -Wunused-value warning found by the latest version of clang.

R=mark@chromium.org

Bug: 917419
Change-Id: I6178c1534adc7e25e5b75f6a6ab90497a86de23f
Reviewed-on: https://chromium-review.googlesource.com/c/1395945
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Reid Kleckner <rnk@chromium.org>
2019-01-04 23:19:17 +00:00
Mark Mentovai
cc166d71f4 Use base::size where appropriate, and ArraySize elsewhere
This is a follow-up to c8a016b99d97, following the post-landing
discussion at
https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1393921/5#message-2058541d8c4505d20a990ab7734cd758e437a5f7

base::size, and std::size that will eventually replace it when C++17 is
assured, does not allow the size of non-static data members to be taken
in constant expression context. The remaining uses of ArraySize are in:

minidump/minidump_exception_writer.cc (×1)
minidump/minidump_system_info_writer.cc (×2, also uses base::size)
snapshot/cpu_context.cc (×4, also uses base::size)
util/misc/arraysize_test.cc (×10, of course)

The first of these occurs when initializing a constexpr variable. All
others are in expressions used with static_assert.

Includes:
Update mini_chromium to 737433ebade4d446643c6c07daae02a67e8deccao

f701716d9546 Add Windows ARM64 build target to mini_chromium
87a95a3d6ac2 Remove the arraysize macro
1f7255ead1f7 Placate MSVC in areas of base::size usage
737433ebade4 Add cast

Bug: chromium:837308
Change-Id: I6a5162654461b1bdd9b7b6864d0d71a734bcde19
Reviewed-on: https://chromium-review.googlesource.com/c/1396108
Commit-Queue: Mark Mentovai <mark@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2019-01-04 22:42:57 +00:00
Eric Astor
3678bff13f Separates generating & fixing Mach interfaces with MIG.
Adds new scripts: mig_gen.py for using MIG to generate a Mach interface, mig_fix.py for fixing the resulting interface. mig.py now wraps both into the same user interface.

mig_fix.py also has the option to write its fixed output to new files, rather than overwriting the existing output. This should increase compatibility with certain build configurations.

Change-Id: I743ea1bab3f63c5b92f361948b544d498ed01cbc
Reviewed-on: https://chromium-review.googlesource.com/c/1389095
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2019-01-03 20:42:16 +00:00
Avi Drissman
c8a016b99d Remove base's arraysize from Crashpad.
BUG=837308
R=mark@chromium.org

Change-Id: Ibecbfc7bc2d61ee54bc1114e4b20978adbc77db2
Reviewed-on: https://chromium-review.googlesource.com/c/1393921
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Avi Drissman <avi@chromium.org>
2019-01-03 19:44:15 +00:00
Vlad Tsyrklevich
8f5d83b9e3 Change ProcessMemoryRange to use VMSize
Follow up to https://crrev.com/c/1387756 replace size_t with VMSize.

Bug: crashpad:270
Change-Id: I22ac9e3503ef3e9707b2ad0758ae133c5a746f27
Reviewed-on: https://chromium-review.googlesource.com/c/1389235
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Vlad Tsyrklevich <vtsyrklevich@chromium.org>
2019-01-03 19:00:23 +00:00
David Bienvenu
bcce074143 Make crashpad support either PSAPI_VERSION 1 or 2
Bug: 584969
Change-Id: I03913e8987a576154b29cac18e95c14d121c9762
Reviewed-on: https://chromium-review.googlesource.com/c/1393605
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2019-01-03 03:34:22 +00:00
Vlad Tsyrklevich
60ff012872 Change ProcessMemory to accept VMSizes
As Mark noted in [1] ProcessMemory should accept VMSize instead of
size_t, the two types can differ on platforms where a cross-bitness
handler could cause a 32-bit handler to inspect a 64-bit process. By
centralizing the checks in ProcessMemory, we can leave the individual
platform-specific implementations (in ProcessMemory*::ReadUpTo) to
accept size_ts.

[1] crrev.com/c/1388017/2/snapshot/crashpad_types/crashpad_info_reader.cc#70

Bug: crashpad:270
Change-Id: I3aab483221de36f3b1478cb9503101b142dae681
Reviewed-on: https://chromium-review.googlesource.com/c/1387756
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Vlad Tsyrklevich <vtsyrklevich@chromium.org>
2018-12-21 21:41:54 +00:00
Vlad Tsyrklevich
abfad376ab Add missing build/build_config.h includes
Didn't notice these until I hit presubmit in chromium.

Bug: crashpad:263
Change-Id: I7d86c508928c95a65b7972a19fbdf3bd19c9b29b
Reviewed-on: https://chromium-review.googlesource.com/c/1387885
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Vlad Tsyrklevich <vtsyrklevich@chromium.org>
2018-12-20 23:03:08 +00:00
Vlad Tsyrklevich
3b9e3aad1b Move and rename TaskMemory to ProcessMemoryMac
Bug: crashpad:263
Change-Id: I5efa4fe26f09c8b8a8db6dbcedc416724404b894
Reviewed-on: https://chromium-review.googlesource.com/c/1387884
Commit-Queue: Vlad Tsyrklevich <vtsyrklevich@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-12-20 21:35:37 +00:00
Vlad Tsyrklevich
3f7d4d7d09 Break out redundant tests into a routine
Bug: crashpad:263
Change-Id: Ib6f05f5e7b91a434e54e0a8d6cd55078b2bf84f5
Reviewed-on: https://chromium-review.googlesource.com/c/1387269
Commit-Queue: Vlad Tsyrklevich <vtsyrklevich@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-12-20 20:49:18 +00:00
Vlad Tsyrklevich
4e3be595f3 Delete redundant TaskMemory tests
Delete TaskMemory tests made redundant by equivalent
ProcessMemoryTests. Some TaskMemory tests are still not redundant
because they test TaskMemory::ReadMapped() or they exercise platform-
specific behavior like TaskMemory::Read() not being able to read a
VM_PROT_NONE page.

Bug: crashpad:263
Change-Id: I72a56b4f3564444b02943f11a0069749bf1b074b
Reviewed-on: https://chromium-review.googlesource.com/c/1387270
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Vlad Tsyrklevich <vtsyrklevich@chromium.org>
2018-12-20 20:30:06 +00:00
Vlad Tsyrklevich
8b2ec2aae4 Make TaskMemory a child class of ProcessMemory
Currently TaskMemory re-implements a number of Read* routines that are
implemented in a platform-independent way in ProcessMemory with access
to a single platform-specific ReadUpTo method. Implement the ReadUpTo
method for TaskMemory and subclass it from ProcessMemory to inherit the
remaining methods.

The ProcessMemoryTests didn't work on macOS because MultiprocessExec
can not access the child process' task port without root privileges or
the task_for_pid entitlement. Create an adaptor class for those tests to
use MachMultiprocess so that the child process sends its task port to
the parent.

Bug: crashpad:263
Change-Id: Id8e1788a74fe957f05703a5eb569ca3bf9870369
Reviewed-on: https://chromium-review.googlesource.com/c/1387265
Commit-Queue: Vlad Tsyrklevich <vtsyrklevich@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-12-20 19:44:31 +00:00
Vlad Tsyrklevich
7018a80b36 Simplify test set-up
Use platform independent helpers to simplify initializing a
ProcessMemory object in this test.

Bug: crashpad:263
Change-Id: Id0f9e006f6dbaca31453803b8c790a6832e855e5
Reviewed-on: https://chromium-review.googlesource.com/c/1387264
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Vlad Tsyrklevich <vtsyrklevich@chromium.org>
2018-12-20 17:45:01 +00:00
Vlad Tsyrklevich
bf6d2e0283 Refactor TaskMemory initialization
Currently, TaskMemory implements the ProcessMemory interface almost
exactly; however, it's initialized using a constructor instead of an
Initialize method which makes it incompatible with a number of
ProcessMemory tests. Change its initialization to match the other
ProcessMemory classes.

Bug: crashpad:263
Change-Id: I8022dc3e1827a5bb398aace0058ce9494b6b6eb6
Reviewed-on: https://chromium-review.googlesource.com/c/1384447
Commit-Queue: Vlad Tsyrklevich <vtsyrklevich@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-12-19 23:28:10 +00:00
Nathan Rogers
ffd666e16c fuchsia: Update Paths::Executable documentation
Update the "...namespaces.md..." link to its current URL.

Change-Id: Ic30c6be5dba4f531e5b8a55af37555626398df5a
Reviewed-on: https://chromium-review.googlesource.com/c/1381777
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2018-12-19 23:02:29 +00:00
Vlad Tsyrklevich
f2a07982ff Change edge case handling in ReadCStringInternal
Currently, TaskMemory::ReadCStringInternal() treats the
ReadCStringSizeLimited(size=0) case by returning an empty string;
however, that is inconsistent with the documentation for that function
and the equivalent implementation in ProcessMemory. The comment for the
size parameter is: "The maximum number of bytes to read. The string is
required to be `NUL`-terminated within this many bytes." My
interpretation is that the ProcessMemory behavior is correct in failing
on size=0 as a NUL can never be read.

ReadCStringSizeLimited() is only used with a possibly null size in
MachOImageReader::ReadDylinkerCommand(). In that case we read the
dylinker_command string, which appears to also be verified to be a
non-zero length null terminated string in load_dylinker() in
bsd/kern/mach_loader.c so we shouldn't hit this case in the wild.

Bug: crashpad:263
Change-Id: I2bd9c0ce3055154a98afdd19af95bb48d05f05a3
Reviewed-on: https://chromium-review.googlesource.com/c/1384448
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Vlad Tsyrklevich <vtsyrklevich@chromium.org>
2018-12-19 21:42:23 +00:00
Joshua Peraza
83867d5234 linux: Add ScopedPrSetDumpable
Bug: 914246
Change-Id: I529467e92a5cbc2a372f4c12234cfd3af8ddfe0a
Reviewed-on: https://chromium-review.googlesource.com/c/1382598
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-12-18 17:45:43 +00:00
Joshua Peraza
2afe6dc210 android/linux: Support modules with shared relros on Android
Add MemoryMap::Iterator to support different strategies for locating
the start of module mappings on Android and Linux.

Beginning with API 21, Bionic provides android_dlopen_ext() which
allows passing a file descriptor with an existing relro segment to the
loader. This means that the mapping containing the dynamic segment
could have a name, device, and inode which are different than the
other mappings for the module.

The revised strategy for Android at API 21+ is to search all mappings
in reverse order from they dynamic array mapping until a module is
parsed with the expected dynamic array address.

Linux and Android 20- continue to select mappings using the device,
inode, and file offsets of the mappings.

Bug: crashpad:268
Change-Id: I30e95e51cb6874c00875d2a9c57f1249877736d4
Reviewed-on: https://chromium-review.googlesource.com/c/1374375
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-12-17 22:58:16 +00:00
Tom Tan
761c6fe8be Add Windows ARM64 support to Chromium crashpad
Bug: chromium:893460
Change-Id: Ifbeb6f937a6b96c77b02dcf8afe492c5bc617435
Reviewed-on: https://chromium-review.googlesource.com/c/1347773
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2018-12-12 21:54:55 +00:00
Francois Rousseau
9b6dde9101 [fuchsia] remove Fuchsia-specific code in MoveFileOrDirectory
ZX-1729 has been fixed upstream

Change-Id: Ia9c55b13169db650eb4ca0562434ae19a6f44eaf
Reviewed-on: https://chromium-review.googlesource.com/c/1366638
Reviewed-by: Scott Graham <scottmg@chromium.org>
Commit-Queue: Francois Rousseau <frousseau@google.com>
2018-12-06 23:34:54 +00:00
Scott Graham
ad788280e4 fuchsia: Disable HTTPS tests to avoid (unavailable) dependency on BoringSSL
Bug: crashpad:266
Bug: fuchsia:DX-690
Change-Id: Ica6c2d6d345cbda17fd67de69e7c770389808f63
Reviewed-on: https://chromium-review.googlesource.com/c/1340743
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-11-16 21:19:24 +00:00
Joshua Peraza
651af7583b win: use zx format specifier instead of a cast
Change-Id: I14fac035ecafaa5d2459b63a070f701389160ad4
Reviewed-on: https://chromium-review.googlesource.com/c/1323772
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
2018-11-07 19:33:00 +00:00
Joshua Peraza
e287a3ab12 win: fix mismatched format macros
When building in Chromium:
../../third_party/crashpad/crashpad/util/process/process_memory_win.cc(95,74):  error: format specifies type 'unsigned long long' but the argument has type 'size_t' (aka 'unsigned int') [-Werror,-Wformat]
"range at 0x%llx, size 0x%llx completely inaccessible", address, size);
~~~~                                    ^~~~
%zx
../../third_party/crashpad/crashpad/util/process/process_memory_win.cc(103,72):  error: format specifies type 'unsigned long long' but the argument has type 'size_t' (aka 'unsigned int') [-Werror,-Wformat]
"start of range at 0x%llx, size 0x%llx inaccessible", address, size);

Change-Id: I820f0afee28d1220ca400780eac61de05bde10ef
Reviewed-on: https://chromium-review.googlesource.com/c/1323771
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
2018-11-07 18:51:52 +00:00
Joshua Peraza
bf10ed0a69 posix: use threadsafe gtest death test for ScopedGuardedPage
Also update gyp to build it.

Change-Id: I859c552b9cfc41f531ffb04fe6d6730dbd0e8fed
Reviewed-on: https://chromium-review.googlesource.com/c/1319269
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-11-06 21:12:54 +00:00
Vlad Tsyrklevich
a9be1b1403 Add ProcessMemoryWin and re-factor tests
Currently, ProcessMemory is only implemented for Linux and Fuchsia.
Implement the interface for Windows as well and re-factor tests to
support it, mostly this consists of using a new ScopedGuardedPage class
instead of ScopedMmap in the ProcessMemory tests.

BUG=crashpad:262

Change-Id: I1b42718972be5ad838d12356d09f764053f09e4f
Reviewed-on: https://chromium-review.googlesource.com/c/1278829
Commit-Queue: Vlad Tsyrklevich <vtsyrklevich@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-11-05 21:33:35 +00:00
Francois Rousseau
a4754a9ae9 [snapshot][arm64] rename CPU context pstate to spsr
* upon exception, the process state ("pstate") is stored in the saved
process status register ("spsr") so the register we are manipulating is
really just the SPSR
* https://developer.arm.com/products/architecture/cpu-architecture/a-profile/docs/100878/latest/the-saved-process-status-register

Change-Id: I9ce612c00b7a56a0f6d778d974ff9e0e5402ca5e
Reviewed-on: https://chromium-review.googlesource.com/c/1312193
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Francois Rousseau <frousseau@google.com>
2018-11-01 18:01:40 +00:00
Joshua Peraza
e00c42e63f linux: use offset of d_name to get size of dirents
Dirents with short names can have a d_name that fits inside padding at
the end of Dirent64.

Change-Id: I18057dad01f5a7d4a063028ca9f61fbe89ae7fc0
Reviewed-on: https://chromium-review.googlesource.com/c/1310413
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
2018-10-31 20:37:03 +00:00
Braden Kell
5dd094381c [sysinfo] Convert sysinfo ioctls to FIDL calls
Bug: fuchsia:ZX-2842

Change-Id: Ib84b4319d3bb07a2c68bc2ff0d63e49fa65eb2b5
Reviewed-on: https://chromium-review.googlesource.com/c/1292237
Reviewed-by: Scott Graham <scottmg@chromium.org>
Commit-Queue: Scott Graham <scottmg@chromium.org>
2018-10-29 20:24:55 +00:00
Scott Graham
237c5ebdf3 fuchsia: Fix include_dirs for host Mac build
Change-Id: I157fe2ab95d0b152ef5cc09cd0b6e56649c9f727
Reviewed-on: https://chromium-review.googlesource.com/c/1277777
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Scott Graham <scottmg@chromium.org>
2018-10-11 23:18:47 +00:00
Scott Graham
1c09361c2c fuchsia: Let util build in Mac-host builds
Some of the minidump functionality is going to be used in Fuchsia in
host side tools (in zxdb, the debugger). This fixes the Mac-host build
of util.

Change-Id: Ifeb3bd9c7fa29c99a272c97c2813b9c201ddfe88
Reviewed-on: https://chromium-review.googlesource.com/c/1277774
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Scott Graham <scottmg@chromium.org>
2018-10-11 22:04:40 +00:00
Scott Graham
1b4fdd0fd0 fuchsia: Re-enable HTTPS transport, but disable tests
The HTTPS tests are flaky on Fuchsia bots, so TLS transport was disabled.
However, a different CHECK fails in prod when a crash is attempted to be
uploaded via an 'https' url. So for now, re-enable the https transport,
but disable the https tests that were flaky, so they can be debugged
separately.

Additionally, there was a small error in
21edfd3c3a
that wasn't caught because these tests were disabled; fix the path to
test server certs on Fuchsia.

Bug: fuchsia:DX-382

Change-Id: I4ad0649ecb6d0644b1dfcf08bbb097d3a0cd40d0
Reviewed-on: https://chromium-review.googlesource.com/c/1265197
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Francois Rousseau <frousseau@google.com>
2018-10-05 18:16:11 +00:00
Francois Rousseau
ce122b644c [util/net] add error message to scheme check
* instead of just 'Check failed: scheme == "http"', we will have something
like 'Check failed: scheme == "http". Got 'https' for scheme in 'https://for.bar''
* clangfmt on file

Bug: fuchsia:DX-514
Change-Id: I043af7281d7f99ed5641c87920d806e340a38dea
Tested=`out/Debug/crashpad_util_test` and Fuchsia logs
Reviewed-on: https://chromium-review.googlesource.com/c/1262140
Commit-Queue: Francois Rousseau <frousseau@google.com>
Reviewed-by: Scott Graham <scottmg@chromium.org>
2018-10-04 20:51:53 +00:00
Hans Wennborg
7786acf0d7 win: move string_number_conversion_test asan/dll disabling into the win clause
This fixes the upstreaming of https://chromium-review.googlesource.com/c/chromium/src/+/1113664

Bug: chromium:856174
Change-Id: I88cf6aeecef60e4eaf5c14dc9a66f0409255ccac
Reviewed-on: https://chromium-review.googlesource.com/1245481
Commit-Queue: Hans Wennborg <hans@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-09-26 17:01:52 +00:00
Joshua Peraza
688dcfa22e android: handle modules loaded from zipfiles
Modules mapped from zipfiles will have mappings named for the zipfile
rather than the module name and an offset into that zipfile instead of
0.

Bug: crashpad:253, crashpad:254
Change-Id: I0503d13e7b80ba7bd1cc2d241633d9c68c98f1cd
Reviewed-on: https://chromium-review.googlesource.com/1232294
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-09-20 17:42:56 +00:00
Joshua Peraza
9ae453628f android: handle RELRO sharing by the Chromium linker
Bug: crashpad:253
Change-Id: I7d6b1bfebe621d90a4b69dd44073abf471fa822c
Reviewed-on: https://chromium-review.googlesource.com/1232293
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-09-20 16:30:44 +00:00
Joshua Peraza
b918119ca2 linux: Read thread IDs via a PtraceConnection
Bug: crashpad:250
Change-Id: I2ff9c2d810f7af25f7438e974e0adfb5abebec16
Reviewed-on: https://chromium-review.googlesource.com/1200962
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-09-12 00:39:03 +00:00
Joshua Peraza
9dcf4ab23e arm/linux: Fix build after a5214472
The build broke because x30 was used instead of r14 in place of LR
which gcc doesn't recognize when building for 64-bit ARM. gcc does
recognize LR for 32-bit ARM, however, so revert to that since it's
more readable.

Also, de-duplicate saving of FP/IP which are synonyms of r11/r12,
saved above.

Change-Id: I8ae28f430cc3c47f4e4cf3679383ed5b94fadd2e
Reviewed-on: https://chromium-review.googlesource.com/1217483
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
2018-09-10 21:20:32 +00:00
Joshua Peraza
78bf924fa6 linux: Read /proc/<pid> files via PtraceConnection
Bug: crashpad:250
Change-Id: I93c8944c48a17bd2c2b34cd9b8d81750cf80229c
Reviewed-on: https://chromium-review.googlesource.com/1200311
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-09-10 16:20:12 +00:00
Maksim Sisov
a521447214 Use x30 register instead of LR, which GCC doesn't seem to understand
When tested with GCC 6, it couldn't to understand LR register.
Thus, use x30 instead.

The error this patch fixes is the following:

Error: operand 1 must be an integer register -- `str LR,[x0,#0x1b8]'

Test: compile for aarch64
Change-Id: Icf1199254c6a29f72b6d2fa7940e1f33259a728b
Reviewed-on: https://chromium-review.googlesource.com/1213125
Commit-Queue: Maksim Sisov <msisov@igalia.com>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2018-09-10 11:29:11 +00:00
Joshua Peraza
30b8c0dc2a win: disable string_number_conversion_test for asan/dll
Upstreams:
https://chromium-review.googlesource.com/c/chromium/src/+/1113664

Change-Id: I8c3000eebf2be54e8d693bf08a6e92b68c1d5d72
Reviewed-on: https://chromium-review.googlesource.com/1195567
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
2018-08-29 16:44:43 +00:00
Joshua Peraza
0204fbd38b posix: Make DoubleForkAndExec accept an envp parameter
This will be useful to allow setting variables such as CLASSPATH or
LD_LIBRARY_PATH without modifying or depending upon the application's
current environment.

Bug: crashpad:30
Change-Id: I34f31bcc397e51d789b48eb654d80f992a719074
Reviewed-on: https://chromium-review.googlesource.com/1194399
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-08-29 14:41:08 +00:00
Will Harris
2c6c0935e2 Fix an implicit 64-bit to 32-bit conversion.
../../third_party/crashpad/crashpad/util/misc/metrics.cc(66,35):  error: implicit conversion loses integer precision: 'crashpad::FileOffset' (aka 'long long') to 'base::HistogramBase::Sample' (aka 'int') [-Werror,-Wshorten-64-to-32]
      "Crashpad.CrashReportSize", size, 0, 20 * 1024 * 1024, 50);
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Also, remove some unneeded static_casts.

BUG=588506

Change-Id: I0c12079db173e44c07e2f1d02322747cb2d69535
Reviewed-on: https://chromium-review.googlesource.com/1184227
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2018-08-24 17:03:01 +00:00
Mark Mentovai
f8b0538406 fuchsia: Don’t require test certificate setup for disabled TLS tests
This is a follow-up to e6f26587e435.

Bug: DX-382
Change-Id: I3116ea5dd2eca33961465d62c9200aa8dd1baf5d
Reviewed-on: https://chromium-review.googlesource.com/1173339
Commit-Queue: Mark Mentovai <mark@chromium.org>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2018-08-13 23:35:08 +00:00
Mark Mentovai
e6f26587e4 fuchsia, net: Disable TLS, not currently working for in-Fuchsia tests
Bug: DX-382
Change-Id: I06a0a71c32d8d28d30b1add8a2bd57f1d6462463
Reviewed-on: https://chromium-review.googlesource.com/1171984
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2018-08-13 20:00:55 +00:00
Jeremy Apthorp
f540abb506 Treat response codes in [200..203] as successful
Some crash recorders respond with non-200 2xx responses on success, e.g.
HockeyApp which responds with 202 Accepted.

Change-Id: I40de12155b44f7638a1c726090657938e3b1b557
Reviewed-on: https://chromium-review.googlesource.com/1167793
Commit-Queue: Jeremy Apthorp <jeremya@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-08-09 23:53:29 +00:00
Mark Mentovai
2906581f10 win: Fix GYP build of http_transport_test_server
The C++ http_transport_test_server was added in 439ba730c5ae and the
missing GYP build description was corrected in 0e144fb9aeff, but this
wasn’t complete for Windows. ws2_32.lib was missing.

Bug: crashpad:227
Change-Id: I2a0810468f857a02ad1a997c569eee6d9c05c7da
Reviewed-on: https://chromium-review.googlesource.com/1167210
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2018-08-08 15:22:01 +00:00
Wez
bc50af15a2 Migrate from ScopedZxHandle to libzx containers.
Bug: chromium:852541
Change-Id: Ie05c70f249e6f843183a02ec61fd09f6a0607598
Reviewed-on: https://chromium-review.googlesource.com/1148923
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Wez <wez@chromium.org>
2018-08-01 17:38:19 +00:00
Joshua Peraza
063ff78a25 Use __aarch64__ instead of __arm64__
__aarch64__ should always be defined for 64-bit ARM, while __arm64__
only sometimes is.

Change-Id: I46a6469d8f5e74ad79b6ded51a809fbf88e5170a
Reviewed-on: https://chromium-review.googlesource.com/1151541
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
2018-07-26 16:37:25 +00:00
Joshua Peraza
52ff1accbb linux: Fix locating modules with multiple mappings from offset 0
The general strategy used by Crashpad to determine loaded modules is to
read the link_map to get the addresses of the dynamic arrays for all
loaded modules. Those addresses can then be used to query the MemoryMap
to locate the module's mappings, and in particular the base mapping
from which Crashpad can parse the entire loaded ELF file.

ELF modules are typically loaded in several mappings with varying
permissions for different segments. The previous strategy used to find
the base mapping for a module was to search backwards from the mapping
for the dynamic array until a mapping from file offset 0 was found for
the same file. This fails when the file is mapped multiple times from
file offset 0, which can happen if the first page of the file contains
a GNU_RELRO segment.

This new strategy queries the MemoryMap for ALL mappings associated
with the dynamic array's mapping, mapped from offset 0. The consumer
(process_reader_linux.cc) can then determine which mapping is the
correct base by attempting to parse a module at that address and
corroborating the PT_DYNAMIC or program header table address from the
parsed module with the values Crashpad gets from the link_map or
auxiliary vector.

Bug: crashpad:30
Change-Id: Ibfcbba512e8fccc8c65afef734ea5640b71e9f70
Reviewed-on: https://chromium-review.googlesource.com/1139396
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-07-26 15:33:15 +00:00
Joshua Peraza
2f3a8b8f72 Add CrashSkippedReason::kPrepareForUploadFailed
Bug: crashpad:30
Change-Id: I763c30e261c315b45860c8672d9cffbba4714f32
Reviewed-on: https://chromium-review.googlesource.com/1148895
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
2018-07-24 20:37:18 +00:00
Joshua Peraza
0909bee2e2 linux: Fix broken tests with address sanitizer
These fixes are mostly related to address sanitizer causing stack
variables to not be stored on the call-stack. Attempting to disable
safe-stack has no effect.

Change-Id: Ib5718bfb74ce91dee560b397ccdbf68d78e4ec6a
Reviewed-on: https://chromium-review.googlesource.com/1140507
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-07-24 19:52:58 +00:00
Joshua Peraza
1e504474a0 linux: Get exe name from main arguments
When building in chromium, the test is linked into the crashpad_tests
target instead of crashpad_util_test.

Change-Id: I4e0f6b9956f191ebac10f0aaa3812e30885a4e0a
Reviewed-on: https://chromium-review.googlesource.com/1131688
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2018-07-10 16:37:14 +00:00
Djordje Golubovic
cb41ba7471 Added MIPS support to crashpad.
Modified gyp/gn files to support MIPS targets.

Implemented thread_info, cpu_context, signal context classes for MIPS target.

Addressed MIPS specific signal ordering.

Added "MIPS Technologies, Inc." to AUTHORS file.

Bug: crashpad:232
Change-Id: Ibfc221ba54088e95f984b9dc6be5fd52f86abcc2
Reviewed-on: https://chromium-review.googlesource.com/1064594
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2018-07-10 15:29:34 +00:00
Brett Wilson
639cba075c Use new Fuchsia kernel API to suspend threads.
We are transitioning to a token-based API and will be removing the
old one.

Changes to use a thread state wait rather than reading the registers in
a loop to determine when the thread is actually suspended.

Change-Id: I4b015bb0fc74b15177304a62be6c1d9a59b45c80
Reviewed-on: https://chromium-review.googlesource.com/1100170
Commit-Queue: Brett Wilson <brettw@chromium.org>
Reviewed-by: Scott Graham <scottmg@chromium.org>
2018-06-14 18:00:59 +00:00
Scott Graham
0a665e3c81 Suppress output when generating test server key
openssl outputs some useless junk when generating the test key; swallow
that.

'''
Generating a 2048 bit RSA private key
...............................................+++
...........................................+++
writing new private key to 'crashpad_util_test_key.pem'
-----
'''

Bug: crashpad:196
Change-Id: I0bdfb4f29931ef58d0c51c5e5488d3b5aeb798f0
Reviewed-on: https://chromium-review.googlesource.com/1099960
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Scott Graham <scottmg@chromium.org>
2018-06-13 21:41:49 +00:00
Joshua Peraza
d1e6a2130d android/linux: add a client interface to control sanitization
Sanitization is controlled by a SanitizationInformation struct to be
read from the client's memory. The address of this struct is either
passed in a ClientInformation when the client requests a crash dump,
or as a flag to the handler --sanitization_information.

Bug: crashpad:30
Change-Id: I2744f8fb85b4fea7362b2b88faa4bef1da74e36b
Reviewed-on: https://chromium-review.googlesource.com/1083143
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Scott Graham <scottmg@chromium.org>
2018-06-12 15:37:11 +00:00
Joshua Peraza
a42b5269b4 Add ProcessSnapshotSanitized
A ProcessSnapshotSanitized enables filtering possibly sensitive
information from a snapshot.

WebView has different privacy constraints than Chrome and needs to
avoid collecting data in annotations or from stack memory that may
contain PII. This CL enables:

1. Filtering annotations by name using a whitelist.
2. Filtering for crashes which reference a particular module.
3. Redacting non-essential information from stack memory.

This CL does not provide a client interface to enable sanitization.

Bug: crashpad:30
Change-Id: I8944c70fdcca6d6d4b7955d983320909bf871254
Reviewed-on: https://chromium-review.googlesource.com/1070472
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Scott Graham <scottmg@chromium.org>
2018-06-11 16:46:29 +00:00
Scott Graham
3edb7869da Roll cpp-httplib to HEAD (5b3187e2f)
Bug: crashpad:196, crashpad:227
Change-Id: If798744a71aec63e5320cc3300b70d24fed5ceae
Reviewed-on: https://chromium-review.googlesource.com/1082025
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Scott Graham <scottmg@chromium.org>
2018-06-04 18:33:07 +00:00
Scott Graham
dc22f05f61 fuchsia: Fix build vs. TLS support when in-tree
Depend on the BoringSSL target instead of the libs when building in the
Fuchsia tree.

Bug: crashpad:196
Change-Id: Ib1faa9335eedff1fd9dd072234df2d48612ab423
Reviewed-on: https://chromium-review.googlesource.com/1079434
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Scott Graham <scottmg@chromium.org>
2018-05-30 22:37:46 +00:00
Raphael Kubo da Costa
26ef5c910f aarch64: Use xzr instead of x31 in the ASM code
Officially, register X31 does not exist. The code is zeroing out a location
and thus actually needs XZR.

LLVM seems to automatically translate X31 into XZR when compiling the code,
but GCC (tested 7.3.0) refuses to accept the instruction:

    ../../third_party/crashpad/crashpad/util/misc/capture_context_linux.S: Assembler messages:
    ../../third_party/crashpad/crashpad/util/misc/capture_context_linux.S:291: Error: operand 1 must be an integer register -- `str x31,[x0,#0xb0]'

Bug: chromium:819294
Change-Id: I85be3923ac56fca6e3ec59d7e22b2223cfc8fa63
Reviewed-on: https://chromium-review.googlesource.com/1078818
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Raphael Kubo da Costa <raphael.kubo.da.costa@intel.com>
2018-05-30 16:46:16 +00:00
Scott Graham
5c49c59847 fuchsia: Implement TLS support in HTTPTransportSocket
With use_boringssl_for_http_transport_socket set, this also works on
Linux, however the bots fail during run lacking libcrypto.so.1.1. So,
not enabled on Linux until that's figured out.

(Includes https://github.com/yhirose/cpp-httplib/pull/70, until it lands
and I'll do a full roll of cpp-httplib then.)

Bug: crashpad:30, crashpad:196
Change-Id: I987f6a87f8e47160c15e53fe1ce28611339069ff
Reviewed-on: https://chromium-review.googlesource.com/1075726
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Scott Graham <scottmg@chromium.org>
2018-05-29 23:19:09 +00:00
Scott Graham
9115494e8a fuchsia: Increase timeout for WorkerThread.DoWork test
Because of Fuchsia's scheduler the seemingly reasonable time check fails
occasionally.

Bug: crashpad:196, crashpad:231
Change-Id: Ic212a50e73e283ce3d279dd8c28adecbc432e39c
Reviewed-on: https://chromium-review.googlesource.com/1055805
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Scott Graham <scottmg@chromium.org>
2018-05-11 19:12:54 +00:00
Joshua Peraza
ef6d91b166 Update cpp-httplib to 37130cd
Also exclude http_transport_test_server from Android where it doesn't
build.

Change-Id: I51cc3f50e4fb9db982d91b2924b8ea87d86926d4
Reviewed-on: https://chromium-review.googlesource.com/1054160
Reviewed-by: Scott Graham <scottmg@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
2018-05-11 15:32:35 +00:00
Scott Graham
f55a8d4ff3 fuchsia: Work around lack of packaging in Fuchsia tree build
Packaged test running seems to be a ways off, but with a bit of path
fiddling in test_paths.cc we can actually use the paths where the tests
are copied, so do that instead to get all the tests re-enabled. The
setup in BUILD.gn should be mostly-useful once packaging is working as
all helper/data files will need to specified there anyway.

Also, attempted fix to flaky behaviour in
ProcessReaderFuchsia.ChildThreads exposed because the tests are now
being run. zx_object_wait_many() waits on *any* of the objects, not
*all* of them. Derp!

And finally, for the same test, work around some unintuitive behaviour
in zx_task_suspend(), in particular that the thread will not be
suspended for the purpose of reading registers right away, but instead
only "sometime later", which appears in pratice to be after the next
context switch. Have ScopedTaskSuspend block for a while to try to
ensure the registers become readble, and if they don't, at least fail
noisily at that point.

Bug: crashpad:196
Change-Id: I01fb3590ede96301c941c2a88eba47fdbfe74ea7
Reviewed-on: https://chromium-review.googlesource.com/1053797
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Scott Graham <scottmg@chromium.org>
2018-05-10 19:28:10 +00:00
Scott Graham
31703a585f fuchsia: When in Fuchsia tree, disable tests requiring external files
The package deployment/running is in flux at the moment. In order to get
all the other tests on to the main Fuchsia waterfall, disable the ~25
tests that require external files (for launching child processes,
loading modules, or data files) because those operations all fail on
Fuchsia-without-packages right now. Upstream this is PKG-46. Once test
packaging and running has been resolved, this can be reverted.

These tests are still run when building Crashpad standalone on Fuchsia
as the standalone build simply copies all the relevant data files to the
device in /tmp.

Bug: crashpad:196
Change-Id: I1677c394a2b9d709c59363ebeea8aff193d4c21d
Reviewed-on: https://chromium-review.googlesource.com/1045547
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2018-05-05 00:27:22 +00:00
Scott Graham
02adab2e80 fuchsia: InitializeException, and write dump in exception handler
Implements InitializeException() in ProcessSnapshot, and pulls it all
together writing the dump in crash handler. Sample output at crash
00163eff624e653e on the staging server.

Also adds a child-retrieve helper to koid_utilities.

Bug: crashpad:196
Change-Id: I4bee7655e81e3243ac0ae896ff0caea7ce4acdad
Reviewed-on: https://chromium-review.googlesource.com/1044771
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2018-05-05 00:21:22 +00:00
Scott Graham
847d06db29 fuchsia: Add header with shared exception port key
When binding to an exception port on Fuchsia, a key is supplied and
passed back to coordinate between the registerer and the handler.

An arbitrary value is used by both devmgr:
https://fuchsia.googlesource.com/zircon/+/HEAD/system/core/devmgr/devmgr.c#203

and by crashlogger:
https://fuchsia.googlesource.com/zircon/+/HEAD/system/core/crashlogger/crashlogger.cpp#149 .

In order to be able to have crashpad_handler be a drop-in for
crashlogger (at least for now), Crashpad will use this same key in
subsequent patches for this purpose. Pull this value out in a header so
it can be shared by different bits that will need to refer to it.

Bug: crashpad:196
Change-Id: I00e0178156a792bd80fc83b1b7d85b5ce6742e9a
Reviewed-on: https://chromium-review.googlesource.com/1038123
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Scott Graham <scottmg@chromium.org>
2018-05-02 00:06:27 +00:00
Scott Graham
5636102fb4 Implement unlengthed response read in HTTPTransport
Of course, as soon as I tried it against the real endpoint on Fuchsia,
the server just spits out raw crash id as a string without specifying
Content-Length.

Bug: crashpad:196, crashpad:30
Change-Id: I22af87589a8801cdfece0a7b862e70e0e7097f1f
Reviewed-on: https://chromium-review.googlesource.com/1024953
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2018-04-28 00:08:11 +00:00
Scott Graham
60ae9eeadb Implementation of HTTPTransport via raw socket
Partial implementation: Currently only handles http (i.e. no TLS), only
POST, and only certain response types (only when Content-Length is
specified, and not chunked). Used for Linux and Fuchsia lacking anything
better (that's shippable). Removes libcurl HTTPTransport, since it isn't
available in the Chromium sysroot anyway.

This is an intermediate step until BoringSSL is available in the Fuchsia
SDK. Once that's available, it should be "relatively straightfoward" to
make http_transport_socket.cc secure its socket using BoringSSL or
OpenSSL depending on the platform.

Bug: crashpad:196, crashpad:227, crashpad:30
Change-Id: If33a0d3f11b9000cbc3f52f96cd024ef274a922f
Reviewed-on: https://chromium-review.googlesource.com/1022717
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2018-04-27 04:04:30 +00:00
Scott Graham
2ddfb4cd3c fuchsia: CaptureContext for arm64
Copied from the _linux implementation, which looks close to what
ucontext on Fuchsia is (though it will probably need to change).

In arm64 debug, CaptureContext.CaptureContext requires slightly longer
slop distance.

Bug: crashpad:196
Change-Id: I2a6f90095e06fe8b468fbfd8add66a73c8a1d92f
Reviewed-on: https://chromium-review.googlesource.com/1031091
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Scott Graham <scottmg@chromium.org>
2018-04-26 22:03:39 +00:00
Scott Graham
7274c9823f fuchsia: Various build fixes for building in Fuchsia tree
- Use "deprecated_system_image" (merging from downstream)
- Add package for crashpad_handler
- Depend on launchpad target instead of a lib when in tree, as launchpad
  is no longer in the sysroot.
- Don't try to remove the -Wexit_time_destructors unless building
  standalone, when it's added by mini_chromiums BUILDCONFIG.gn

Bug: crashpad:196
Change-Id: I08e0faaa989346b078a41896eb4ace69e7b1bcdc
Reviewed-on: https://chromium-review.googlesource.com/1026514
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Scott Graham <scottmg@chromium.org>
2018-04-24 22:34:20 +00:00
Scott Graham
0e144fb9ae Add missing http_transport_test_server to gyp build
Follow up to https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1013293.

Bug: crashpad:196, crashpad:227, crashpad:30
Change-Id: I87f18dce6a49f537cff5c9f3af2fe78b8d87c2ef
Reviewed-on: https://chromium-review.googlesource.com/1022738
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Scott Graham <scottmg@chromium.org>
2018-04-23 16:54:32 +00:00
Scott Graham
439ba730c5 Implementation in C++ of HTTPTransport test server
- Pulls in cpp-httplib for test-only usage in third_party/.
- Replaces http_transport_test_server.py with .cc server.
- Remove unnecessary Go toolchain pull. This was planned to be used for
  the test server, but the toolchain integration was too messy when
  covering all target platforms/configs.

Bug: crashpad:196, crashpad:227, crashpad:30
Change-Id: I5990781473dcadfcc036fbe711c02928638ff851
Reviewed-on: https://chromium-review.googlesource.com/1013293
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Commit-Queue: Scott Graham <scottmg@chromium.org>
2018-04-20 20:56:49 +00:00
Leonard Mosescu
a7c30f0501 Fix a few small issues found by GCC
Building Crashpad with GCC flagged a few potential issues. The issues
don't seem particularly severe, but they are easy enough to fix.

Note that even with these changes, Crashpad will not cleanly build with
GCC (additional patches would be needed to third_party/mini_chromium).

Bug: crashpad:
Change-Id: I9289d6c918da9a111aa3c2a078ad0dc1ba84749f
Reviewed-on: https://chromium-review.googlesource.com/1014280
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Leonard Mosescu <mosescu@chromium.org>
2018-04-16 19:27:53 +00:00
Scott Graham
eca0ea8427 Add limited version of URL cracking
This is a very basic form of URL cracking to break a
HTTPTransport::SetURL() argument up into component parts. This is split
out of the (upcoming)
https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1008407
for Linux and Fuchsia.

Bug: crashpad:196
Change-Id: Iba075d9c8720c14550ce53e23d684362da84740c
Reviewed-on: https://chromium-review.googlesource.com/1010972
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Scott Graham <scottmg@chromium.org>
2018-04-13 17:14:24 +00:00
Scott Graham
f5d5a41317 fuchsia: Add implementation of ScopedTaskSuspend
This implementation has some limitations as documented in the header,
however, threads must be suspended in order to use the register capture
debug API so this is somewhat useful for now in the context of
generate_dump.

Also, refactor some child-object retrieval helpers used in a few places.

Bug: crashpad:196
Change-Id: I1fdae5fc3d4b43841e535724eac10c1e58af04c5
Reviewed-on: https://chromium-review.googlesource.com/1007966
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2018-04-13 16:46:40 +00:00
Joshua Peraza
dd4ba4c8a1 linux, x86/x64: set fpregs to nullptr in CaptureContext()
uc_mcontext.fpregs is a pointer to the floating point context, but
CaptureContext() doesn't yet capture floating point context.

This error manages to slip by unit tests when run all together, but
fails when CrashpadClient.SimulateCrash is run by itself.

Bug: crashpad:30
Change-Id: I7adc30648642912d66a7ba8cf9973c9bc0fbd8bc
Reviewed-on: https://chromium-review.googlesource.com/1011504
Reviewed-by: Scott Graham <scottmg@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
2018-04-12 23:54:25 +00:00
Scott Graham
c7fe30dddb fuchsia: Get generate_dump to start attempting process dumps
Add pid->handle mapping code to generate_dump. This is enough to get
generate_dump to start capturing a dump for an arbitrary system process.
It currently CHECK()s in ProcessSnapshotFuchsia on some unimplemented
functionality.

Bug: crashpad:196
Change-Id: Idfbaa4fbf32af63ad6db5b0b78a7a1991b82728e
Reviewed-on: https://chromium-review.googlesource.com/1005804
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Scott Graham <scottmg@chromium.org>
2018-04-10 21:49:05 +00:00
Scott Graham
e83103c805 fuchsia: Implement CaptureContext() for x64
Fuchsia enables safe-stack by default in the compiler. Disable it for
the test function so that a candidate RSP value can be found by using
the value of locals on the stack.

(This also reduces the function prolog size sufficiently for the PC
comparison to work, otherwise it required 75 bytes for the delta
comparison.)

Bug: crashpad:196
Change-Id: I2adbcee93c90dbc415309b79e3d16e9c4635f989
Reviewed-on: https://chromium-review.googlesource.com/1000140
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Scott Graham <scottmg@chromium.org>
2018-04-09 20:33:33 +00:00
Joshua Peraza
1bb4c233e3 linux: skip zero length mappings in the maps file
A zero-length mapping was observed for a x86 process running on an
x86_64 Android Lollipop (5.0) simulator:

ff3c0000-ff3c0000 ---p 00000000 00:00 0
ff3c0000-ffbbf000 rw-p 00000000 00:00 0  [stack]
ffffe000-fffff000 r-xp 00000000 00:00 0  [vdso]

Bug: crashpad:30
Change-Id: I1c1cb5a0910ddf3f02a93d44803e17bec4071110
Reviewed-on: https://chromium-review.googlesource.com/999112
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-04-06 01:45:39 +00:00
Joshua Peraza
10fd672bde linux: Enable brokered memory reading
This change:
1. Updates the broker's memory reading protocol to enable short reads.
2. Updates Ptracer to allow short reads.
3. Updates the broker to allow reading from a memory file.
4. Updates the broker's default file root to be "/proc/[pid]/".
5. Adds PtraceConnection::Memory() to produce a suitable memory reader
for a connection type.

Bug: crashpad:30
Change-Id: I8c004016065d981acd1fa74ad1b8e51ce07c7c85
Reviewed-on: https://chromium-review.googlesource.com/991455
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
2018-04-05 22:21:46 +00:00
Fabrice de Gans-Riberi
74a56c256b Prepare for removal of is_posix from the Fuchsia build
This also rolls crashpad/third_party/mini_chromium/mini_chromium/ d42eb4101..6e0fdb2e4 (2 commits)
d42eb41012..6e0fdb2e49

$ git log d42eb4101..6e0fdb2e4 --date=short --no-merges --format='%ad %ae %s'
2018-04-04 scottmg@chromium.org Repair Linux-with-sysroot build after clang update
2018-04-04 fdegans Prepare for |is_posix| switch in the Fuchsia build

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

Bug: chromium:812974
Change-Id: I3d8efc3124c97981eda63f104a7adfb670babab7
Reviewed-on: https://chromium-review.googlesource.com/988231
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-04-04 22:18:25 +00:00
Jose Dapena Paz
08ce02c352 Fix crashpad build on non Android ARMEL with a recent GLIBC.
user_vfp is not declared anymore in sys/user.h, but in specific
internal kernel asm user.h in GLIBC. So building crashpad on ARMEL
with such a GLIBC will fail to build.

Also, sys/ptrace.h will not include the declarations for
PTRACE_GET_THREAD_AREA and PTRACE_GETVFPREG in arm (they are in
asm/ptrace.h and not included from sys/ptrace.h). So provide
compatibility declarations accordingly for arm architecture.

Change-Id: I58ab5274a66d84c0cbc9e9e9b23e0abc37bf67e5
Reviewed-on: https://chromium-review.googlesource.com/996073
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-04-04 20:35:04 +00:00
Joshua Peraza
d108fd04a5 linux: Add PtraceConnection::ReadFileContents
Some files, such as /proc/[pid]/maps, may not be accessible to the
handler. This enables the handler access to the contents of those files
via the broker.

This change reads maps and auxv using ReadFileContents.

Bug: crashpad:30
Change-Id: Ia19b498bae473c616ea794ab51c3f22afd5795be
Reviewed-on: https://chromium-review.googlesource.com/989406
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-04-03 22:08:29 +00:00
Joshua Peraza
246ecc6686 linux: disable libcurl when in chromium
Bug: crashpad:30
Change-Id: I12007417d27b482f70879d91743fddc06851140e
Reviewed-on: https://chromium-review.googlesource.com/986503
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-03-29 16:14:13 +00:00
Joshua Peraza
7bd613e558 linux: prefix args with crashpad and build tools on android
1. Prefix enable_http_transport_libcurl with crashpad for use in
chromium .gn files.
2. Make tools build on Android using http_transport_none.cc

Bug: crashpad:30
Change-Id: I0a9878fe9f5b8fbc13a52f93df273fb1de8160f3
Reviewed-on: https://chromium-review.googlesource.com/984038
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-03-28 15:48:42 +00:00
Joshua Peraza
5754f608cb android: unset source filters to use linux files
Also disable testing reading AT_ENTRY on Android.

Bug: crashpad:30
Change-Id: I10353bbbb3ff28721a2c05d69463df5eac4df281
Reviewed-on: https://chromium-review.googlesource.com/980811
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-03-27 02:19:39 +00:00
Joshua Peraza
6b23575b34 linux: verify whether a broker has been successfully forked
Also fix an error in checking that PtraceClient was initialized.

Bug: crashpad:30
Change-Id: I1928340a2a642c2d831f0152bb9faaa12afb07e8
Reviewed-on: https://chromium-review.googlesource.com/978630
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-03-23 19:33:14 +00:00
Joshua Peraza
9c89cd99f3 gn: add templates for executables and loadable_modules
When building in chromium, executables and loadable_modules should
depend on:
//build/config:exe_and_shlib_deps
which, among other things, may be needed to introduce a
dependency on a custom libc++.

Bug: crashpad:30
Change-Id: Ic46a3cf5b46bdac09cca22950f9236e0776ba44a
Reviewed-on: https://chromium-review.googlesource.com/974713
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-03-23 16:50:58 +00:00
Joshua Peraza
6d4626090d linux: Add a second CaptureContext symbol name
glibc 2.26 defines ucontext_t from a struct ucontext_t while Bionic
and older versions of glibc use a struct ucontext.

Bug: crashpad:30
Change-Id: I473c317dbdbbedfad601c7594cfa7df7f7c01cb9
Reviewed-on: https://chromium-review.googlesource.com/972613
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-03-21 20:06:45 +00:00
Joshua Peraza
afd3186280 Roll mini_chromium to d42eb41
Change-Id: I18c0a3cfcc82725f19023aa3d78a937719fd2d49
Reviewed-on: https://chromium-review.googlesource.com/972424
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-03-20 23:00:11 +00:00
Joshua Peraza
f5483cb99f linux: Use HANDLE_EINTR for sendmsg and recvmsg
Change-Id: I382d7e02bc11a3955688966da01802535c68c34e
Reviewed-on: https://chromium-review.googlesource.com/971165
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-03-20 19:56:00 +00:00
Joshua Peraza
8175825f45 win: use version.lib instead of mincore.lib
Also enable wd4702: unreachable code for zlib and gtest.

Change-Id: Ie1603b16e96f29b6ac82a1122c5ab5a8942eef24
Reviewed-on: https://chromium-review.googlesource.com/955895
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-03-09 21:26:03 +00:00
Mark Mentovai
23b2156fb6 Don’t read beyond a StringPiece’s bounds in StringToNumber()
The implementations requires NUL-termination for the underlying buffer,
so just use std::string everywhere, rather than trying to detect whether
strings are already NUL-terminated.

Bug: chromium:817982, chromium:818376
Change-Id: I4c8dcb5ed15ebca4c531f9a5d0ee865228dc0959
Reviewed-on: https://chromium-review.googlesource.com/947742
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2018-03-03 03:06:39 +00:00
Joshua Peraza
dec23bef57 win gn: reintroduce flags to disable warnings
These flags were moved to mini_chromium's build/BUILD.gn, but that
configuration is not present when building in chromium.

Change-Id: I0d03c7461869882cf2ee7544ecd3d100eb189160
Reviewed-on: https://chromium-review.googlesource.com/940436
Reviewed-by: Scott Graham <scottmg@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
2018-02-28 17:16:19 +00:00
Scott Graham
9affa2a0e7 Optionally stub out the libcurl-based implementation of HTTPTransport
Bug: crashpad:220
Change-Id: I6556cd5a32ea95c3dc8c5906e0857c83dc88cd9a
Reviewed-on: https://chromium-review.googlesource.com/938492
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-02-26 22:15:27 +00:00
Joshua Peraza
01105719d7 linux: add CRASHPAD_SIMULATE_CRASH()
Bug: crashpad:30
Change-Id: I135864a0e31119de3a814ee5ab5729336f6284a3
Reviewed-on: https://chromium-review.googlesource.com/927116
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-02-21 00:21:44 +00:00
Joshua Peraza
0520fdff1e linux: Move ScopedPrSetPtracer to util/
CrashpadClient will need ScopedPrSetPtracer when launching a handler
process in response to a crash.

Bug: crashpad:30
Change-Id: I35bc784b948349ca771f9cd65ef1089e626976bb
Reviewed-on: https://chromium-review.googlesource.com/927352
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
2018-02-20 21:26:42 +00:00
Joshua Peraza
ebad8bd925 Don't spawn an upload thread if url is empty
Also automatically stop upload and prune threads on destruction.

Bug: crashpad:30
Change-Id: I45a30944eb3052182da296e00a6d6041691ab772
Reviewed-on: https://chromium-review.googlesource.com/924456
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-02-20 19:02:29 +00:00
Scott Graham
5cb869392e fuchsia: Compile out LoggingLock/UnlockFile, add DCHECKs to Settings
Fuchsia does not currently support any sort of file locking. Until a
lock server can be implemented, compile out the calls to flock(). In the
one current non-test user of locking (Settings) add a
pseudo-implementation that will DCHECK if there is ever contention on
the lock.

Bug: crashpad:217, crashpad:196
Change-Id: Ifdf7e00886ad7e7778745f1ae8f0ce2a86f0ae3b
Reviewed-on: https://chromium-review.googlesource.com/924312
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-02-16 20:58:38 +00:00
Scott Graham
f38af628c9 fuchsia: Don't fail rename if source == dest
Fuchsia errors out in rename() when source == dest. I believe this is
incorrect according to
http://pubs.opengroup.org/onlinepubs/9699919799/functions/rename.html,
but it's also relatively easy to work around in our code, and this fixes
CrashReportDatabaseTest.RequestUpload.

This is ZX-1729 upstream.

Bug: crashpad:196
Change-Id: I27473183b04484e146a7bd9e87e60be3aeff1932
Reviewed-on: https://chromium-review.googlesource.com/923708
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Scott Graham <scottmg@chromium.org>
2018-02-16 17:36:08 +00:00
Joshua Peraza
0429216f59 linux: Add CrashReportExceptionHandler
Bug: crashpad:30
Change-Id: I2855b34abe34f6d665539de0e4a227c933bd2b8c
Reviewed-on: https://chromium-review.googlesource.com/922923
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-02-16 17:17:57 +00:00
Scott Graham
7faa2ef898 Get CrashpadInfo address via a .note, rather than dynamic symtab
Embeds the address of g_crashpad_info into a .note section (which is
readable by the generic code to read notes in ElfImageReader).
Unfortunately because the note section is in libclient.a, it would
normally be dropped at link time.  To avoid that, GetCrashpadInfo() has
a reference *back* to that section, which in turn forces the linker to
include it, allowing the note reader to find it at runtime.

Previously, it was necessary to have the embedder of "client" figure out
how to cause `g_crashpad_info` to appear in the final module's dynamic
symbol table.  With this new approach, there's no manual configuration
necessary, as it's not necessary for the symbol to be exported.

This is currently only implemented in the Linux module reader (and I
believe the current set of enabled tests aren't exercising it?) but it
will also be done this way for the Fuchsia implementation of
ModuleSnapshot.

Bug: crashpad:196
Change-Id: I599db5903bc98303130d11ad850ba9ceed3b801a
Reviewed-on: https://chromium-review.googlesource.com/912284
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2018-02-15 19:02:12 +00:00
Joshua Peraza
c45ba7920e Make NewReport objects own their associated database resources
This change updates CrashReportDatbase::NewReport objects to own the
file handle associated with the new report, now accessible via a
FileWriter. NewReport's destructor closes its file handle and removes
its new report unless disarmed with FinishedWritingCrashReport,
eliminating the need for CallErrorWritingCrashReport.

Bug: crashpad:206
Change-Id: Iccb5bbc0ebadb07a237ff8eb938389afcfeae2a5
Reviewed-on: https://chromium-review.googlesource.com/916941
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
Reviewed-by: Scott Graham <scottmg@chromium.org>
2018-02-14 01:33:52 +00:00
Scott Graham
f878f15517 fuchsia: Add flock() stub to get test binaries linking again
Because the SDK isn't pinned, this broke recently:
https://build.chromium.org/p/client.crashpad/builders/crashpad_fuchsia_x64_dbg/builds/59/steps/compile%20with%20ninja/logs/stdio
due to changes in limiting exported symbols, flock() being one of the
casualties:
https://fuchsia.googlesource.com/zircon/+log/HEAD/third_party/ulib/musl/exported.map

Temporarily add a stub local definition here, as excluding
LoggingLockFile() is needed by Settings, which is used downstream by a
bunch of things, and so requires a lot of build file gymnastics to
exclude. Once there's a Fuchsia implementation of Settings, this can be
deleted and LoggingLock/UnlockFile can be #if'd out for Fuchsia.

Bug: crashpad:196
Change-Id: I0971736572b940c8bc2364c01dafc6844f9303d7
Reviewed-on: https://chromium-review.googlesource.com/917083
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Scott Graham <scottmg@chromium.org>
2018-02-13 21:17:04 +00:00
Scott Graham
b83f4c731d Let UUID::InitializeFromString accept StringPiece16 too
Split out of crrev.com/c/689745 by jperaza, with a simple test added.

It is useful for this to be an overload instead of a separate signature
so that code that extracts a UUID string out of a filename can treat it
generically between Windows and non-Windows.

Bug: crashpad:196, crashpad:206
Change-Id: I0d7d84a93d9526d1aae8839179dfe903acca091b
Reviewed-on: https://chromium-review.googlesource.com/916885
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-02-13 20:18:24 +00:00
Scott Graham
73e862e15a fuchsia: Exclude capture_context_test.cc from test build
Pending a definition of NativeCPUContext, and an implementation of
CaptureContext().

Bug: crashpad:196
Change-Id: Ibd7721cb740d7662379bb6b22e7804738e16c724
Reviewed-on: https://chromium-review.googlesource.com/916902
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Scott Graham <scottmg@chromium.org>
2018-02-13 19:52:25 +00:00
Joshua Peraza
a8ad3bdbdf linux: fix incorrect fallthrough
Previously, an error would have been logged twice.

Bug: crashpad:30
Change-Id: I9445c022550ad14497186c6878863fbf72d8cd59
Reviewed-on: https://chromium-review.googlesource.com/911822
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
2018-02-09 19:54:42 +00:00
Joshua Peraza
38b20ca57e Relocate CaptureContext to misc and implement on Linux
Previously, the mac version was  under client/ and win under util/win/.
This cl brings them all together under util/misc/ and combines common
test code.

Bug: crashpad:30
Change-Id: Idf0d0158b969d5aa9802dfc8c21f73041b2bcc6c
Reviewed-on: https://chromium-review.googlesource.com/907755
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
2018-02-09 17:25:45 +00:00
Scott Graham
14dbd3531d gn win: Get main test binaries building
- default to subsystem:console
- don't build posix/timezone.*
- add some missing libs

This gets all the main binaries building and running. Most configs pass,
but there's some offsets that seem different in some builds; need to
investigate more. Additionally, the binaries used by end_to_end_test.py
aren't yet built, so that script fails.

Includes mini_chromium roll to 46eeaf9:
46eea49 gn win: Add debug info and pdb to cc/cxx
902a29f gn win: Various fixes towards making GN build work

Bug: crashpad:79
Change-Id: Ie56a469b84bed7b0330172cec9f1a8aeb95f702e
Reviewed-on: https://chromium-review.googlesource.com/902403
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-02-06 19:12:18 +00:00
Scott Graham
709a92981d Rework ReadCStringUnmapped[SizeLimited](Self|Forked) to not use fork()
Avoids using pointers shared between parent/child. Explicitly builds the
test strings in the child process, and then passes both the address and
the expected value of the string to the parent process for expectation
checking. This is necessary to have the test work on Fuchsia.

Also renames ...Forked to ...Child.

Bug: crashpad:196, crashpad:215
Change-Id: I7f22c134301a2806eb39549e371414e7ec9bf225
Reviewed-on: https://chromium-review.googlesource.com/896228
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Scott Graham <scottmg@chromium.org>
2018-01-31 23:23:52 +00:00
Scott Graham
f9d7b8b781 Rework ReadUnmapped(Self|Forked) to not need fork()
Avoids fork()ing as per previous tests in this file, necessary for
Fuchsia.

Unfortunately, I believe that mmap()/munmap() aren't actually working
correctly on Fuchsia as tested by the EXPECT_FALSE reads, and so these
tests incorrectly fail. Bug with repro filed upstream at ZX-1631.

Bug: crashpad:196, crashpad:215
Change-Id: Iec86f64fcee12097223326f2bf2d5a5348a8a610
Reviewed-on: https://chromium-review.googlesource.com/894124
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Scott Graham <scottmg@chromium.org>
2018-01-30 22:05:28 +00:00
Joshua Peraza
441789be5b android: Implement Semaphore with a condition variable and mutex
Bionic uses negative values of a semaphore to represent contention.
`sem_timedwait` fails to restore the value to 0 on timeout resulting in
an error (EBUSY) upon calling `sem_destroy`.

Bug: crashpad:30
Change-Id: If1c73a54a879ebd003b0792ebb8f68ceb83ac8bb
Reviewed-on: https://chromium-review.googlesource.com/894106
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
2018-01-30 21:01:48 +00:00
Scott Graham
693ff6d550 Rework ReadCString[SizeLimited](Self|Forked) to not use fork()
Instead of using pointers shared between the parent/child due to fork,
explicitly builds and passes them between processes. This is
unfortunately a bit more verbose, but seems like it tests functionality
a little better, and is required to have the test work on Fuchsia.

Also renames the ...Forked to ...Child to be correct after the change
from Multiprocess to MultiprocessExec.

Bug: crashpad:196, crashpad:215
Change-Id: I610a7f1e35b6513805c27d9e610f7a9b9820cabc
Reviewed-on: https://chromium-review.googlesource.com/892286
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2018-01-30 19:27:15 +00:00
Scott Graham
ec71b63d6f Rework ProcessMemory.Read(Self|Forked) to work without fork()
Instead of allocating test memory in the parent and then forking and
comparing against it, the child does the allocation and passes back the
region's size and address. Additionally, switch the memcmp()s to be
value-based comparisons instead because the region isn't available in
the parent.

Also renames ProcessMemory.ReadForked to .ReadChild to be correct after
the change from Multiprocess to MultiprocessExec.

This is necessary to have the tests work on Fuchsia.

Bug: crashpad:196, crashpad:215
Change-Id: Id996a21180d87c7f2556283e9f54f6128726f9b8
Reviewed-on: https://chromium-review.googlesource.com/892102
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2018-01-30 18:22:25 +00:00
Mostyn Bramley-Moore
26cd6138af [jumbo] add some missing include guards
Change-Id: I062c853d65c3e89a61920d790d9bc5c993b46fcd
Reviewed-on: https://chromium-review.googlesource.com/884581
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: Scott Graham <scottmg@chromium.org>
2018-01-24 22:45:01 +00:00
Joshua Peraza
c56e854984 Fix Doxygen errors
Change-Id: I571d322e75afd33a679c488694db2e7bad3285ea
Reviewed-on: https://chromium-review.googlesource.com/883903
Reviewed-by: Scott Graham <scottmg@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
2018-01-24 18:21:15 +00:00
Joshua Peraza
24f07f7c43 linux: Enable ARM family exception and thread snapshots
ARM references:
http://elixir.free-electrons.com/linux/latest/source/arch/arm/include/asm/ucontext.h
http://elixir.free-electrons.com/linux/latest/source/arch/arm/kernel/signal.c#L185

ARM64 references:
http://elixir.free-electrons.com/linux/latest/source/arch/arm64/include/uapi/asm/sigcontext.h
http://elixir.free-electrons.com/linux/latest/source/arch/arm64/kernel/signal.c#L371

Bug: crashpad:30
Change-Id: I53f235b5826607db260bd1e43a819a93284843f5
Reviewed-on: https://chromium-review.googlesource.com/865435
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
2018-01-24 17:09:24 +00:00
Scott Graham
dea19c7374 fuchsia: Port ElfImageReader and (some of) its tests
(Still need to avoid fork()-dependence for the non-self tests.)

Bug: crashpad:196
Change-Id: Ib34fe33c7ec295881c1f555995072d9ff742647f
Reviewed-on: https://chromium-review.googlesource.com/876650
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Scott Graham <scottmg@chromium.org>
2018-01-19 22:22:21 +00:00
Joshua Peraza
e7fe120d8b ProcessMemory: Add ReadUpTo to enable short reads
ProcessMemory::ReadCStringInternal needs to be able to perform short
reads.

Change-Id: I2b2e1c2e6603d01235d8d2dbd15494375cd7f3f6
Reviewed-on: https://chromium-review.googlesource.com/874776
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
Reviewed-by: Scott Graham <scottmg@chromium.org>
2018-01-18 19:59:59 +00:00
Joshua Peraza
939afcf56e Add process_memory.cc when using gyp
Change-Id: I835b03f1553c04ebc03e3eb1f11455f049342cc5
Reviewed-on: https://chromium-review.googlesource.com/872252
Reviewed-by: Scott Graham <scottmg@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
2018-01-18 01:15:02 +00:00
Peter Collingbourne
0c57aafb4e Add support for libc++ on Windows.
Use the "POSIX" implementation of ThrowBadAlloc() on Windows when libc++
is being used.

Bug: chromium:801780
Change-Id: I230a8df9040aa73e290bb0d002996e822958a94b
Reviewed-on: https://chromium-review.googlesource.com/872121
Reviewed-by: Scott Graham <scottmg@chromium.org>
Commit-Queue: Peter Collingbourne <pcc@chromium.org>
2018-01-18 00:36:53 +00:00
Scott Graham
f62a30e977 fuchsia: Implementation of MultiprocessExec
This supports multiprocess tests of the non-fork() variety.

Also, improve directory finding so that the
crashpad_test_test_multiprocess_exec_test_child binary can be located
correctly on Fuchsia.

Doc ref for launchpad:
https://fuchsia.googlesource.com/zircon/+/master/system/ulib/launchpad/include/launchpad/launchpad.h#23

Also, roll mini_chromium to pick up ScopedZxHandle addition. Includes:
a19ef08 Merge ScopedZxHandle from Chromium base
f21c900 fuchsia: Move zircon libs dep to base, rather than global

Bug: crashpad:196
Change-Id: Id01dee43f2d04e682e70c12777aff41f8dd848d6
Reviewed-on: https://chromium-review.googlesource.com/868967
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Scott Graham <scottmg@chromium.org>
2018-01-17 23:45:42 +00:00
Scott Graham
4d2414e38e fuchsia: Add implemention of ProcessMemory
Bug: crashpad:196
Change-Id: I04a29afcbb16b5ef14d6f83d7af1d954f5164ee9
Reviewed-on: https://chromium-review.googlesource.com/868736
Reviewed-by: Mark Mentovai <mark@chromium.org>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Scott Graham <scottmg@chromium.org>
2018-01-16 23:08:41 +00:00
Joshua Peraza
70563e92f4 Add CrashpadInfoReader to read CrashpadInfo via ProcessMemory
Bug: crashpad:30
Change-Id: I295d518ee0eef1fd61e5544cd6bad25827d07a02
Reviewed-on: https://chromium-review.googlesource.com/846025
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
2018-01-09 01:27:50 +00:00
Mark Mentovai
7a285816e9 gn, android: Build for Android with GN
With a companion mini_chromium change at https://crrev.com/c/841203,
it’s possible to configure via “gn args” as follows:

android_ndk = "/android/android-ndk-r16"
target_cpu = "x86_64"
target_os = "android"

Note that a standalone toolchain is not required.

Bug: crashpad:30, crashpad:79
Change-Id: Ica55bdcb82c730909c05dd9fecb40a74eca78c8a
Reviewed-on: https://chromium-review.googlesource.com/841286
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2017-12-22 21:23:31 +00:00
Scott Graham
41c7ace7e8 linux: Add missing build_config.h include
Otherwise, Chromium complains about ARCH_CPU_64_BITS usage without it.

Bug: crashpad:30
Change-Id: I4e10595280d309ae891266c03d0467c6c8471d4e
Reviewed-on: https://chromium-review.googlesource.com/835429
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Scott Graham <scottmg@chromium.org>
2017-12-20 00:29:35 +00:00
Scott Graham
ab153f7e1b gn: Avoid depending on BUILDCONFIG.gn globals
Goes with https://chromium-review.googlesource.com/c/chromium/mini_chromium/+/834648.

Includes mini_chromium DEPS roll to pull in edfe51ce81

Bug: crashpad:79, crashpad:196
Change-Id: Ib45cc738aecf9ae727f8faeff81f3b71e2dc9de8
Reviewed-on: https://chromium-review.googlesource.com/834543
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-12-19 23:38:36 +00:00
Mark Mentovai
3a41c51668 gn, linux: Update build after 9b2ba587f618
Bug: crashpad:30, crashpad:79
Change-Id: Ib50352cfd36d40786b9732e7c4ab50781963369b
Reviewed-on: https://chromium-review.googlesource.com/835028
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2017-12-19 22:36:22 +00:00
Joshua Peraza
9b2ba587f6 linux: Add ExceptionHandlerServer and ExceptionHandlerClient
Bug: crashpad:30
Change-Id: I60874a26ccb281144f870df2b4d16c6970a39f6b
Reviewed-on: https://chromium-review.googlesource.com/772824
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-12-19 20:11:52 +00:00
Mark Mentovai
99b0030616 gn, linux: Build for Linux with GN
This is sufficient for a native Linux build using GN. Android is not yet
supported.

mini_chromium side: https://crrev.com/c/833407

This also updates mini_chromium to 404f6dbf9928.

c913ef97a236 gn, linux: Build for Linux with GN
404f6dbf9928 gn: Don’t use .rsp files; rationalize descriptions and
             output dirs

Bug: crashpad:79
Change-Id: I4f3b72fd02884d77812e520fb95231b35815677d
Reviewed-on: https://chromium-review.googlesource.com/833408
Commit-Queue: Mark Mentovai <mark@chromium.org>
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-12-19 19:31:20 +00:00
Scott Graham
1bc07b76ed gn: Use mini_chromium_is_posix in preference to global is_posix
Goes with
https://chromium-review.googlesource.com/c/chromium/mini_chromium/+/833328.

Also roll mini_chromium:

scottmg@around:/work/crashpad/crashpad/third_party/mini_chromium/mini_chromium$ git log 20182dd263312db9fad52042fc92c33331ec6904..e182031 --oneline
e182031 gn: Add is_posix.gni to define local is_posix variable
4cb1344 gn: Enable proper release-mode optimizations for POSIX-non-Mac
9c0eb0c Remove reference to ptr_util.h
c5ae5aa gn: Configure the sysroot in target_sysroot, not sysroot
f7e5654 gn, mac: Honor mac_sdk_min, sysroot, and mac_deployment_target
7701901 Remove the deprecated sparse_histogram.h header.
e2f0160 Use Chromium copyright notice and BSD license in mini_chromium


Bug: crashpad:79, crashpad:196
Change-Id: Ie41d971e0e769db2ed18861da07021c071f6c650
Reviewed-on: https://chromium-review.googlesource.com/833329
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-12-19 00:07:06 +00:00
Scott Graham
457cc6a34f gn: Refactor build files to avoid build/secondary
In doing standalone bringup of Crashpad targeting Fuchsia, it seemed
tidy to keep the same literal paths to the dependencies that Chromium
needed and add stubs/forwarding to build/secondary in the Crashpad tree
as required to make those work.

However, when trying to build Crashpad in the Fuchsia tree itself, that
would require adding forwarding files to the Fuchsia tree to match the
Chromium directory structure, which would be awkward. Instead, have
explicit dependencies in the Crashpad tree that select the locations
for various dependencies.

Bug: crashpad:79, crashpad:196
Change-Id: Ib506839f9c97d8ef823663cdc733cbdcfa126139
Reviewed-on: https://chromium-review.googlesource.com/826025
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-12-18 22:53:58 +00:00
Mark Mentovai
1764594bff gn, mac: Work without a sysroot
This is needed to make the “sysroot = "/"” configuration, which
translates to “sysroot = ""”, work properly

Bug: crashpad:79
Change-Id: I25ab49b7d57abfcf0ce9a62925013bb58dadf5dd
Reviewed-on: https://chromium-review.googlesource.com/831007
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-12-18 18:24:38 +00:00
Ilya Sherman
10ff56eee5 Include the appropriate header for BUILD_FUSCHIA
Without this, attempting to roll crashpad in Chromium gives this
presubmit warning:
third_party/crashpad/crashpad/util/file/file_io_posix.cc:69
  OS_FUCHSIA macro is used without including build/build_config.h.

R=mark@chromium.org

Bug: none
Change-Id: Ie2d1df574773b66687948a481b9b31012427a3c3
Reviewed-on: https://chromium-review.googlesource.com/830258
Commit-Queue: Ilya Sherman <isherman@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-12-15 20:57:47 +00:00
Ilya Sherman
344acadfdd [Cleanup] Rename UMA_HISTOGRAM_SPARSE_SLOWLY to base::UmaHistogramSparse().
R=mark@chromium.org

Bug: chromium:773850
Change-Id: Idef7b4c821dcac03e095d1400534ddf503a22423
Reviewed-on: https://chromium-review.googlesource.com/828530
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-12-15 19:17:46 +00:00
Scott Graham
1697314952 fuchsia: Make Filesystem.RemoveFile, .RemoveDirectory pass
- Remove unnecessary flags (O_NOCTTY, O_CLOEXEC)
- Don't try to unlink a directory when it's expected to fail
- Disable rmdir() in location where it's expected to fail, as it currently
  (incorrectly) does not fail on Fuchsia.

Bug: crashpad:196, US-400
Change-Id: I80cf833ba90f31943b9043727ea07893b4eb3494
Reviewed-on: https://chromium-review.googlesource.com/823286
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Scott Graham <scottmg@chromium.org>
2017-12-13 23:23:45 +00:00
Joshua Peraza
0924e56751 linux: Add PtraceBroker and PtraceClient
A PtraceBroker/Client pair implement a PtraceConnection over a socket.
The broker runs in a process with `ptrace` capabilities for the target
process and serves requests for the client over a socket.

Bug: crashpad:30
Change-Id: Ied19bcedf84b46c8f68440fd1c284b2126470e5e
Reviewed-on: https://chromium-review.googlesource.com/780397
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-12-11 18:35:24 +00:00
Scott Graham
92e8bc4713 win: Fix ProcessInfo.OtherProcess test flake
Removes the /BASE:N and /FIXED arguments to the child, which weren't
actually testing correctly (see bug), and were causing problems at least
on Win7 when something collided with that address.

Additionally, switches to storing modules in load order, rather than a
combination of memory order and initialization order, since that was a
bit confusing and there was no great rationale for it.

While reviewing, handle the case of a corrupted module name, and if it's
unreadable continue emitting "???" as a name. Adds a test for this
functionality.

Bug: chromium:792619
Change-Id: I2e95a81b02fe4d527868f6a5f980d315604255a6
Reviewed-on: https://chromium-review.googlesource.com/815875
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-12-09 00:11:31 +00:00
Scott Graham
a4fc880278 gn, mac: Get basic generation working
A couple targets compile, but not linking yet.

Requires https://chromium-review.googlesource.com/c/chromium/mini_chromium/+/812410

Bug: crashpad:79
Change-Id: Ifc472628ec5233fc88c746e74a1f7b3ce0637f91
Reviewed-on: https://chromium-review.googlesource.com/811884
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-12-07 00:19:36 +00:00
Scott Graham
15c4fff902 Get crashpad_client_test and crashpad_handler_test building
Stubs a variety of classes (CrashReportExceptionHandler,
ExceptionHandlerServer, HTTPTransport, CrashReportDatabase).

Bug: crashpad:196
Change-Id: I4772f90d0d2ad07cc2f3c2ef119e92fde5c7acef
Reviewed-on: https://chromium-review.googlesource.com/809940
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Scott Graham <scottmg@chromium.org>
2017-12-06 18:39:24 +00:00
Scott Graham
bfeb194b01 fuchsia: Get crashpad_util_test building
Links, but various tests fail.

Also adds support to run_tests.py to run a single binary, likely only
useful on Fuchsia.

Bug: crashpad:196
Change-Id: Ie82ef26ec214ff4262194e877469953aa8fb367e
Reviewed-on: https://chromium-review.googlesource.com/809467
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-12-05 23:23:30 +00:00
Scott Graham
741a84a298 fuchsia: Add runner, get crashpad_test_test building and running
- Implement build/run_tests.py to run on Fuchsia device
- Implement paths_fuchsia.cc using standard Fuchsia namespace layout
- Exclude multiprocess tests, currently unimplemented
- Don't use unnecessary O_ flags on Fuchsia in open() call.

Bug: crashpad:196, chromium:726124, ZX-797
Change-Id: Ie59dce685b4c3fe54f3e36f357c1101d402ee8b7
Reviewed-on: https://chromium-review.googlesource.com/802180
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-12-05 18:59:26 +00:00
Scott Graham
7e9dbd53fb fuchsia: Misc fixes to get more pieces compiling
- Some missed set_sources_assignment_filters if'ing
- Exclude posix/symbolic_constants_posix.(h|cc) as they don't compile and
  won't be necessary
- Exclude a handful of other posix files that don't make sense on Fuchsia.

Bug: crashpad:196
Change-Id: I9ec985f00488267dc104164445c6cc5bca36a1fc
Reviewed-on: https://chromium-review.googlesource.com/798220
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-11-30 18:33:55 +00:00
Mark Mentovai
d25b0242c6 gn: Fix a couple of things after 9465fc72ad90 and 2bb56fafe3bd
When I redid the Crashpad GN build a few weeks ago
(https://chromium-review.googlesource.com/c/chromium/src/+/751403), I
tried to order things according to the GN style guide
(https://chromium.googlesource.com/chromium/src/tools/gn/+/HEAD/docs/style_guide.md).
As for conditionals, I tried to stick to doing a set of conditionals
after “sources” for just “sources”, and then another one at the bottom
for everything else.

It turns out that this was a good idea because it’s an error to say
“deps += [something]” inside a conditional until you’ve already said
“deps = [something_else]” first. (Maybe that’s why I did it.)
9465fc72ad90 regressed this.

2bb56fafe3bd also left behind a couple of straggler paths that were
absolute to Chromium’s root but should have been made relative.

This also fixes a comment (about something that won’t yet work outside
of Chromium anyway, but still…)

Bug: crashpad:79
Change-Id: I8a6f84bfad368cbcdae4fbff11f1d00e2af14b93
Reviewed-on: https://chromium-review.googlesource.com/798172
Commit-Queue: Mark Mentovai <mark@chromium.org>
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-11-29 23:40:18 +00:00
Mark Mentovai
593ede52e0 Fixes for drive-by review comments after ef3ce94fbfbb
Change-Id: I28edc00549d51576ab553f401235aa1d9f669232
Reviewed-on: https://chromium-review.googlesource.com/797335
Reviewed-by: Scott Graham <scottmg@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2017-11-29 19:52:08 +00:00
Mark Mentovai
ef3ce94fbf Python 3 support for Python scripts (without compromising Python 2)
It’s better to be prepared for the future than…to not be.

This is mostly the result of running 2to3 on all .py files, with some
small shims to maintain compatibility with Python 2.
http_transport_test_server.py was slightly more involved, requiring many
objects to change from “str” to “bytes”.

The #! lines and invokers still haven’t changed, so these scripts will
still normally be interpreted by Python 2.

Change-Id: Idda3c5650f967401a5942c4d8abee86151642a2e
Reviewed-on: https://chromium-review.googlesource.com/797434
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2017-11-29 18:47:38 +00:00