819 Commits

Author SHA1 Message Date
Mark Mentovai
ded751da3d doc: Update Doxyfile to 1.8.13
$ doxygen -u doc/support/crashpad.doxy
Configuration file `doc/support/crashpad.doxy' updated.
$ doxygen -v
1.8.13

Change-Id: I7b886e328aa1dbe91e314433c0e01acc0f18b314
Reviewed-on: https://chromium-review.googlesource.com/446598
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2017-02-23 15:19:31 +00:00
Mark Mentovai
4a2043ea65 Fix Chromium build with DPLOG_IF
Chromium has many build configurations. One important configuration
that’s not tested by its commit queue doesn’t use |condition| in
DLOG_IF(severity, condition) or any of the D*LOG_IF macros, resulting in
errors such as

…/handler/handler_main.cc:166:7: error: unused variable 'rv' [-Werror,-Wunused-variable]
  int rv = sigaction(sig, &sa, nullptr);
      ^

BUG=chromium:695314

Change-Id: I09a57379e8276b5ffa7f8f81706581a802d76809
Reviewed-on: https://chromium-review.googlesource.com/446559
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2017-02-23 14:53:10 +00:00
Mark Mentovai
6da9708e7c doc: Fix Doxygen errors
Change-Id: I5d5abf7b7eabe269a7c7b4d305a67fe910c887fd
Reviewed-on: https://chromium-review.googlesource.com/446480
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-02-23 01:43:40 +00:00
Mark Mentovai
9c84071237 Fix warning when building with clang on Windows
Change-Id: If9928d8ca3b12a260b97d522abfa7e3b5ff47831
Reviewed-on: https://chromium-review.googlesource.com/446418
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-02-23 01:42:24 +00:00
Mark Mentovai
c1af20f1aa metrics: Consistently comment about enums used for metrics
BUG=crashpad:100

Change-Id: I9ed0f260b4c92e7a706418f58c3db1ae027a04ab
Reviewed-on: https://chromium-review.googlesource.com/446557
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-02-23 00:13:04 +00:00
Mark Mentovai
f34ed66b93 metrics: Record handler lifetime milestone events
It could be useful to put our existing Crashpad.HandlerCrashed metrics
into context by getting a sense of handler starts, clean exits, and
other types of exits.

BUG=crashpad:100

Change-Id: I8982075158ea6d210eb2ddad678302e339a42192
Reviewed-on: https://chromium-review.googlesource.com/444124
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-02-22 18:48:12 +00:00
Mark Mentovai
4c6f6e52e2 Remove vestigial support for in-Chromium GYP build
Chromium’s GYP build has been removed. The support added to Crashpad’s
GYP build to integrate with Chromium’s is now unused and unnecessary.
Chromium builds Crashpad as part of its own GN build.

https://groups.google.com/a/chromium.org/d/topic/chromium-dev/NZkPr-CXvQ0

Change-Id: I30f2d3453f4476037c9afe0714a780456f0bbcd6
Reviewed-on: https://chromium-review.googlesource.com/444044
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2017-02-16 18:33:54 +00:00
Mark Mentovai
546e64cd0b Centrally define CPUContextX86::Fsave and fsave↔︎fxsave conversions
As I was finishing d98a4de718d9, it became evident that fsave
proliferation was becoming a problem. Especially considering tests,
there was much duplicated conversion code. This ties everything up
together in a central location.

test::BytesToHexString() is a new function to ease testing of byte
arrays like x87 registers, without having to loop over each byte.

Some static_asserts are added to verify that complex structures that
need to maintain interoperability don’t grow or shrink. This is used
to check the size of the fxsave and fsave structures, as well as the
MinidumpCPUContext* structures.

BUG=crashpad:162

Change-Id: I1a1be18096ee9be250cbfb2e006adfd08eba8753
Reviewed-on: https://chromium-review.googlesource.com/444004
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-02-16 18:26:13 +00:00
Mark Mentovai
0c322ecc3f Use zlib to gzip-compress uploads
This adds zlib to Crashpad. By default in standalone Crashpad builds,
the system zlib will be used where available. A copy of Chromium’s zlib
(currently a slightly patched 1.2.11) is checked out via DEPS into
third_party for use on Windows, which does not have a system zlib.

zlib is used to produce gzip streams for HTTP upload request bodies sent
by crashpad_handler by default. The Content-Encoding: gzip header is set
for these compressed request bodies. Compression can be disabled for
upload to servers without corresponding decompression support by
starting crashpad_handler with the --no-upload-gzip option.

Most minidumps compress quite well with zlib. A size reduction of 90% is
not uncommon.

BUG=crashpad:157
TEST=crashpad_util_test GzipHTTPBodyStream.*:HTTPTransport.*

Change-Id: I99b86db3952c3685cd78f5dc858a60b54399c513
Reviewed-on: https://chromium-review.googlesource.com/438585
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2017-02-16 16:26:19 +00:00
Mark Mentovai
d98a4de718 win: support native x86 CONTEXT structures with x87 but no SSE context
When no SSE (fxsave) context is available but x87 (fsave) context is, use the
x87 context.

This also embeds the x87 FPU opcode from the fxsave fop field in bits 16-26 of
the fsave error_selector field, true to the layout of the fsave structure. See
Intel SDM volume 1 (253665-061) 8.1.10 and figure 8-9.

BUG=crashpad:161
TEST=crashpad_snapshot_test CPUContextX86.*:CPUContextWin.*

Change-Id: I0bf7ed995c152f124166eaa20104d228d3468f76
Reviewed-on: https://chromium-review.googlesource.com/442144
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-02-15 17:39:50 +00:00
Erik Chen
c1b305244a Update mig.py to take an explicit sdk argument.
BUG=chromium:690734

> Review-Url: https://codereview.chromium.org/2685233002
> Cr-Commit-Position: refs/heads/master@{#449550}
> Message-Id: Merged from chromium 53f2146935506b4f382705b605dffec41b5519eb

Change-Id: I1b3176a4a62078f1e27184ad589c9c3f4b548674
Reviewed-on: https://chromium-review.googlesource.com/440847
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-02-10 18:14:10 +00:00
Mark Mentovai
1f82c6cc8a Ensure Content-Length does not appear with Transfer-Encoding
In the HTTPTransport test, verify the requirement of RFC 7230 §3.3.2
that Content-Length not appear if Transfer-Encoding is present.

TEST=crashpad_util_test HTTPTransport.*
BUG=crashpad:159

Change-Id: I51eafff9659443e1d9bb67d1213c8cecc757ded6
Reviewed-on: https://chromium-review.googlesource.com/439984
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2017-02-09 17:43:04 +00:00
Mark Mentovai
cd28471383 win: Implement Transfer-Encoding: chunked for HTTP requests
Chunked encoding doesn’t require the length of the request body to be
known in advance. In cases where this value isn’t independently known,
as is normal for Crashpad report uploads where the HTTP request body is
constructed on the fly, chunked encoding eliminates the need to prepare
the entire request body in memory before transmitting it. In these
cases, it’s much less wasteful.

When the length of the request body is known in advance, based on the
provision of a Content-Length header, chunked encoding is not used.
Even so, the request is sent in pieces rather than reading the entire
request into memory before sending anything.

BUG=crashpad:159
TEST=crashpad_util_test HTTPTransport.*

Change-Id: Iebb2b63b936065cb8c3c4a62b58f9c14fec43937
Reviewed-on: https://chromium-review.googlesource.com/439644
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-02-08 21:17:05 +00:00
Sigurdur Asgeirsson
6af23a933a Use best-effort allocation in ProcessInfo::BuildHandleVector.
BUG=crashpad:158

Change-Id: If8666140a7fc5315eeb791d0998226de89a22cc3
Reviewed-on: https://chromium-review.googlesource.com/438791
Reviewed-by: Mark Mentovai <mark@chromium.org>
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-02-08 20:20:46 +00:00
Mark Mentovai
88442dd578 Merge Chromium 294442c0ce05 upstream to Crashpad
Remove stl_util from Crashpad. This also updates mini_chromium to
4f3cfc8e7c2b7d77f94f41a32c3ec84a6920f05d to remove stl_util from there
as well.

4f3cfc8e7c2b Remove stl_util from mini_chromium

BUG=chromium:555865

Change-Id: I8ecb1639a258dd233d524834ed205a4fcc641bac
Reviewed-on: https://chromium-review.googlesource.com/438865
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-02-07 21:04:42 +00:00
Mark Mentovai
35020d8010 Update buildtools, mini_chromium, gtest, and gyp
Update buildtools to a7cc7a3e21a061975b33dcdcd81a9716ba614c3c

adb8bf4e8fc9 Roll gn 4838fe571d..2eb03fab2b (r411399:r411754)
347c89790b42 Roll gn 2eb03fab2b..71c9ade4e9 (r411754:r415392)
82d2a28e425b Roll gn 2eb03fab2b..fe79dde87a (r411754:r415725)
b97d6c93a3e8 Roll gn 2eb03fab2b..764c7362bc (r411754:r417994)
6115afa0ea5e Roll gn 764c7362bc..668b150d14 (r417994:r419236)
f8088e3792a7 Roll gn 668b150d14..6a1c8d418d (r419236:r419720)
57649e5e2001 Roll gn 6a1c8d418d..65f3a42b24 (r419720:r419871)
86f7e41d9424 roll clang-format 258123:282138
3d2e47bf14e4 Fix repo url, remove recursion reference in DEPS
5fd66957f08b Roll gn 65f3a42b24..82dfb24218 (r419871:r421311)
39b1db2ab4aa Roll gn b6c1d4353b..bdc8e1e447 (r421341:r422996)
1f985091a586 Roll clang-format 0ed791d..6a413e9
991f459071f9 Roll gn bdc8e1e447..000b1184a0 (r422996:r432866)
102c16366d8b libc++: Don't pass -pthread to link.
64e38f0cebdd Roll gn 000b1184a0..78660e873f (r432866:r436326)
55ad626b08ef Roll gn 78660e873f..8897c835c2 (r436326:r436733)
0ef801087682 Roll gn 8897c835c2..c99acd6557 (r436733:r439377)
8932ecfa420a Roll gn c99acd6557..b1f498915e (r439377:r441559)
7e08d331f188 Roll gn c99acd6557..5c18ca83ce (r439377:r442253)
005cae407b97 Roll gn c99acd6557..7a3be23857 (r439377:r442631)
9a947138bc58 Roll gn 5c18ca83ce..7c0e0135f9 (r442253:r443802)
cb12d6e8641f Roll gn 7c0e0135f9..b4dbf044c5 (r443802:r443809)
8e94621c369e Roll gn b4dbf044c5..f13158d3c5 (r443809:r445411)
a7cc7a3e21a0 Roll gn f13158d3c5..d8754536ca (r445411:r446079)

Update mini_chromium to e504d59673e56887a4e837cbeb44b32ec21974f9

cae485daae70 win: Initial version of toolchain for GN
57f426502e00 Enable thread-safe statics when building with GCC and clang
e504d59673e5 Remove now-unused LazyInstance

Update gtest to d62d6c6556d96dda924382547c54a4b3afedb22c

9759dcda3c2f Fix compilation on MinGW with native threads
a138385e48ee Don't use pthread when on MinGW even if available
3429113886a9 Fix a test to compile when tuple isn't available
ed9d1e1ff92c Merge pull request #721 from ilmagico/fix-mingw-threads
d8fe70f477d8 Fix build with MinGW-w64
48ee8e98abc9 Merge pull request #856 from KindDragon/mingw-appveyor
10ff7f946863 Fixing relative links
16d6af7d414a Relative links
51b290d41e5d One works
9cb03aa70223 Fixing ForDummies link
f5c0130e88a3 Broken relative links fixed
995db996dee6 Fixing KnownIssues and FrequentlyAskedQuestions links
960a511f45be Fixing relative links
0e0ff5c3410f blob vs tree
32b4a9b39079 Fixed broken links
8ce0b5907cd9 Cookbok: fix broken relative link
ecd530865cef Merge pull request #876 from marco-m/patch-1
4eafafbde585 Fix detection of GTEST_HAS_CLONE for Android
3447fc31b4ee Merge pull request #728 from DanAlbert/tuple-stlport
a2b8a8e07628 Merge pull request #918 from
             DanAlbert/fix-android-GTEST_HAS_CLONE
cb502b7ad15c Added CMake configure-time download instructions to docs
c0059a79f82d 2.6.4 is the minimum CMake version, so enforce it (#656)
5e7fd50e17b6 Merge pull request #658 from
             audiofanatic/ExternalProject_at_configure_time
06a81e9357b6 Add GTEST_ATTRIBUTE_UNUSED_ to REGISTER_TYPED_TEST_CASE_P
3134af23d713 Merge pull request #1 from google/master
9ae086a9ebaf Merge pull request #874 from sejr/master
d62d6c6556d9 Merge pull request #982 from mbjorge/unused-variable-fix

Update gyp to a7055b3989c1074adca03b4b4829e7f0e57f6efd

702ac58e4772 Add new target type called windows_driver. * Modify GYP to
             set the PlatformToolset, the DriverType and the
             TargetVersion * Add msvs_target_version configuration
5dc5a5b1718e fix common "NameError"s
920ee58c3d31 Hash intermediate file name to avoid ENAMETOOLONG
ef2f29a7311b msvs: Allow target platform version without WinRT
940a15ee3f1c Update shared library extension on AIX to .a.
9733aa652da4 Set up a CQ for gyp
a7055b3989c1 Make Gerrit the default code review system for gyp

Change-Id: I11d8139b0f533911692dc7a11bb9edaddac78060
Reviewed-on: https://chromium-review.googlesource.com/438885
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-02-07 19:35:41 +00:00
Mark Mentovai
b638163e72 Report time zones with no DST transition within a year as not observing
In locations where daylight saving time was once observed or is expected
to be observed in the future, but where no transitions to or from
daylight saving time occurred or will occur within a year of the current
date, act as though DST is not being observed at all.

Set TZ=America/Phoenix to test for this bug.

BUG=crashpad:130
TEST=crashpad_snapshot_test SystemSnapshotMacTest.TimeZone

Change-Id: Ie466b5906eab3c0cf2e51b962a171acb5b16210b
Reviewed-on: https://chromium-review.googlesource.com/438004
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2017-02-07 19:00:44 +00:00
Mark Mentovai
594eb43b58 mac: Make 64-bit handler able to read 32-bit module lists
The 32-bit process_types definition of dyld_all_image_infos winds up
with four extra bytes of tail padding when built into a 64-bit
crashpad_handler compared to a 32-bit one, and compared to the
structure’s native size. This prevents a 64-bit crashpad_handler from
being able to create a module snapshot of a 32-bit process for
dyld_all_image_infos versions 14 (since 10.9) and 15 (since 10.12).

Work around this by placing a zero-length “end” marker and using
offsetof(dyld_all_image_infos, end) in preference to
sizeof(dyld_all_image_infos).

BUG=crashpad:156,crashpad:148,crashpad:120
TEST=crashpad_snapshot_test ProcessTypes.DyldImagesSelf,
     run_with_crashpad --handler=crashpad_handler{,32} builtin_trap{,32}

Change-Id: I406ad53851b5bd29ec802b7ad3073836ebe8c34c
Reviewed-on: https://chromium-review.googlesource.com/437924
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2017-02-07 18:58:39 +00:00
Mark Mentovai
948fd2d019 mac: Report a metric for handler crashes
This installs signal handlers in the crashpad_handler process to log
these crashes via the Crashpad.HandlerCrash.ExceptionCode.Mac histogram.
This is roughly the same mechanism that’s used for Windows.

The signal handler tries fairly hard to avoid swallowing signals, so
that things appear to outside observers (including debuggers and crash
handlers) identically to how they would look if no signal handler was
present.

The signal handler uses a different mapping schema than the existing
Crashpad.ExceptionCode.Mac histogram for reasons explained in code
comments. Because the mappings should not overlap, the new values may be
added to the existing CrashpadMacExceptionCodes enum.

BUG=crashpad:100

Change-Id: I9b8bda1c59d0a180501c285cdc672840a54f5efc
Reviewed-on: https://chromium-review.googlesource.com/435451
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2017-02-07 18:55:57 +00:00
Scott Graham
7050c55fca Remove LazyInstance usage
R=mark@chromium.org
BUG=chromium:686866

Change-Id: I067988694f15d93b064d0b10b1bc5b908c9e5f52
Reviewed-on: https://chromium-review.googlesource.com/435441
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-01-31 22:26:33 +00:00
Mark Mentovai
56020daea9 ExceptionTypes test: test “naked” signals
Since it’s possible to receive an EXC_CRASH for any signal that
generates a core by default even if the signal did not originate from a
Mach exception, update the tests to ensure that all such signals can be
unwrapped from an exception properly. This happens when a signal such as
SIGSEGV is sent with kill(), for example.

Change-Id: I1ee32cc6943f21ae349fa6788430d074acff9ed8
Reviewed-on: https://chromium-review.googlesource.com/434717
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2017-01-30 16:13:53 +00:00
Mark Mentovai
3e5ae2dc87 Update comments in IsExceptionNonfatalResource() given 10.12 source
With reference to 10.12 source, commentary regarding RESOURCE_TYPE_IO
can be authoritative.

Cursory examination of 10.12 source reveals that RESOURCE_TYPE_MEMORY
can now be fatal, although deeper examination reveals that this is
impossible on macOS. State this authoritatively as well.

BUG=crashpad:124

Change-Id: I52124c68fe017015983ab46e54006ba97ecd0142
Reviewed-on: https://chromium-review.googlesource.com/434297
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2017-01-30 14:39:27 +00:00
Mark Mentovai
1e4be91918 mac: Faster bit testing for EXC_GUARD exception “flavors”
After e7630628e9c9, I thought “isn’t there a standard library function
for that?” There is!

Change-Id: I284c7fdf8535c4fc53100e80fceb363bf2afee93
Reviewed-on: https://chromium-review.googlesource.com/431856
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-01-24 19:00:34 +00:00
Mark Mentovai
e7630628e9 mac: Report richer exception codes via metrics
Previously, only the top-level exception code was reported via the
Crashpad.ExceptionCode.Mac histogram. Making this histogram work
(https://crbug.com/678720) has revealed that Chrome is triggering
EXC_RESOURCE exceptions at a rate in excess of 4x that of ordinary
crashes. These exceptions were not previously visible because they are
not uploaded unless the system treats them as fatal, which it does not
normally do absent an explicit request.

In order to learn more about the problem, this change augments the data
reported via the Crashpad.ExceptionCode.Mac histogram to report (at
least) second-level exception data. This means that we will no longer
see just EXC_RESOURCE, but potentially more useful information such as
EXC_RESOURCE / RESOURCE_TYPE_IO / FLAVOR_IO_PHYSICAL_WRITES. This also
applies to other exception types, so that the majority of crashes
currently falling into the EXC_CRASH bucket will now have additional
information decoded and will be reported as, for example, EXC_BAD_ACCESS
/ KERN_INVALID_ADDRESS, EXC_BAD_INSTRUCTION / EXC_I386_INVOP, and
EXC_CRASH / SIGABRT.

Because the old mechanism was only live (in an “it works” sense) for
several days, and the new mechanism does not overlap with histogram
values used by the old one, there’s no need to invent a new histogram
name.

BUG=chromium:684051

Change-Id: Ia0a372b4127f7b3b2e7dbbaac9304cce3b5aadfe
Reviewed-on: https://chromium-review.googlesource.com/430933
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-01-24 15:59:30 +00:00
Scott Graham
f9b3a18f3f Use DEPS hooks to get gn binaries from buildtools
Otherwise:
  [2d68949...]D:\src\crashpad\crashpad>gn gen out\Debug
  gn.py: Could not find gn executable at: D:\src\crashpad\buildtools\win\gn.exe

I have no idea why these binaries aren't just checked into buildtools,
but anyway.

BUG=crashpad:79

Change-Id: If2f21a7e7f795910809de7d3595ab6a5ffee9dc7
Reviewed-on: https://chromium-review.googlesource.com/424847
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-01-05 21:48:13 +00:00
Scott Graham
2d68949f7f Pull LLVM/Clang/LLDB into third_party
This might feel a bit premature, but I feel fairly confident that basing
a lot of the processing on LLDB is the way to go, so I plan to start by
integrating it into our build process.

(I think probably moving from gyp to GN first makes sense, so I can defer
landing this until after that's farther along if you like.)

BUG=crashpad:29

Change-Id: I85ee44f4e777f9d7ce521c4caf10ead21ffd8818
Reviewed-on: https://chromium-review.googlesource.com/424910
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-01-05 02:57:42 +00:00
Scott Graham
0567536f86 win: Attempt to fix unloaded modules list by using RtlGetUnloadEventTraceEx
I haven't been able to reproduce this locally, but we see errors in
crash dumps where the unloaded module list consists of a number of
modules with invalid names and implausible addresses. My assumption is
that RTL_UNLOAD_EVENT_TRACE isn't correct for some OS levels. Instead of
trying to finesse and test that, use RtlGetUnloadEventTraceEx() instead
of RtlGetUnloadEventTrace(), which returns an element size. (This
function is Vista+ which is why it wasn't used the first time around.)

R=mark@chromium.org
BUG=chromium:620175

Change-Id: I4d7080a03623276f9c1c038d6e7329af70e4a64c
Reviewed-on: https://chromium-review.googlesource.com/421564
Reviewed-by: Mark Mentovai <mark@chromium.org>
2016-12-16 20:32:25 +00:00
Sigurdur Asgeirsson
2e80cb7cb4 win: Delegate to previous UEF on exception
Change-Id: I02f6d048d8a51797f93794ecc761f4fc8ba139a7
Reviewed-on: https://chromium-review.googlesource.com/420849
Reviewed-by: Mark Mentovai <mark@chromium.org>
2016-12-15 20:06:02 +00:00
Scott Graham
cdbb90ec69 win: Add timeout argument to WaitForHandlerStart()
As brought up in https://codereview.chromium.org/2475863004/, there's
the potential for failed startup if StartHandlerProcess() hangs for
whatever reason. Add a timeout to the wait function so that this case
can attempt to log an error.

R=mark@chromium.org
BUG=655788, 656800, 565063

Change-Id: Ib08cd0641daa6a6cefabb773ffe470227b51958c
Reviewed-on: https://chromium-review.googlesource.com/419060
Reviewed-by: Mark Mentovai <mark@chromium.org>
2016-12-13 16:47:34 +00:00
Scott Graham
32981a3ee9 win: Fix clang warning in SECURITY_DESCRIPTOR construction
c:\src\cr\src\third_party\crashpad\crashpad\util\win\registration_protocol_win.cc(193,23):  error: suggest braces around initialization of subobject [-Werror,-Wmissing-braces]
                      SECURITY_MANDATORY_LABEL_AUTHORITY,
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
c:\src\depot_tools\win_toolchain\vs_files\d5dc33b15d1b2c086f2f6632e2fd15882f80dbd3\win_sdk\Include\10.0.10586.0\um\winnt.h(9068,54):  note: expanded from macro 'SECURITY_MANDATORY_LABEL_AUTHORITY'
                                                     ^~~~~~~~~~~~
1 error generated.

R=mark@chromium.org
BUG=chromium:656800

Change-Id: I1121a42ca98d8a7432e247d4b44a9ad1214d4b39
Reviewed-on: https://chromium-review.googlesource.com/418010
Reviewed-by: Mark Mentovai <mark@chromium.org>
2016-12-08 18:12:04 +00:00
Scott Graham
6b09b08a22 Update util/file/string_file.cc for new base/numerics API
The code was not incorrect before, but this expression is simpler.
Upstream of change made at https://codereview.chromium.org/2528243002.

R=mark@chromium.org
BUG=chromium:668713

Change-Id: Idae36bd8312666a3254eda02713869776fec0248
Reviewed-on: https://chromium-review.googlesource.com/417981
Reviewed-by: Mark Mentovai <mark@chromium.org>
2016-12-07 22:59:35 +00:00
Scott Graham
f66d5df30c Roll mini_chromium to de1afb0
> git log 414d596..de1afb0 --oneline
de1afb0 Update base/numerics from Chromium
ca7f42a Improve the Win32/x64 configuration when generating MSVS projects
c1f7a2c Create initial GN configuration for mini_chromium.

R=mark@chromium.org

Change-Id: I309fe722c18764c9a85e9c6e212f39bf07fe3b02
Reviewed-on: https://chromium-review.googlesource.com/417770
Reviewed-by: Mark Mentovai <mark@chromium.org>
2016-12-07 22:52:56 +00:00
Scott Graham
556c4e4f50 Have crashpad call ASan's crash handler if present
Upstreaming change made downstream in
https://codereview.chromium.org/2504773002. Formatting modified
slightly.

R=mark@chromium.org, rnk@chromium.org
BUG=661209

Change-Id: Iab8c4ffda3af24b7a61ec0a4a10b187966da481f
Reviewed-on: https://chromium-review.googlesource.com/417237
Reviewed-by: Mark Mentovai <mark@chromium.org>
2016-12-07 22:03:52 +00:00
Scott Graham
f94dd14c45 win: fix SECURITY_DESCRIPTOR builder on vs2013
After https://chromium.googlesource.com/crashpad/crashpad/+/5b83e587.

R=mark@chromium.org
BUG=chromium:655788,chromium:656800

Change-Id: Ic33b9daedc340bfce3cc4ddde4eb4c93f68e7ad0
Reviewed-on: https://chromium-review.googlesource.com/417412
Reviewed-by: Mark Mentovai <mark@chromium.org>
2016-12-07 21:51:57 +00:00
Scott Graham
5b83e58771 win: Remove use of rpcrt4 and advapi32 from some util code
ConvertStringSecurityDescriptorToSecurityDescriptor() is used when
creating the initial connection pipe. Because this is done from inside
DllMain(), we cannot use advapi32 (where this function is). Instead,
save the binary representation of the self-relative SECURITY_DESCRIPTOR.
It is conceivable that this could change, but unlikely as this is the
same blob that would be stored on a file in NTFS.

Another potential approach would be to not make the pipe available to
all integrity levels here, and instead modify the Chromium sandbox code
to allow a specific pipe name prefix that would have to correspond with
the pipe name that Crashpad creates.

Similarly, UuidCreate() (used when initializing the database) is in a
DLL that can't be loaded early, so use the Linux/Android implementation
on Windows too.

R=mark@chromium.org
BUG=chromium:655788,chromium:656800

Change-Id: I434f8e96fc275fc30d0a31208b025bfc08595ff9
Reviewed-on: https://chromium-review.googlesource.com/417223
Reviewed-by: Mark Mentovai <mark@chromium.org>
2016-12-07 20:03:45 +00:00
Mark Mentovai
777634b1eb Use ADDRESS_SANITIZER instead of __has_feature(address_sanitizer)
__has_feature() is a Clang-ism not implemented by GCC.
base/compiler_specific.h provides a HAS_FEATURE() macro that always
returns 0 when __has_feature() is not implemented. Use this macro for
compatibility with GCC and other compilers that do not implement this
Clang extension.

http://clang.llvm.org/docs/LanguageExtensions.html#has-feature-and-has-extension

For GCC’s Address Sanitizer implementation, test the
__SANITIZE_ADDRESS__ macro that it provides as an alternative to
__has_feature(address_sanitizer).

Note that in Chrome builds, ADDRESS_SANITIZER is pushed in by the build
system. The definition of ADDRESS_SANITIZER provides another way for
that macro to be set. It’s supplementary, not exclusive.

cb33b24372/build/config/BUILD.gn (118)

BUG=crashpad:30

Change-Id: I5c3145d29bbc966925369c03a37b1ecb5622a004
Reviewed-on: https://chromium-review.googlesource.com/413109
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2016-11-22 19:28:06 +00:00
Scott Graham
68095b6a4e Don't LOG(ERROR) for usage, and fix VS2013 build after 8b3eec8
R=mark@chromium.org
BUG=crashpad:57

Change-Id: I6514a82ae5de38a695422ef86c044ec3b2ce171b
Reviewed-on: https://chromium-review.googlesource.com/412269
Reviewed-by: Mark Mentovai <mark@chromium.org>
2016-11-17 22:59:17 +00:00
Scott Graham
8b3eec83e9 win: Add signal handler for SIGABRT to handle abort() calls
R=mark@chromium.org
BUG=crashpad:57

Change-Id: Ib7141f00e74e3db9e5be427cc990847331e09912
Reviewed-on: https://chromium-review.googlesource.com/412058
Reviewed-by: Mark Mentovai <mark@chromium.org>
2016-11-17 22:00:38 +00:00
Mark Mentovai
5a21fc1573 Fix Windows build after f09d0cde00a1
While building crashpad_database_util.cc:

…\crashpad\tools\crashpad_database_util.cc(150) : error C3861: 'gettimeofday': identifier not found

util/win/time.h has its own GetTimeOfDay() to provide this missing
function on Windows. I don’t know why it’s not in compat. Even so, it
doesn’t return a value, so it’d be unsuitable for use in the PCHECK().
Go back to time() with an errno test.

While building string_number_conversion_test.cc:

…\crashpad\util\stdlib\string_number_conversion_test.cc(242) : error C2220: warning treated as error - no 'object' file generated
…\crashpad\util\stdlib\string_number_conversion_test.cc(242) : warning C4146: unary minus operator applied to unsigned type, result still unsigned
…\crashpad\util\stdlib\string_number_conversion_test.cc(243) : warning C4146: unary minus operator applied to unsigned type, result still unsigned
…\crashpad\util\stdlib\string_number_conversion_test.cc(244) : warning C4146: unary minus operator applied to unsigned type, result still unsigned

Use INT64_C(), and remove a duplicate test case.

Change-Id: I308db9856e492604c7462238cb8b7b66731f0cfe
Reviewed-on: https://chromium-review.googlesource.com/411331
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2016-11-15 19:16:48 +00:00
Mark Mentovai
f09d0cde00 Improve time handling and error checking
The database settings object’s last_upload_attempt_time (time_t) field
is switched from uint64_t to int64_t, for better compatibility with
time_t, which is normally a signed type. This change should be
transparent, as there should be no valid high-bit-set 64-bit timestamps
in this field in the wild.

A number of improvements are made to crashpad_database_util’s time
handling. Errors are checked during time conversion.
--set-last-upload-attempt-time=now is a new supported (and documented)
option.

A StringToNumber() overload for int64_t, along with a test, is added to
aid in crashpad_database_util’s time conversions from numeric strings. A
test is also added for the previously-untested uint64_t implementation.

TEST=crashpad_util_test StringNumberConversion.*

Change-Id: I089c4bf7b95f5df0982bdbb3c27b4f6a89db966e
Reviewed-on: https://chromium-review.googlesource.com/410068
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2016-11-15 18:53:11 +00:00
Mark Mentovai
b37aa95da7 MSVC++ fix: ALLOW_UNUSED_LOCAL variables only used in static_assert
After f83530bf9a0b and 72fbc56e58d3, while compiling
arraysize_unsafe_test.cc:

…\crashpad\util\misc\arraysize_unsafe_test.cc(58) : error C2220: warning treated as error - no 'object' file generated
…\crashpad\util\misc\arraysize_unsafe_test.cc(58) : warning C4101: 's10' : unreferenced local variable
…\crashpad\util\misc\arraysize_unsafe_test.cc(33) : warning C4101: 'i1' : unreferenced local variable
…\crashpad\util\misc\arraysize_unsafe_test.cc(24) : warning C4101: 'c1' : unreferenced local variable
…\crashpad\util\misc\arraysize_unsafe_test.cc(27) : warning C4101: 'c2' : unreferenced local variable
…\crashpad\util\misc\arraysize_unsafe_test.cc(55) : warning C4101: 's1' : unreferenced local variable
…\crashpad\util\misc\arraysize_unsafe_test.cc(39) : warning C4101: 'i4' : unreferenced local variable
…\crashpad\util\misc\arraysize_unsafe_test.cc(45) : warning C4101: 'l9' : unreferenced local variable
…\crashpad\util\misc\arraysize_unsafe_test.cc(30) : warning C4101: 'c4' : unreferenced local variable
…\crashpad\util\misc\arraysize_unsafe_test.cc(42) : warning C4101: 'l8' : unreferenced local variable
…\crashpad\util\misc\arraysize_unsafe_test.cc(36) : warning C4101: 'i2' : unreferenced local variable

The line numbers are totally out of order!

I think that my error was not actually ever running “gclient runhooks”,
so I never tested this locally on Windows as I thought I had.

https://build.chromium.org/p/client.crashpad/builders/crashpad_win_x64_dbg/builds/266/steps/compile%20with%20ninja/logs/stdio

TBR=scottmg@chromium.org (holiday)

Change-Id: I00414b54c04b5b7e3aa564b0c6fd49d20a47b6ea
Reviewed-on: https://chromium-review.googlesource.com/410129
Reviewed-by: Mark Mentovai <mark@chromium.org>
2016-11-11 18:07:16 +00:00
Mark Mentovai
72fbc56e58 MSVC++ fix: Don’t declare local[0] arrays for ARRAYSIZE_UNSAFE test
After f83530bf9a0b, while compiling arraysize_unsafe_test.cc:

…\crashpad\util\misc\arraysize_unsafe_test.cc(24) : error C2466: cannot allocate an array of constant size 0
…\crashpad\util\misc\arraysize_unsafe_test.cc(24) : error C2133: 'c0' : unknown size
…\crashpad\util\misc\arraysize_unsafe_test.cc(25) : error C2070: 'char []': illegal sizeof operand
…\crashpad\util\misc\arraysize_unsafe_test.cc(36) : error C2466: cannot allocate an array of constant size 0
…\crashpad\util\misc\arraysize_unsafe_test.cc(36) : error C2133: 'i0' : unknown size
…\crashpad\util\misc\arraysize_unsafe_test.cc(37) : error C2070: 'int []': illegal sizeof operand
…\crashpad\util\misc\arraysize_unsafe_test.cc(61) : error C2466: cannot allocate an array of constant size 0
…\crashpad\util\misc\arraysize_unsafe_test.cc(61) : error C2133: 's0' : unknown size
…\crashpad\util\misc\arraysize_unsafe_test.cc(62) : error C2070: 'crashpad::test::`anonymous-namespace'::ArraySizeUnsafe_ArraySizeUnsafe_Test::TestBody::S []': illegal sizeof operand

