Commit graph

24 commits

Author SHA1 Message Date
Josh Gao
a42314e436 debuggerd: add pause time benchmark.
Add a benchmark to measure how long we pause a process when dumping.

Bug: http://b/62112103
Test: manually ran it
Change-Id: Iceec2f722915b0ae26144c86dcbeb35793f963da
2017-12-19 16:36:04 -08:00
Josh Gao
2b2ae0c88e crash_dump: fork a copy of the target's address space.
Reduce the amount of time that a process remains paused by pausing its
threads, fetching their registers, and then performing unwinding on a
copy of its address space. This also works around a kernel change
that's in 4.9 that prevents ptrace from reading memory of processes
that we don't have immediate permissions to ptrace (even if we
previously ptraced them).

Bug: http://b/62112103
Bug: http://b/63989615
Test: treehugger
Change-Id: I7b9cc5dd8f54a354bc61f1bda0d2b7a8a55733c4
2017-12-15 14:11:12 -08:00
Christopher Ferris
ab9cf8b4cc Only call one unwinder.
Nobody is looking at the mismatches, and it can cause problems
with tombstone parsers.

Also, fix the dump_header_info test and remove unused properties_fake.cpp.

Test: Ran unit tests, verified tombstones still work.
Change-Id: I4261646016b4e84b26a5aee72f3227f1ce48ec9a
2017-10-27 15:18:27 -07:00
Josh Gao
fdf832dfd3 base: add Pipe and Socketpair wrappers.
Also, switch debuggerd_handler over to using android::base::unique_fd.

Test: treehugger
Change-Id: I97b2ce22f1795ce1c4370f95d00d769846cc54b8
2017-08-28 14:51:07 -07:00
Christopher Ferris
9a8c855780 Compare new unwinder to old unwinder in debuggerd.
In debuggerd, when dumping a tombstone, run the new unwinder and verify
the old and new unwinder are the same. If not, dump enough information
in the tombstones to figure out how to duplicate the failure.

Bug: 23762183

Test: Builds, ran and forced a mismatch and verified output.
Change-Id: Ia178bde64d67e623d4f35086ebda68aebbff0c3c
2017-08-11 16:37:59 -07:00
Nick Kralevich
33391dad15 Remove unnecessary SELinux dependencies
These are unused.

Test: code compiles.
Change-Id: Idd707dfcc8f6daac3a489c791ecc364841cf31f9
2017-07-01 07:41:48 -07:00
Josh Gao
0915f23d5f debuggerd: diagnostics for dumps that are guaranteed to fail.
Print diagnostics when the user requests a dump that is guaranteed to
fail, such as trying to dump a process you can't send a signal to.

Bug: http://b/63008395
Change-Id: I5c6bf2a5751f858e0534990b8d2ab6932eb9f11d
Test: manually tested
2017-06-27 15:06:57 -07:00
Josh Gao
3407d7c80f Revert "crash_dump: defer pausing threads until we're ready."
This reverts commit 8a2a2d182a.

Bug: http://b/62572585
Change-Id: Ia4278bca52178eb7b7b28b30d0930b292d97f353
2017-06-13 17:21:12 +00:00
Josh Gao
8a2a2d182a crash_dump: defer pausing threads until we're ready.
Don't pause the threads we're going to dump until after we're about to
fetch their backtraces.

Bug: http://b/62112103
Test: debuggerd_test
Change-Id: Id7ab0464842b35f98f3b3ebc42fb76161d8afbd2
2017-06-07 14:11:28 -07:00
Narayan Kamath
a73df601b7 tombstoned: allow intercepts for java traces.
All intercept requests and crash dump requests must now specify a
dump_type, which can be one of kDebuggerdNativeBacktrace,
kDebuggerdTombstone or kDebuggerdJavaBacktrace. Each process can have
only one outstanding intercept registered at a time.

There's only one non-trivial change in this changeset; and that is
to crash_dump. We now pass the type of dump via a command line
argument instead of inferring it from the (resent) signal, this allows
us to connect to tombstoned before we wait for the signal as the
protocol requires.

Test: debuggerd_test

Change-Id: I189b215acfecd08ac52ab29117e3465da00e3a37
2017-05-31 10:35:32 +01:00
Narayan Kamath
2d377cd688 tombstoned: Add a shared library version of libtombstoned_client...
.. for ART and the frameworks to link against. In the new stack dumping
scheme (see related bug), the Java runtime will communicate with
tombstoned in order to obtain a FD to which it can write its traces.

Also move things around to separate headers that are private
implementation details from headers that constitute the public debuggerd
API. There are currently only three such headers :

- tombstoned/tombstoned.h
- debuggerd/client.h
- debuggerd/handler.h

Bug: 32064548
Test: make

