summaryrefslogtreecommitdiff
path: root/debuggerd/handler/debuggerd_fallback.cpp
AgeCommit message (Collapse)Author
2021-06-10Avoid thread cache in unwinder.Christopher Ferris
The code in the fallback path calls pthread_key_create when using the normal thread cache. However, this code is executed out of the linker, which means that the call doesn't see keys created by the libc version of pthread_key_create. As of now, simply avoid using the thread cache to avoid this problem. Bug: 189803009 Test: debuggerd -b on a media process on a 32 bit Android Go device Test: and observe no crash. Test: debuggerd unit tests pass. Change-Id: I9ca1a55e44d3bb69d49450826d7d64d7a64145c3
2021-01-26Reland protobuf tombstones.Josh Gao
This reverts the following commits: e156ede145a7fc671c705d045d89b49922a758b5. eda96eddcbdda9632166232b2363c7b84da0994d. 5ec54d1e843729cd1e38a2f791f001226a653e95. 1e45d3f2239333217d3252f78151f4294fda4e80. a50f61f8fa903117a6df82d164628de310f16ae9. Test: treehugger Test: atest -c CtsSeccompHostTestCases:android.seccomp.cts.SeccompHostJUnit4DeviceTest#testAppZygoteSyscalls Change-Id: Ic2b1f489ac9f1fec7d7a33c845c29891f4306bbd
2021-01-26Revert "libdebuggerd: add protobuf implementation."Jerome Gaillard
Revert "Let crash_dump read /proc/$PID." Revert submission 1556807-tombstone_proto Reason for revert: b/178455196, Broken test: android.seccomp.cts.SeccompHostJUnit4DeviceTest#testAppZygoteSyscalls on git_master on cf_x86_64_phone-userdebug Reverted Changes: Ide6811297:tombstoned: switch from goto to RAII. I8d285c4b4:tombstoned: make it easier to add more types of ou... Id0f0fa285:tombstoned: support for protobuf fds. I6be6082ab:Let crash_dump read /proc/$PID. Id812ca390:Make protobuf vendor_ramdisk_available. Ieeece6e6d:libdebuggerd: add protobuf implementation. Change-Id: Ia0a1ee57e7630e01c495dc166218f665340aad7f
2021-01-21libdebuggerd: add protobuf implementation.Josh Gao
This commit implements protobuf output for tombstones, along with a translator that should emit bytewise identical output to the existing tombstone dumping code, except for ancillary data from GWP-ASan and Scudo, which haven't been implemented yet. Test: setprop debug.debuggerd.translate.translate_proto_to_text 1 && /data/nativetest64/debuggerd_test/debuggerd_test Test: for TOMBSTONE in /data/tombstones/tombstone_??; do pbtombstone $TOMBSTONE.pb | diff $TOMBSTONE - done Change-Id: Ieeece6e6d1c26eb608b00ec24e2e725e161c8c92
2020-10-01Merge "Improve error message in debuggerd fallback handler."Treehugger Robot
2020-09-25Improve error message in debuggerd fallback handler.Josh Gao
Bug: http://b/164014625 Test: none Change-Id: I4f1e61be93c511676e66b909a15735bba963eff0
2020-09-24Add arch member into Unwinder object.Christopher Ferris
This simplifies some of the logic and removes the need to pass an Arch value to functions that should already know about the arch it is operating on. Includes fixes for debuggerd/libbacktrace. Added new unit tests to cover new cases. Test: All unit tests pass. Test: Faked unwinder failing to verify debuggerd error messages display Test: properly in backtrace and tombstone. Change-Id: I439fcae0695befcfb1cb4c0a786cc74949d33425
2019-12-17debuggerd: switch to using platform headers for DEBUGGER_SIGNAL.Josh Gao
Test: treehugger Change-Id: Ie9736c4a077dba1029d2352bd94d47ce07323aec
2019-04-05Revert "Check for data races when reading JIT/DEX entries."David Srbecky
This reverts commit 85b5fecec920208ec43b42488f08d4c2e5aaeda2. Reason for revert: Breaks ART tests, reverting to investigate. Change-Id: I1bb905407e87cbd4f832646651133a9caf6fcfc8
2019-03-29Check for data races when reading JIT/DEX entries.David Srbecky
Update the entries only when the list is modified by the runtime. Check that the list wasn't concurrently modified when being read. Bug: 124287208 Test: libunwindstack_test Test: art/test.py -b --host -r -t 137-cfi Change-Id: I87ba70322053a01b3d5be1fdf6310e1dc21bb084
2019-01-29Replace libbacktrace with libunwindstack directly.Christopher Ferris
Small modifications to the dump_stack method and added unit tests to verify the output. Bug: 120606663 Test: Unit tests pass, debuggerd run on processes on target. Change-Id: Id385a915b751abda3dd6baebed6c3ce498c3bf6e
2018-10-30debuggerd_fallback: fix fd leak.Josh Gao
Previously, when we received simultaneous dump requests, we were CASing a file descriptor value into a variable, and then failing to close it if the CAS failed. Bug: http://b/118412443 Test: debuggerd_test Change-Id: I075c35a239426002eb9416da3d268c3d1a18e9d2
2018-09-12Fix multithreaded backtraces for seccomp processes.Josh Gao
Add threads to the existing seccomp backtrace test to prevent regressing this. Bug: http://b/114139908 Bug: http://b/115349586 Test: debuggerd_test32 Test: debuggerd_test64 Change-Id: I07fbe1619b60f0008deb045a249f9045404478c2
2018-05-16debuggerd: fix CrasherTest.seccomp_crash_oom.Josh Gao
Switch from _exit to raising SIGABRT when we recurse in the fallback handler, so that waiters see an abort instead of a regular exit. Bug: http://b/79717060 Test: debuggerd_test32 Test: debuggerd_test64 Change-Id: Iddee1cb1b759690adf07bbb8cd0fda2faac87571
2018-02-22debuggerd_fallback: don't recursively abort.Josh Gao
Calls to abort() will always result in our signal handler being called, because abort will manually unblock SIGABRT before raising it. This can lead to deadlock when handling address space exhaustion in the fallback handler. To fix this, switch our mutex to a recursive mutex, and manually keep track of our lock count. Bug: http://b/72929749 Test: debuggerd_test --gtest_filter="CrasherTest.seccomp_crash_oom" Change-Id: I609f263ce93550350b17757189326b627129d4a7
2018-02-09debuggerd_fallback: fix race.Josh Gao
A race condition occurs when one thread takes more than a second to get scheduled to handle the signal we send to ask it to dump its stack. When this happens, the main thread will continue on, close the fd, and then ask the next thread to dump, but the slow thread will then wake up and try to write to the new thread's fd, or trigger an assertion in __linker_enable_fallback_allocator. Do a few things to make this less bad: - encode both target tid and fd in the shared atomic, so that we know who each fd is for - switch __linker_enable_fallback_allocator to return success instead of aborting, and bail out if it's already in use - write to the output fd right when we get to it, instead of doing it whenever the dumping code decides to, to reduce the likelihood that the timeout expires Test: debuggerd_test Change-Id: Ife0f6dae388b601e7f991605f14d7a0274013f6b
2017-12-15crash_dump: fork a copy of the target's address space.Josh Gao
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-08-29libdebuggerd: cleanup.Josh Gao
Move libdebuggerd headers into their own directory for namespacing, move some includes to the top of their implementing files, delete some dead code. Test: mma, treehugger Change-Id: Ie4c44e32e2ab3bc678092899d257fd4ed634aa34
2017-05-31tombstoned: allow intercepts for java traces.Narayan Kamath
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-22tombstoned: Add a shared library version of libtombstoned_client...Narayan Kamath
.. 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-02Move libc_logging to libasync_safe.Christopher Ferris
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-03-09debuggerd_handler: implement missing fallback functionality.Josh Gao
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-02-15libdebuggerd_handler: in-process crash dumping for seccomped processes.Josh Gao
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