MSVC++ 2015 (14.0) doesn’t mind, and I thought that testing that version
would be enough, but the Crashpad buildbots still run MSVC++ 2013
(12.0), which doesn’t like this construct.

https://build.chromium.org/p/client.crashpad/builders/crashpad_win_x64_dbg/builds/265/steps/compile%20with%20ninja/logs/stdio

TBR=scottmg@chromium.org (holiday)

Change-Id: Ia8d140ceda3cd1bdec09c78560377b9bfad84dc4
Reviewed-on: https://chromium-review.googlesource.com/410128
Reviewed-by: Mark Mentovai <mark@chromium.org>
2016-11-11 17:54:08 +00:00
Mark Mentovai
f83530bf9a GCC fix: Don’t use arraysize() on packed structs
While compiling, for example, minidump_exception_writer.cc:

In file included from ../../minidump/minidump_exception_writer.h:26:0,
                 from ../../minidump/minidump_exception_writer.cc:15:
../../minidump/minidump_exception_writer.cc: In member function ‘void crashpad::MinidumpExceptionWriter::SetExceptionInformation(const std::vector<long unsigned int>&)’:
../../minidump/minidump_exception_writer.cc:67:44: error: cannot bind packed field ‘((crashpad::MinidumpExceptionWriter*)this)->crashpad::MinidumpExceptionWriter::exception_.MINIDUMP_EXCEPTION_STREAM::ExceptionRecord.MINIDUMP_EXCEPTION::ExceptionInformation’ to ‘long unsigned int (&)[15]’
       arraysize(exception_.ExceptionRecord.ExceptionInformation);
                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~^
