1529 Commits

Author SHA1 Message Date
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
Mark Mentovai
03850fb6cf Remove the last two extraneous semicolons
Patch by Nico Weber <thakis@chromium.org>, originally
https://crrev.com/c/1476986.

Bug: chromium:926235
Change-Id: I6fd9aed5c57ffe0fec8f9adcd4cf5211d7b795c3
Reviewed-on: https://chromium-review.googlesource.com/c/1475992
Commit-Queue: Mark Mentovai <mark@chromium.org>
Commit-Queue: Nico Weber <thakis@chromium.org>
Reviewed-by: Nico Weber <thakis@chromium.org>
2019-02-19 15:59:10 +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
Maksim Sisov
152aa8d1f9 Add missing limits header to crashpad.
This patch fixes the following error:

../../third_party/crashpad/crashpad/snapshot/linux/cpu_context_linux.cc:246:12: error: 'numeric_limits' is not a member of 'std'
       std::numeric_limits<decltype(context->spsr)>::max()) {
            ^~~~~~~~~~~~~~
../../third_party/crashpad/crashpad/snapshot/linux/cpu_context_linux.cc:246:27: error: expected primary-expression before 'decltype'
       std::numeric_limits<decltype(context->spsr)>::max()) {
                           ^~~~~~~~
../../third_party/crashpad/crashpad/snapshot/linux/cpu_context_linux.cc:246:27: error: expected ')' before 'decltype'

Bug: chromium:819294
Change-Id: I4f31a33fcdae9567c71a4d371d2e6afe68d2ef6a
Reviewed-on: https://chromium-review.googlesource.com/c/1454376
Commit-Queue: Maksim Sisov <msisov@igalia.com>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2019-02-11 10:07:08 +00:00
Vlad Tsyrklevich
caad799c28 Delete chromium-specific macOS rpaths
These flags are no longer tracked here since the macOS crashpad_handler
is built upstream as of https://crrev.com/629713

Bug: chromium:912286
Change-Id: I6735a6a1364086e67d1b7c2d316829c74c20d0d9
Reviewed-on: https://chromium-review.googlesource.com/c/1456777
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Vlad Tsyrklevich <vtsyrklevich@chromium.org>
2019-02-07 18:30:28 +00:00
Tom Tan
84ef87ef51 Fix arm64 CONTEXT for crashy_test_program
Bug: chromium:893460
Change-Id: I0bd47521d68aa9477e32104986bd7aeb1d4e2738
Reviewed-on: https://chromium-review.googlesource.com/c/1454820
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2019-02-05 20:06:48 +00:00
Eric Astor
f66a125cd5 Move POSIX-only include into #ifdef guard, preventing warnings of undefined symbols in some conservative build configurations.
Change-Id: I75ab0a7623c506a826b42406484e8a29f9db9304
Reviewed-on: https://chromium-review.googlesource.com/c/1439198
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Eric Astor <epastor@google.com>
2019-01-28 17:14:06 +00:00
Matthew Dempsky
1fc95dc3cc [fuchsia] Add zx_vmo_replace_as_executable to tests
Fuchsia in the future will create VMOs as non-executable (i.e.,
without ZX_RIGHT_EXECUTE) by default, so this necessary preparation
for that.

Change-Id: I00ada804d1d16db4f50ff3882058e382b1845328
Reviewed-on: https://chromium-review.googlesource.com/c/1419778
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Matthew Dempsky <mdempsky@chromium.org>
2019-01-22 21:07:06 +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
Mark Mentovai
8694cbf33e Update gtest to 9518a57428ae0a7ed450c1361768e84a2a38af5a
4665eee10a1d test, please ignore
826656b25f62 Remove workarounds for unsupported MSVC versions
c43603f288f4 Remove GTEST_HAS_HASH_SET/MAP check
a3a42514f1a9 Define GTEST_DISABLE_MSC_WARNINGS_PUSH/POP for all
             compilers
48021336904c Add back warning suppression that shouldn't have been
             removed
1454f301c554 Update README.md
09beafcd1d54 Merge branch 'master' into patch-1
7a0680dc2230 Merge pull request #1959 from robinlinden:remove-msvc-
             workarounds
d5932506d6ee Merge pull request #1961 from coppered/patch-1
c5f08bf91944 Googletest export
e46e87bb1f76 Googletest export
aac18185ebb4 Googletest export
8e86f6726164 Googletest export
45d66d81bec9 Googletest export
5dab7be70d62 Googletest export
c2989fe29b6a Googletest export
b49266606875 Googletest export
bb7c0ecbdf47 Googletest export
64368e0584e0 Googletest export
f7779eb3cb5d Googletest export
a3013cceffbe Googletest export
3cf8f514d859 Update build badge
ce526b87007a Issue #1955: Remove THREADS_PREFER_PTHREAD_FLAG
28a3261fdf94 Create CODE_OF_CONDUCT.md
87589af5ba5a Update .travis.yml
2f126c74d264 Update .travis.yml
5404fd7d06a8 Update .travis.yml
915f6cfef369 Update .travis.yml
fca458cab75b Googletest export
191f9336bc92 Merge pull request #1977 from

             lukasm91:issue_1955_remove_pthread_flags
b22d23667b60 Googletest export
8fbf9d16a63a Googletest export
775a17631217 Fixed typo
a42cdf2abdc0 Googletest export
26743363be8f Googletest export
ba344cbc405f Googletest export
10e82d01d94c Update README.md
a28a71ae41fa Update README.md
214521a1486d Update WORKSPACE
3fd66989bb5c Googletest export
067aa4c28bb1 Do not define GTEST_IS_THREADSAFE within GTEST_HAS_SEH
3d71ab4c37de Googletest export
fe14e3030737 Merge pull request #1995 from siddhanjay/patch-1
2c8ab3f18b2e feat:  Add initial support for PlatformIO and Arduino
695cf7c96249 Merge pull request #1997 from gpakosz:GTEST_IS_THREADSAFE
39c09043b83e chore:  Add initial library.json config
d9251df84951 fix: Remove global chmod from Travis
31eb5e9b873a chore:  Update version to latest release
b5c08cb9f4f1 Cache gcc and clang APT packages
06bb8d4d6dcf Googletest export
6cbd3753dc19 Googletest export
ea5e941d8470 Change directory ownership earlier
fc0f92676865 Don't cache APT packages on OS X/macOS
3b1f43c2e7a5 Use if statements
b545089f5117 Merge pull request #2004 from cotsog/patch-1
6ef591381372 Googletest export
3949c403c0ed Update README.md
81f00260668d Googletest export
c6cb7e033591 Googletest export
b5f5c596a991 Merge pull request #2000 from
             ciband:feat/add_support_platformio
1496f73cc4c3 fix:  correct JSON syntax
0f698c830f79 chore:  Add .vs to .gitignore for Visual Studio
096fb37a1976 Googletest export
1ec20f87e390 Googletest export
b7dd66519f4a Googletest export
ed3f9bb22960 Googletest export
85c4172ed66e Update README.md
7515e399436a Googletest export
9ab640ce5e51 Googletest export
e26a3fa13ca2 Googletest export
9494c45e75a5 Googletest export
a83cc11abe48 Googletest export
b93a13ec4db4 Improvements have been made to the example/sample makefiles
             for both googlemock and googletest. Library files are now
             created and named like versions produced by Cmake
34a99e547ab7 Googletest export
4160336cb433 Merge pull request #2013 from ciband:chore/fix_library_json
150613166524 Update README.md
c0ef2cbe42df fix:  Correct GitHub paths
16269ae2f857 Merge pull request #2027 from ciband:chore/fix_library_json
77004096e850 Update README.md
6729a1361150 Merge #2002
0cf2130c0b59 Update Xcode project file
3bedb5a9fc36 Merge pull request #2035 from syohex/update-xcode-project-
             file
6d5ce40d4c27 fix:  Add additional source and include directories
de99386b67a3 Merge branch 'chore/fix_library_json' of
             https://github.com/ciband/googletest into
             chore/fix_library_json
25905b9f9a45 Merge branch 'master' of
             https://github.com/google/googletest
2ace910a3580 Revert "test, please ignore"
8ed34e0f6b4e Remove outdated scripts
933e5df28372 Merge pull request #2039 from gennadiycivil/master
f8b1c1af1775 Googletest export
14c2fba7349e Googletest export
1bcbd5871e34 Merge pull request #2037 from ciband:chore/fix_library_json
bfcc47fc2f61 Merge pull request #2026 from
             justin6case/example_makefile_improvements
8a27d164cbc7 Update README.md
6e410a3ae965 Update README.md
ac8c102dae66 Update README.md
3a460a26b7a9 Googletest export
827515f8a092 Googletest export
5d3a2cd9c854 Update docs, TestCase->TestSuite
58e62f7a989c Merge branch 'master' of
             https://github.com/google/googletest
3880b13e4c0b Merge pull request #2042 from gennadiycivil/master
ade8baa7d213 clang-tidy: modernize-deprecated-headers
8369b5bbd0dd fixing build errors for unused parameter
b6cd405286ed Googletest export
644319b9f06f Merge pull request #2048 from ciband:chore/clang_tidy
216c37f057ae Googletest export
f31bf1d362af Googletest export
50f1a77955bd Merge pull request #2051 from enptfb55:master
7a7e2bba1d62 Googletest export
bc1023b4131c Googletest export
6693e85b0402 Merge branch 'master' of github.com:google/googletest
2edadcedf350 Workaround homebrew issue
0599a7b8410d Googletest export
097407fd3cfb Googletest export
9acd065a905a Googletest export
eb9225ce361a Googletest export
0adeadd28302 Googletest export
9518a57428ae Googletest export

Change-Id: I2029f907549bed52816fd3660be5b77ad19e73c9
Reviewed-on: https://chromium-review.googlesource.com/c/1427241
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2019-01-22 20:57:37 +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
Scott Graham
25048d37f8 fuchsia: Remove log.cpp and log.h
zx_log_ is being removed in favour of zx_debuglog_, and so log.h/cpp
will also be going.

Bug: fuchsia:ZX-2184
Change-Id: I4f342d05716745d1248fe1de6e7cd2f92ff1dea3
Reviewed-on: https://chromium-review.googlesource.com/c/1407534
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Scott Graham <scottmg@chromium.org>
2019-01-11 23:27:14 +00:00
Joshua Peraza
d079df5587 android: use the correct architecture macro
Bug: 912739
Change-Id: Ibc802ca2849ee89bd7965946297f3b0943cabfac
Reviewed-on: https://chromium-review.googlesource.com/c/1406867
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
2019-01-11 20:06:20 +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
Joshua Peraza
dc6dee855e android: use size_t to align
A uint8_t won't be bit-extended, zero-ing all the upper bits of value.

Change-Id: Iae41eeb4a014de5ed47ad599081959250a7bbe9c
Reviewed-on: https://chromium-review.googlesource.com/c/1405691
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
2019-01-11 16:14:10 +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
Vlad Tsyrklevich
e7895b4404 Include changes from chromium
These changes were made in the upstream version of crashpad without
being contributed back to crashpad.

Bug: crashpad:271
Change-Id: I60f6dfd206191e65bac41978a7c88d06b8c3cee9
Reviewed-on: https://chromium-review.googlesource.com/c/1389238
Commit-Queue: Vlad Tsyrklevich <vtsyrklevich@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2019-01-09 17:53:44 +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
Dave Moore
670dec4b61 [syscalls] Change references to ZX_VM_FLAG_* to ZX_VM_*
Test: Existing
Change-Id: I36fde186de372d2b86807f4da4e6e589a1b19706
Reviewed-on: https://chromium-review.googlesource.com/c/1395479
Reviewed-by: Scott Graham <scottmg@chromium.org>
Commit-Queue: Scott Graham <scottmg@chromium.org>
2019-01-07 20:47:19 +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
Vlad Tsyrklevich
bc1b4e833e Update comment to reflect current state
Bug: crashpad:270
Change-Id: I51869f3f613057f617d8f73ca6643bfe2ab75573
Reviewed-on: https://chromium-review.googlesource.com/c/1394154
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Vlad Tsyrklevich <vtsyrklevich@chromium.org>
2019-01-03 21:23:27 +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
Vlad Tsyrklevich
e5ff36fb95 Use CrashpadInfoReader in ModuleSnapshotWin
In preparation for deleting the custom CrashpadInfo reading routines in
the PEImageReader and also deleting the PEImageAnnotationsReader, this
change moves ModuleSnapshotWin to using the platform-independent
CrashpadInfoReader.

Bug: crashpad:270
Change-Id: Idad5de173200068243eacb2bb11b2d95b6438e90
Reviewed-on: https://chromium-review.googlesource.com/c/1388017
Commit-Queue: Vlad Tsyrklevich <vtsyrklevich@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2019-01-03 19:53:36 +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
760da9b96a Delete snapshot/api/module_annotations_win*
This API was added for Kasko several years ago but that project is
defunct and this API does not appear to be used elsewhere.

Bug: crashpad:270
Change-Id: I5a409deff7c5cf4f9f552893d4a49303f3000164
Reviewed-on: https://chromium-review.googlesource.com/c/1388022
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Vlad Tsyrklevich <vtsyrklevich@chromium.org>
2018-12-21 19:19:24 +00:00
Vlad Tsyrklevich
cc60f9329e Refactor PEImageAnnotationsReader test
In preparation for deleting the PEImageAnnotationsReader (and replacing
it with the generic ImageAnnotationsReader) change the
PEImageAnnotationsReader test to be a ModuleSnapshotWin test instead.
The tests are still useful for testing the annotations on the module
snapshot.

Bug: crashpad:270
Change-Id: Ibbbc69c72ca2eb98bfae9dc9b57bf28e9d3f12e2
Reviewed-on: https://chromium-review.googlesource.com/c/1388018
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Vlad Tsyrklevich <vtsyrklevich@chromium.org>
2018-12-21 15:50:44 +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
fccd9c09c0 Implement ProcessSnapshotMac::Memory()
Plumb ProcessReaderMac::Memory() through to ProcessSnapshotMac::Memory()
and add consts where necessary to accomodate the type signature of
ProcessSnapshot::Memory().

Bug: crashpad:263
Change-Id: I2608979918bc201ae3561483ea52ed2092cbc1e2
Reviewed-on: https://chromium-review.googlesource.com/c/1387924
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Vlad Tsyrklevich <vtsyrklevich@chromium.org>
2018-12-20 22:01:27 +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
Scott Graham
8b6f158d20 fuchsia: Include address space information in process snapshot
This plumbs some of the ZX_INFO_PROCESS_MAPS information out into
MINIDUMP_MEMORY_INFO. The mapping loses some information that Zircon
provides, and some of the data that Windows would provide isn't
available (for example, AllocationProtect). But this gives a general
idea of the memory layout of the process to check for bad pointers, etc.
when inspecting crashes.

Bug: fuchsia:DX-615
Change-Id: I2d7c02be0996672253cf0b1eb6a60b0a55e6033b
Reviewed-on: https://chromium-review.googlesource.com/c/1377089
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-12-14 21:39:06 +00:00
Eric Astor
067f7ddebf Fixes a potential testing crash.
Crashpad client testing no longer addresses an element of a possibly-
empty array.

Change-Id: I434b4b8c462894d8241b810973e1b4a87d1851ba
Reviewed-on: https://chromium-review.googlesource.com/c/1376375
Commit-Queue: Mark Mentovai <mark@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-12-13 19:03:54 +00:00