Standalone Crashpad for Android can now be built with gn.
Change-Id: I0ee7f8e1af8c2bc0edb88e93b345abd7d739f33c
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3034984
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Remove unneeded base/strings/stringprintf.h includes.
ARCH_CPU_X86_64 macro is used without including build/build_config.h
Missing base/check.h
Change-Id: Ib7864ab7b30ef8fc37649783f7b90b618d0d6a0b
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2920552
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Chromium moved base::size() to base/cxx17_backports.h, so do the same in
mini_chromium and update the users in Crashpad.
Roll mini_chromium to 2f06f83f to make the new base header available.
Bug: chromium:1210983
Change-Id: Ie3dc4c189dcdfcac030b95fe285f94abb29a27bf
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2917779
Commit-Queue: Lei Zhang <thestig@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
Move some common files out of client and handler for iOS usage.
Bug: crashpad: 31
Change-Id: I1933eaaa7580a81017c52b77dfb636a8fa31ee78
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2851059
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Justin Cohen <justincohen@chromium.org>
LogOutputStreamTest.{WriteAbort,FlushAbort} are flaky because the logcat
is sometimes overloaded earlier than expected causing FlushAbort to fail
during Write() or either test to fail to write the abort message.
This change updates LogOutputStream to detect logcat overloads (EAGAIN)
and make one attempt at writing the abort message, even if the output
cap hasn't been reached.
This change also updates LogOutputStream's interface to defer log writes
to a Delegate. In tests, the Delegate implements a mock log and in
production, writes to Android's logcat.
I've removed VerifyGuards because LogOutputStream no longer writes
guards if Write() has never been called and the guards are tested in
other tests.
Change-Id: Icad83524aaf573c3e082469f1de095b6ca2c4839
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2439641
Reviewed-by: Mark Mentovai <mark@chromium.org>
Depends on https://chromium-review.googlesource.com/c/chromium/mini_chromium/+/2424890
Although logging to files is not yet supported by mini_chromium, it is
the default behavior for OS_WIN in chromium. This change should
cause crashpad to log via OutputDebugString() on Windows, instead of
debug.log files. Future work (crbug.com/crashpad/26) should arrange for
logs to be uploaded with reports, embedded in associated minidumps or as
file attachments.
Bug: chromium:711159
Change-Id: I0f9004f7de94dd29d555cc7d23c48a63da6b4bba
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2425108
Reviewed-by: Mark Mentovai <mark@chromium.org>
Includes DEPS roll of mini_chromium:
f0bd14b Pull build_config.h source set into separate build file
65fb5c9 Update path to win_helper after moving to build/config
Change-Id: Ic9f5c68e2cebd8bf86492766684bdb422da1aa9e
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2426989
Reviewed-by: Mark Mentovai <mark@chromium.org>
This change prepares crashpad for the upcoming switch of base::string16
to std::u16string on all platforms. It does so by replacing Windows-only
instances of base::string16 with std::wstring, and using appropriate
string utility functions.
Bug: chromium:911896
Change-Id: Ibb0b8a4e4dc7fae1d24d18823f8dbb6da31f8239
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2332402
Commit-Queue: Jan Wilken Dörrie <jdoerrie@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
CFI attempts to verify that the dynamic type of a function object
matches the static type of the function pointer used to call it.
https://clang.llvm.org/docs/ControlFlowIntegrity.html#indirect-function-call-checking
However, the analyzer does not have enough information to check
cross-dso calls. In these instances, CFI crashes upon calling the
function with an error like:
pthread_create_linux.cc:60:16: runtime error:
control flow integrity check for type
'int (unsigned long *, const pthread_attr_t *, void *(*)(void *), void *)'
failed during indirect function call
(/lib/x86_64-linux-gnu/libpthread.so.0+0x9200):
note: (unknown) defined here pthread_create_linux.cc:60:16:
note: check failed in crashpad_handler,
destination function located in /lib/x86_64-linux-gnu/libpthread.so.0
Change-Id: Ib29dabfe714f2ee9cc06a5d17e6899ff81a06df4
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2339332
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
We're working to decouple ChromeOS and Linux builds of Chrome.
Currently OS_CHROMEOS sets OS_LINUX, so we need to refactor
current OS_LINUX usage to make this explicit.
More information can be found at go/cros_is_linux_os_linux
BUG=chromium:1110266
TEST=manual build
Change-Id: Ie765da1ab6a0bf0286538ae1df3697abaa29aeaa
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2391116
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Chromium relies on a global gn sources assignment filter, even though
it’s kind of discouraged. Crashpad doesn’t use this, instead selecting
which files to build entirely with the logic in its .gn files. In some
cases, Chromium’s filters prevent _linux files from building on Android,
and _mac files from building on iOS, even though Crashpad’s build has
explicitly requested these inclusions. To overcome this problem,
clear the gn sources_assignment_filter in all of Crashpad’s own .gn
files when building in Chromium.
Change-Id: Iab0af29f4e5aff4be8eec2ee12b2e3f991c0a86d
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2285959
Commit-Queue: Mark Mentovai <mark@chromium.org>
Reviewed-by: Rohit Rao <rohitrao@chromium.org>
Implemented the AddAttachment(), InitializeAttachments(), CleanDatabase() functions
on Windows.
Added attachment=FILE_NAME option to the handler, and
"attachments" argument for Windows and Linux to StartHandler function.
On crash it will create the corresponding attachments in the database
and copy content of the specified files to the database.
Bug: b/157144387
Change-Id: Ia238de39028e07112a7b971b5b7d5e71a5864f53
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2248099
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
If the file just needs the CHECK/CHECK_OP/NOTREACHED
macros, use the appropriate header for that instead.
Or if logging.h is not needed at all, remove it.
This is both a nice cleanup (logging.h is a big header,
and including it unnecessarily has compile-time costs),
and part of the final step towards making logging.h no
longer include check.h and the others.
Bug: chromium:1031540
Change-Id: Ia46806bd95fe498bcf3cf6d2c13ffa4081678043
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2255361
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Hans Wennborg <hans@chromium.org>
Add direct includes for things provided transitively by logging.h
(or by other headers including logging.h).
This is in preparation for cleaning up unnecessary includes of
logging.h in header files (so if something depends on logging.h,
it needs include it explicitly), and for when Chromium's logging.h
no longer includes check.h, check_op.h, and notreached.h.
DEPS is also updated to roll mini_chromium to ae14a14ab4 which
includes these new header files.
Bug: chromium:1031540
Change-Id: I36f646d0a93854989dc602d0dc7139dd7a7b8621
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2250251
Commit-Queue: Hans Wennborg <hans@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
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>
* Fuchsia only uses Crashpad for minidump generation, report database
and report upload, not for the actual exception handling so it does
not need a handler class
* the current handler class didn't have tests anyway
* Chromium on Fuchsia relies on the platform exception handling instead
of rolling its own Crashpad exception handler
* this avoids us having to maintain an exception handler in another repo
* this removes the last FIDL dependency in Crashpad
TESTED=`fx test crashpad_test`
Change-Id: Ie3998f709e7cc4252dd551882a23b337864da85e
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2165638
Commit-Queue: Francois Rousseau <frousseau@google.com>
Reviewed-by: Scott Graham <scottmg@chromium.org>
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>
From cl/304219049:
Optimize C++11 range-based for loops where the variable is copied in
each iteration but it would suffice to obtain it by const reference.
This is only applied to loop variables of types that are expensive to
copy which means they are not trivially copyable or have a non-trivial
copy constructor or destructor.
To ensure that it is safe to replace the copy with a const reference,
the following heuristic is employed:
- The loop variable is const qualified.
- The loop variable is not const, but only const methods or operators
are invoked on it, or it is used as const reference or value argument
in constructors or function calls.
Change-Id: I5755eb523f60744079b0eb50424395079dcb0f02
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2132844
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
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>
- 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>
During ChromeOS integration tests, pass --always_allow_feedback to
crash_reporter. Most integration tests do not set metrics consent but
still want crash dumps.
Needs https://chromium-review.googlesource.com/c/chromium/src/+/1981139 as well
BUG=chromium:1037656
TEST=tast -verbose run --extrauseflags chrome_internal my_crbook ui.ChromeCrashNotLoggedInDirect
Change-Id: Ibc7af4b31da789c52aec6e668a4b192d4e20fdfc
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1981037
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Ian Barkley-Yeung <iby@chromium.org>
This should prevent accidental "\r\n" line endings from being introduced
again, as happened in 359fc4a1336d, fixed by 31470459b624.
Also includes:
Update mini_chromium to 0512d42698bfb47f2016ac627177c22d22b983d4
0512d42698bf Add .gitattributes, setting “text eol=lf” for all files
Change-Id: Id84c014914fec66632006ed364e2b14b4f1c175c
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1953807
Commit-Queue: Mark Mentovai <mark@chromium.org>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
The metrics recording signal handler doesn't need to be re-installed
on Linux because the handler installed by StartHandler() restores the
previously installed handler by default. Reinstalling the metrics
handler results in a crash dump loop in which each signal handler
restores the other.
Change-Id: Ieef40c74bfc69f6e0caef9809f33cfcaa10f0d03
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1832153
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
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>
This change add function to pass a file directory to Chrome OS's
crash_reporter to write minidumps to. This is used for tests.
BUG=chromium:944123
Change-Id: Ia61955d5ec671c61adde14e61dc72e4be32e389f
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1775290
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
When a crash dump request is received over a socket, the message
includes a stack address of the thread requesting the dump. This can
be used to override the ExceptionInfo's thread ID which may be
incorrect in the handler's PID namespace.
Bug: crashpad:286
Change-Id: I053cf709c5eeefb73b31328f16a806510e1bd35d
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1759280
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
A previous change added a ProcessMemorySanitized class, in this change
plumb support for ProcessMemorySanitized into ProcessSnapshotSanitized.
This involves reading whitelisted regions using the a new field in the
SanitizationInformation struct and returning an initialized
ProcessMemorySanitized object from ProcessSnapshotSanitized::Memory().
Bug: crashpad:263, chromium:973167
Change-Id: I121c5a584a1704ad043757c113099978a9ec2f4e
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1754737
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Vlad Tsyrklevich <vtsyrklevich@chromium.org>
In preparation for an upcoming change that will introduce a second
whitelist (for memory ranges), rename variables/functions to explicitly
reference the annotations whitelist.
Bug: chromium:973167
Change-Id: I1bf232e370990571230a247f9d9022d56ba4fedf
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1752361
Commit-Queue: Vlad Tsyrklevich <vtsyrklevich@chromium.org>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
External callers might also want to call CrashpadHandlerMain, so provide
an externally visibile declaration on Android.
Bug: 973167
Change-Id: Ib9c2a2070e87563acd8af25f8634f1c88ce6681f
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1707897
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Vlad Tsyrklevich <vtsyrklevich@chromium.org>
ExceptionHandlerServer::keep_running_ is used to implement
synchronization across threads (e.g. ExceptionHandlerServer::Stop)
but the variable is not atomic. This causes TSan failures and could
also lead to incorrect compiler optimizations.
Bug: crashpad:304
Change-Id: I3cf5c083d70b6be903e16dbb6feb8fecea2aa1b8
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1706793
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Vlad Tsyrklevich <vtsyrklevich@chromium.org>
Start the server thread after setting the ptrace strategy pointer,
otherwise TSan can't tell that the access is synchronized by the order
of operations in the test.
Bug: crashpad:304
Change-Id: I8be975916eba4e6cb933634596702df07d45219a
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1706792
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Vlad Tsyrklevich <vtsyrklevich@chromium.org>
Currently crashpad's CrashpadHandlerMain can not be overridden. Change
it to be in its own target so that implementers can override it if they
so choose.
Bug: chromium:973167
Change-Id: Ie44eac24c54948154ff550072560732faf621739
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1682932
Commit-Queue: Vlad Tsyrklevich <vtsyrklevich@chromium.org>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
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>
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>
* Fuchsia migrated its call site to the overload without the exception
port as the resume from exception is done outside of Crashpad now
* the overload with the koids and the exception port is kept for the
standalone Crashpad exception server and handler
Bug: fuchsia:ZX-4031
Change-Id: Iec220e2c9bb7b14bdb37b6c008b4fa354dba241d
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1659943
Reviewed-by: Scott Graham <scottmg@chromium.org>
Commit-Queue: Francois Rousseau <frousseau@google.com>
While switching over to the new channel-based exception APIs, we decided
it probably no longer makes sense for crashpad to resume from exception
itself, but instead let the caller do it.
The first step is adding these new non-resuming APIs, and once callers
have been switched over we will remove the existing port-based APIs.
Bug: fuchsia:ZX-4031
Test: runtests
Change-Id: I79a833479f4e5e57bce4baebc61e1b3f9faf70a4
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1597730
Reviewed-by: Scott Graham <scottmg@chromium.org>
Reviewed-by: Francois Rousseau <frousseau@google.com>
Commit-Queue: Francois Rousseau <frousseau@google.com>
This CL adds a RequestCrashDumpHandler to request a crash dump over a
socket. Common functionality with LaunchAtCrashHandler is factored out
into a SignalHandler base class.
Bug: crashpad:284
Change-Id: I86293ef599a0dd6eea63c096a5c931c620c05ecc
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1568985
Reviewed-by: Mark Mentovai <mark@chromium.org>
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>
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>
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>
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>
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>
* we start with VMOs in Fuchsia so this avoids a temporary file before writing the files in the database
* in order to do a soft transition, we add the new type and leave the old one until the caller in Fuchsia has been updated.
Bug: fuchsia:DX-1270
Change-Id: I3c77c775a186801dbcc7379e84ad5795f41780e7
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1554011
Commit-Queue: Francois Rousseau <frousseau@google.com>
Reviewed-by: Scott Graham <scottmg@chromium.org>
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>
This reverts commit 5a21d038c9c9f3baa4e360b0a9bf5d6417868edf.
Reason for revert: Toolchain bug has now been fixed.
Original change's description:
> Work around libcrashpad_handler_trampoline.so ASan trunk clang problem
>
> This first landed downstream in Chromium at 7a8076717f11.
>
> Bug: chromium:936418
> Change-Id: I3eea804039829163948683f014bc10dee6477fb7
> Reviewed-on: https://chromium-review.googlesource.com/c/1495416
> Reviewed-by: Nico Weber <thakis@chromium.org>
> Commit-Queue: Mark Mentovai <mark@chromium.org>
TBR=thakis@chromium.org,mark@chromium.org
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: chromium:936418
Change-Id: I17d40865b64805ffdc1fb5e71e67fee1856c03b7
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1546813
Reviewed-by: Nico Weber <thakis@chromium.org>
Commit-Queue: Nico Weber <thakis@chromium.org>
As of Android Q, the android_set_abort_message() function copies the
abort message into a mapping with a specific name that starts with a magic
number. This makes it possible for Crashpad to collect the abort message
by looking for the mapping with this name in procmaps and checking for the
magic number. The abort message is stored in a process annotation named
"abort_message".
Test: No regressions in build/run_tests.py on devices running P and Q
Test: Patched into Chromium; manually verified that HWASAN crash report appears in minidump
Bug: crashpad:287
Change-Id: I23c4d9e11015c84341de2d2e47e38a1eec508a36
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1544875
Commit-Queue: Peter Collingbourne <pcc@chromium.org>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
This was broken by yours truly in
https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1057833/,
probably because I couldn't decide whether to do it in HandleException()
or HandleExceptionHandles() (or possibly I'm just a dope).
In any case, suspending in HandleExceptionHandles() is fine, the thread
for the exception will be suspended on entry, so suspending other
threads after the initial excepting thread's koid to handle lookup is
OK.
This avoids a bunch of logspam like:
zx_thread_read_state(ZX_THREAD_STATE_GENERAL_REGS): ZX_ERR_BAD_STATE (-20)
and presumably will fix non-excepting-thread stacks being completely
broken?
Bug: fuchsia:DX-1190
Test: run `crasher write0_mt` on device
Change-Id: I029537aba2955d4f055471bf36a4e9a0f8ef2d5e
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1536268
Reviewed-by: Francois Rousseau <frousseau@google.com>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Scott Graham <scottmg@chromium.org>
This first landed downstream in Chromium at 7a8076717f11.
Bug: chromium:936418
Change-Id: I3eea804039829163948683f014bc10dee6477fb7
Reviewed-on: https://chromium-review.googlesource.com/c/1495416
Reviewed-by: Nico Weber <thakis@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
Starting with Android Q, Bionic's linker will support loading
executables from an APK, replacing the /system/bin/app_process
workaround.
libhandler_trampoline.so is a small executable, which `dlopen()`s
the handler code from another native library allowing
de-duplicating shared code with that library without having that
library available for a more direct link time dependency.
Bug: 928422
Change-Id: Ib126b8fca6005a34b9e4ef103eb1383dc0c554ea
Reviewed-on: https://chromium-review.googlesource.com/c/1477336
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
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>
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>
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>
The sys/capability.h header is only present if libcap is installed. We
were only using it for its declaration of a capget() wrapper. Using the
system call directly allows compiling without installing libcap.
Change-Id: I83dfc5c8d56bb3cdd4efb62e0c568d8a221334cd
Reviewed-on: https://chromium-review.googlesource.com/c/1292231
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
This configuration has the following dependencies layout:
* gtest should be pulled from //third_party/googletest
* zlib from //third_party/zlib
* base from //third_party/mini_chromium/mini_chromium/base
* Windows build configs come from //build/config/win:*.
Bug: crashpad:
Change-Id: I22b44d4f85349383063bf3785a321e3c23d88853
Reviewed-on: https://chromium-review.googlesource.com/c/1291378
Commit-Queue: Vyacheslav Egorov <vegorov@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
if only declared as deps, not public_deps, then any header file
depending on these headers need to also list these dependencies
Change-Id: I1d5f6a70d0fb80bf9d7368884247ceee036d1b14
Tested: CQ
Reviewed-on: https://chromium-review.googlesource.com/c/1282013
Reviewed-by: Scott Graham <scottmg@chromium.org>
Commit-Queue: Francois Rousseau <frousseau@google.com>
this allows us to upload that specific local report downstream
Bug: fuchsia:DX-543
Change-Id: Ide262575078aaf641f2e9321cd7796e9d1780f12
Tested: CQ
Reviewed-on: https://chromium-review.googlesource.com/c/1271998
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Francois Rousseau <frousseau@google.com>
zx_task_resume() is deprecated for exception resumption, and replaced by
zx_task_resume_from_exception(). The latter requires an additional
argument, so plumb the exception port on which the exception was
delivered through to where it needs to be resumed.
Bug: fuchsia:ZX-2720
Change-Id: If3984ce13eb1735d061faaac9eecd42e0251d25f
Reviewed-on: https://chromium-review.googlesource.com/c/1263017
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Francois Rousseau <frousseau@google.com>
Targets suffixed with "_module" are now treated specially in chromium
as dynamic feature modules.
Bug: crashpad:30
Change-Id: I9682a76a0e0fae993bbe7454c49a44ada6c4165b
Reviewed-on: https://chromium-review.googlesource.com/1150851
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
This function is just a renamed version of zx_get_startup_handle to
clarify the transfer of ownership.
Change-Id: Ic83cc592df3a571faebd788b3403ccfebd9ff3b8
Reviewed-on: https://chromium-review.googlesource.com/1099054
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: Scott Graham <scottmg@chromium.org>
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>
SimulateCrash.ChildDumpWithoutCrashing needed a larger threshold due to
ASAN instrumentation.
These tests expect children to crash, but ASAN captures the exception
before letting Crashpad handle it:
CrashpadClient.HandlerLaunchFailureCrash
CrashpadClient.HandlerLaunchFailureDumpAndCrash
CrashpadHandler.ExtensibilityCalloutsWork
ExceptionSnapshotWinTest.ChildCrash
(which is an upstreaming of https://chromium-review.googlesource.com/1067151).
Additionally, because Chrome doesn't build all, I noticed a missing
dependency on a test binary which is added here.
Bug: chromium:845011
Change-Id: I5c3ae5673512be29edad21e7d20dd57b8b5ce2bf
Reviewed-on: https://chromium-review.googlesource.com/1075715
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Scott Graham <scottmg@chromium.org>
Change-Id: Ifcfe6c2d18045ce3a2e443ee84d4dd84bb3db373
Reviewed-on: https://chromium-review.googlesource.com/1073567
Reviewed-by: Scott Graham <scottmg@chromium.org>
Commit-Queue: Scott Graham <scottmg@chromium.org>
This is the beginning of support for attachments at the process level
being stored alongside a report. Attachments will be uploaded by key as
part of the multipart http upload. There's no interface at the client
level yet to pass these through.
As this is intended for Fuchsia, this is not yet implemented for the
Mac/Windows database implementations.
Bug: crashpad:196
Change-Id: Ieaf580675164b631d313193f97375710979ba2a9
Reviewed-on: https://chromium-review.googlesource.com/1060419
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
The integration into the Fuchsia tree is still being negotiated, but
I've added crashsvc on that side
https://fuchsia.googlesource.com/zircon/+/HEAD/system/core/crashsvc/crashsvc.cpp,
which handles exceptions and spawns something to actually deal with the
crashed process. This means that there's no resident thing, so it seems
simplest to use handler/crash_report_exception_handler directly, rather
than add another wrapper binary. At some point it may make sense to roll
this functionality back into Crashpad upstream, we'll see how it
evolves.
Additionally, the "normal" crashpad_handler model may still be necessary
if Chrome wants to use a copy locally (rather than the system handler).
To accomplish this:
- Split crashpad_handler and crashpad_database_util packages so
crashpad_database_util can still be included into the system image for
debugging.
- Add handle-based version of HandleException() to
CrashReportExceptionHandler (and also remove the "type" argument because
I've come around to realizing there's no point to it, finally. :)
Bug: crashpad:196
Change-Id: I38872183ee3691c0938c5b761e6b73c80019f355
Reviewed-on: https://chromium-review.googlesource.com/1057833
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Scott Graham <scottmg@chromium.org>
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>