../../third_party/mini_chromium/mini_chromium/base/macros.h:41:50: note: in definition of macro ‘arraysize’
 #define arraysize(array) (sizeof(ArraySizeHelper(array)))

Tested with:
 - GCC 4.9 from NDK r13 targeting arm with SDK 16
 - GCC 4.9 from NDK r13 targeting arm64 with SDK 21
 - GCC 6.2 targeting x86_64

BUG=crashpad:30

Change-Id: I63963b277a309b4715148215f51902c33ba13b5a
Reviewed-on: https://chromium-review.googlesource.com/409694
Reviewed-by: Scott Graham <scottmg@chromium.org>
2016-11-11 17:38:01 +00:00
Mark Mentovai
57b2210ed7 GCC fix: Make UUID POD
This eliminates all constructors, but nearly all points of use were
using the default constructor to initialize a UUID member variable as in
uuid_(). This syntax will still produce a zeroed-out UUID.

While compiling, for example, minidump_rva_list_writer.cc:

In file included from ../../minidump/minidump_rva_list_writer.h:25:0,
                 from ../../minidump/minidump_rva_list_writer.cc:15:
../../minidump/minidump_extensions.h:412:8: error: ignoring packed attribute because of unpacked non-POD field ‘crashpad::UUID crashpad::MinidumpCrashpadInfo::report_id’ [-Werror]
   UUID report_id;
        ^~~~~~~~~