Change-Id: If1b8578550e373d84828b180bbe585f1088d1aa3
2017-05-22 16:55:21 +01:00
Chenjie Luo
68c24eff77 Remove not-used dependency in crash_dump
Test: Build crash_dump.
Change-Id: I053cf53196b3e438545138ca8401a0ad01006a8c
2017-05-08 15:18:40 -07:00
Dan Willemsen
a4103a85b6 Turn off debuggerd for host bionic
Bug: 31559095
Test: Attempt to build host bionic
Change-Id: Ie0b30417bdc2c59fd4793a79fd23dc9ccd398937
2017-05-07 13:22:01 -07:00
Christopher Ferris
ac225780dd Move libc_logging to libasync_safe.
Move the name of the "private/libc_logging.h" header to <async_safe/log.h>.

For use of libc_malloc_debug_backtrace, remove the libc_logging library.
The library now includes the async safe log functions.

Remove the references to libc_logging.cpp in liblog, it isn't needed because
the code is already protected by a check of the __ANDROID__ define.

Test: Compiled and boot bullhead device.
Test: Run debuggerd unit tests.
Test: Run liblog unit tests on target and host.
Test: Run libmemunreachable unit tests (these tests are flaky though).
Change-Id: Ie79d7274febc31f210b610a2c4da958b5304e402
2017-05-02 18:38:46 -07:00
Josh Gao
352a84574d tombstoned: add tests for b/36685795.
Add some tests for edge cases which may have triggered b/36685795.

Bug: http://b/36685795
Test: debuggerd_test
Change-Id: I20670684c8dae422af157be21e44ba5d6d3214d3
2017-03-30 16:49:19 -07:00
Josh Gao
ae9d7676a5 debuggerd_client: properly wait for completion.
Use an intermediate pipe to detect and report when a requested dump has
completed.

Bug: http://b/35241370
Bug: http://b/35813071
Test: debuggerd_test
Test: manually triggered a background ANR
Change-Id: If14aedf6071288360f1a7853d5a2ee79db121759
2017-03-27 16:11:38 -07:00
Dan Willemsen
e0cd1e043d Enable more modules on linux_bionic builds
Bug: 31559095
Test: Enable host bionic, run soong
Change-Id: Ib4ebd909322cf464b6a40040e4b60ece7d905b6f
2017-03-15 15:44:00 -07:00
Josh Gao
c7fe0600cc crash_dump: fix warnings, turn on -Werror.
Test: mma
Change-Id: I0722fef7b513be976cbbe89f73e8bb7138a80442
2017-03-13 14:13:29 -07:00
Josh Gao
e1aa0ca58a debuggerd_handler: implement missing fallback functionality.
Allow the fallback implementation to dump traces and create tombstones
in seccomped processes.

Bug: http://b/35858739
Test: debuggerd -b `pidof media.codec`; killall -ABRT media.codec
Change-Id: I381b283de39a66d8900f1c320d32497d6f2b4ec4
2017-03-09 11:26:05 -08:00
Josh Gao
e73c932373 libdebuggerd_handler: in-process crash dumping for seccomped processes.
Do an in-process unwind for processes that have PR_SET_NO_NEW_PRIVS
enabled.

Bug: http://b/34684590
Test: debuggerd_test, killall -ABRT media.codec
Change-Id: I62562ec2c419d6643970100ab1cc0288982a1eed
2017-02-15 17:03:44 -08:00
Elliott Hughes
0ba535976f Better seccomp/kuser_helper diagnostics from debuggerd.
Also switch to Android.bp for crasher.

Bug: http://b/34629282 (seccomp)
Bug: http://b/34705831 (seccomp)
Bug: http://b/34884086 (kuser_helpers)
Test: manual
Change-Id: I8ee79c635518faeba751742919af69a505b5e3e1
2017-02-01 18:43:03 -08:00
Josh Gao
cbe70cb0a8 debuggerd: advance our amazing bet.
Remove debuggerd in favor of a helper process that gets execed by
crashing processes.

Bug: http://b/30705528
Test: debuggerd_test
Change-Id: I9906c69473989cbf7fe5ea6cccf9a9c563d75906
2017-01-17 13:57:57 -08:00
Robert Sesek
9eb02c973f Define TARGET_IS_64_BIT when building libdebuggerd_client for android64.
This is needed to connect to the right debuggerd server for the crashing
process. Without this change, the following errors are observed, because a
32-bit process is trying to connect to the 64-bit debuggerd (as opposed to
debuggerd32):

  Fatal signal 11 (SIGSEGV), code 1, fault addr 0x0 in tid 14153 (static_crasher)
  debuggerd: handling request: pid=14153 uid=0 gid=0 tid=14153
  debuggerd: Not allowed to redirect action 0 to 32 bit debuggerd

Bug: 24414818
Change-Id: I2f275fbc804b0abc6e876a743e51dd8494817103
2016-08-09 14:04:05 -04:00
Josh Gao
9c02dc5916 debuggerd: add libdebuggerd_client.
Bug: http://b/24414818
Change-Id: I079c534d2c952b6975bf0428eb86cc7a55525737
2016-06-17 13:11:29 -07:00