../../minidump/minidump_extensions.h:424:8: error: ignoring packed attribute because of unpacked non-POD field ‘crashpad::UUID crashpad::MinidumpCrashpadInfo::client_id’ [-Werror]
   UUID client_id;
        ^~~~~~~~~

Tested with:
 - GCC 4.9 from NDK r13 targeting arm with SDK 16
 - GCC 4.9 from NDK r13 targeting arm64 with SDK 21
 - GCC 6.2 targeting x86_64

BUG=crashpad:30

Change-Id: Iec6b1557441b69d75246f2f75c59c4158fb7ca29
Reviewed-on: https://chromium-review.googlesource.com/409641
Reviewed-by: Scott Graham <scottmg@chromium.org>
2016-11-11 17:37:14 +00:00
Mark Mentovai
5b14b41992 GCC fix: Don’t name a method exactly the same as its return type
While compiling, for example,
minidump_simple_string_dictionary_writer.cc:

In file included from
../../minidump/minidump_module_crashpad_info_writer.cc:21:0:
../../minidump/minidump_simple_string_dictionary_writer.h:55:45: error:
declaration of ‘const crashpad::MinidumpSimpleStringDictionaryEntry*
crashpad::MinidumpSimpleStringDictionaryEntryWriter::MinidumpSimpleStringDictionaryEntry()
const’ [-fpermissive]
       MinidumpSimpleStringDictionaryEntry() const;
                                             ^~~~~
In file included from
../../minidump/minidump_module_crashpad_info_writer.h:25:0,
                 from
../../minidump/minidump_module_crashpad_info_writer.cc:15:
../../minidump/minidump_extensions.h:255:26: error: changes meaning of
‘MinidumpSimpleStringDictionaryEntry’ from ‘struct
crashpad::MinidumpSimpleStringDictionaryEntry’ [-fpermissive]
 struct ALIGNAS(4) PACKED MinidumpSimpleStringDictionaryEntry {
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Tested with:
 - GCC 4.9 from NDK r13 targeting arm with SDK 16
 - GCC 4.9 from NDK r13 targeting arm64 with SDK 21
 - GCC 6.2 targeting x86_64

BUG=crashpad:30

Change-Id: I1e5e6a21a24f19eef7602e4123459ce15f3b089e
Reviewed-on: https://chromium-review.googlesource.com/409624
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2016-11-11 17:36:17 +00:00
Mark Mentovai
dd85381a32 GCC fix: Disable -Wmultichar warning throughout Crashpad
-Wmultichar is enabled by default with GCC (but not clang). It is
impossible to disable this warning with #pragma GCC diagnostic ignored.
See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53431

While compiling, for example, minidump_file_writer.cc:

In file included from ../../minidump/minidump_extensions.h:25:0,
                 from ../../minidump/minidump_file_writer.h:27,
                 from ../../minidump/minidump_file_writer.cc:15:
../../util/misc/pdb_structures.h:45:38: error: multi-character character constan
t [-Werror=multichar]
   static const uint32_t kSignature = '01BN';
                                      ^~~~~~
../../util/misc/pdb_structures.h:106:38: error: multi-character character consta
nt [-Werror=multichar]
   static const uint32_t kSignature = 'SDSR';
                                      ^~~~~~
../../minidump/minidump_file_writer.cc:190:23: error: multi-character character
constant [-Werror=multichar]
   header_.Signature = MINIDUMP_SIGNATURE;
                       ^~~~~~~~~~~~~~~~~~

doc/developing.md is also updated to provide GCC build instructions for
Android.

Tested with:
 - GCC 4.9 from NDK r13 targeting arm with SDK 16
 - GCC 4.9 from NDK r13 targeting arm64 with SDK 21
 - GCC 6.2 targeting x86_64

BUG=crashpad:30

Change-Id: I9e7993761f5461281c9f4d8b4c56e8407e2c5b47
Reviewed-on: https://chromium-review.googlesource.com/409776
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2016-11-11 17:35:25 +00:00
Mark Mentovai
1382618fbe Provide backup #defines for things introduced in SDK 10.0.10240.0
This follows discussion on
https://chromium-review.googlesource.com/409098/.

Change-Id: Ic82b64a14bb89cfdf1c88b1482cc2c2c9c0c2589
Reviewed-on: https://chromium-review.googlesource.com/409604
Reviewed-by: Scott Graham <scottmg@chromium.org>
2016-11-10 01:50:17 +00:00
Mark Mentovai
741c9cc51e mac: Deal with bootstrap_look_up() race encountered on 10.12.1
bootstrap_look_up() “successfully” returns MACH_PORT_DEAD about half of
the time on 10.12.1 16B2657 (xnu-3789.21.4). Replace that with
MACH_PORT_NULL in the BootstrapLookUp() wrapper that all callers are
already routed through.

BUG=crashpad:139
TEST=crashpad_util_test MachExtensions.BootstrapCheckInAndLookUp

Change-Id: I9a39b709add5ca7e64bb5b970ed6ba3fdfd1d47a
Reviewed-on: https://chromium-review.googlesource.com/409671
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2016-11-09 22:06:23 +00:00
Mark Mentovai
3abde199a7 minidump: fix tests to expect new rdtscp bit after 5c44f1d14f1c
TEST=crashpad_minidump_test
       MinidumpSystemInfoWriter.InitializeFromSnapshot_AMD64

Change-Id: I2fdd2061626a9f906eab025eeb8191d680196109
Reviewed-on: https://chromium-review.googlesource.com/409612
Reviewed-by: Scott Graham <scottmg@chromium.org>
2016-11-09 21:07:58 +00:00
Mark Mentovai
5c44f1d14f Indicate rdtscp availability in MINIDUMP_SYSTEM_INFO of x86_64 minidumps
This exposes a bit for PF_RDTSCP_INSTRUCTION_AVAILABLE in
CPU_INFORMATION::OtherCpuInfo::ProcessorFeatures. This bit was
introduced in Windows 10.

Change-Id: I464c308f8325d14c0839f609ea4260737a58f7a5
Reviewed-on: https://chromium-review.googlesource.com/409138
Reviewed-by: Scott Graham <scottmg@chromium.org>
2016-11-09 18:23:21 +00:00