summaryrefslogtreecommitdiff
path: root/debuggerd/libdebuggerd
AgeCommit message (Collapse)Author
2020-03-26Move PC-only unwind frame generation to libunwindstack.Mitch Phillips
GWP-ASan uses frame-pointer based unwinding internally on allocation/deallocation to collect stack traces that are used when crashes are reported. This should be generic, so pull it out into libunwindstack so it can be used by MTE as well. Bug: 152412331 Test: atest debuggerd_test Change-Id: I27b32263aac63446f5fe398af108676b70cd3971
2020-03-23Remove ANDROID_LOG_RDONLY, etcTom Cherry
These macros haven't been meaningful in years. Test: logging unit tests Change-Id: I796ec6d9b450f8a84bc85c3f15ddd988724c5e08
2020-03-19Make GetPcAdjustment a free function.Peter Collingbourne
We're now using it in contexts that don't have all of the registers available, such as GWP-ASan and soon MTE, so it doesn't make sense to have it be a member function of Regs. Bug: 135772972 Change-Id: I18b104ea0adb78588d7e475d0624cefc701ba52c
2020-03-18Move crash_dump into the runtime APEX.Peter Collingbourne
A future change will introduce a version lock between linker and crash_dump. Move crash_dump into the runtime APEX alongside linker in order to ensure that they will be the same version even if the runtime APEX is updated. Bug: 135772972 Change-Id: Ic2eae31b6927eb0e8a62315ac141f50933c00bcc Merged-In: Ic2eae31b6927eb0e8a62315ac141f50933c00bcc
2020-02-28Create a ProcessInfo structure with the process-wide information from the ↵Peter Collingbourne
crasher. We're now passing around a couple of addresses for GWP-ASan in addition to abort_msg_address and fdsan_table_address, and I'm going to need to add more of them for MTE. Move them into a data structure in order to simplify various function signatures. Bug: 135772972 Change-Id: Ie01e1bd93a9ab64f21865f56574696825a6a125f
2020-02-18[GWP-ASan] Add GWP-ASan information to tombstones.Mitch Phillips
GWP-ASan can provide information about a crash that it caused. Grab the GWP-ASan regions from the globals shared by the linker for crash-handler purpopses, pull the information from GWP-ASan, and display it. This adds two regions: 1. Causality tracking by GWP-ASan. We now print a cause header about the crash, like `Cause: [GWP-ASan]: Use After Free on a 1-byte allocation at 0x7365bb3ff8` 2. Allocation and deallocation stack traces. Bug: 135634846 Test: atest debuggerd_test Change-Id: Id28d5400c9a9a053fcde83a4788f971e677d4643
2020-01-22debuggerd: remove the raw stack dump.Elliott Hughes
This takes a lot of space, isn't convincingly useful, and makes it likely that the far more valuable stuff that comes after it gets truncated. So let's just drop it. Bug: http://b/139860930 Test: manual crasher, presubmit Change-Id: Ie417ffc07e3cb17e95fdb3d183f8c87de0f34b89
2019-12-17debuggerd: switch to using platform headers for DEBUGGER_SIGNAL.Josh Gao
Test: treehugger Change-Id: Ie9736c4a077dba1029d2352bd94d47ce07323aec
2019-11-19Merge "Add variadic logging to libdebuggerd internal."Treehugger Robot
2019-11-19Add variadic logging to libdebuggerd internal.Mitch Phillips
GWP-ASan's crash information retrieval services requires a Printf() function (declared by the system/implementing allocator). In this instance, because _LOG is called with additional arguments (the log_t), this function must be wrapped to conform to printf_t defined by GWP-ASan. We can easily wrap the variadic version. Bug: 135634846 Test: atest debuggerd_test Change-Id: I17209cd2b7455ce889e2f8194969f606cac329eb
2019-11-19Merge "Include PSTATE in tombstones on arm64."Treehugger Robot
2019-11-18Include PSTATE in tombstones on arm64.Peter Collingbourne
A thread's PSTATE can sometimes be critical for understanding a crash, especially with MTE and other new features that store per-thread state in PSTATE. Bug: 135772972 Change-Id: I1bee25bffe7eea395f04b6449dc9227298cf866e
2019-10-24Remove old logger_entry_v* formatsTom Cherry
logger_entry and logger_entry_v2 were used for the kernel logger, which we have long since deprecated. logger_entry_v3 is the same as logger_entry_v4 without a uid field, so it is trivially removable, especially since we're now always providing uids in log messages. liblog and logd already get updated in sync with each other, so we have no reason for backwards compatibility with their format. Test: build, unit tests Change-Id: I27c90609f28c8d826e5614fdb3fe59bde22b5042
2019-10-10[debuggerd] fix -Wreorder-init-listNick Desaulniers
C++20 wants members to be ordered unlike C99. Bug: 139945549 Test: mm Change-Id: I3cbca589511c1e0bbc10c691949e18de77e16031 Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
2019-07-17Add cause message when stack overflow is detected.Christopher Ferris
Test: Ran new unit tests. Test: Ran crasher stack-overflow, crasher64 stack-overflow and verified Test: stack overflow cause is shown. Test: Ran stack overflow app and verified tombstone includes stack-overflow Test: message. Change-Id: I9bb01186dff5ed81c77d84b6aaedb5332ddd7256
2019-04-23Add UID printing to tombstone headersMisha Wagner
This is for Android Telemetry to be able to categorise the processes that produce tombstones. Test: atest debugerd_test:TombstoneTest Change-Id: Ie635347c9839eb58bfd27739050bd68cbdbf98da
2019-04-18Add indicator that an elf is memory backed.Christopher Ferris
Modify the unwinder library to indicate that at least one of the stack frames contains an elf file that is unreadable. Modify debuggerd to display a note about the unreadable frame and a possible way to fix it. Bug: 129769339 Test: New unit tests pass. Test: Ran an app that crashes and has an unreadable file and verified the Test: message is displayed. Then setenforce 0 and verify the message is Test: not displayed. Change-Id: Ibc4fe1d117e9b5840290454e90914ddc698d3cc2
2019-04-08Remove include of backtrace/Backtrace.h.Christopher Ferris
Somehow the code was still including this include from libbacktrace. I think the libbacktrace include directory was coming from some transitive includes. I verified that nothing in debuggerd is using the libbacktace.so shared library. Bug: 120606663 Test: Builds, unit tests pass. Change-Id: I85c2837c5a539ccefc5a7140949988058d21697a
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-03-26Add BuildId to frame information.Christopher Ferris
Update debuggerd to print BuildId information by default. Bug: 120975492 Test: New unit tests pass. Test: debuggerd -b <PID> shows build id information. Test: tombstones include build id information. Change-Id: I019b031113d0b77385516223c63455b868924440
2019-03-05Fix copy / move behaviour of Maps object.Florian Mayer
Currently, moving or copying a Maps object leads to double free of MapInfo. Even moving a Maps object did not prevent this, as after a move the object only has to be in an "unspecified but valid state", which can be the original state for a vector of raw pointers (but not for a vector of unique_ptrs). Changing to unique_ptrs is the most failsafe way to make sure we never accidentally destruct MapInfo. Test: atest libuwindstack_test Failed LocalUnwinderTest#unwind_after_dlopen which also fails at master. Change-Id: Id1c9739b334da5c1ba532fd55366e115940a66d3
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-12-14libdebuggerd: add timestamp to tombstones.Josh Gao
Bug: http://b/120099273 Test: debuggerd_test Change-Id: I457506f8d9920d969e1eba0265f85693b484f1a9
2018-11-27Tombstone support for XOM-related SIGSEGVs.Ivan Lozano
Make XOM related crashes a little less mysterious by adding an abort cause explaining the crash. Bug: 77958880 Test: Abort cause in tombstone for a XOM-related crash. Change-Id: I7af1bc251d9823bc755ad98d8b3b87c12bbaecba
2018-11-14switch to using android-base/file.h instead of android-base/test_utils.hMark Salyzyn
Test: compile Bug: 119313545 Change-Id: I4f7ad84743e974b4b4d1d7256088f6c8b749a237
2018-10-30Update for v4.19 kernel headers.Christopher Ferris
Add new trap type TRAP_UNK. Test: Unit tests pass. Change-Id: I2b9cb8ddd1d993aa4819831aaca34f8da4286b52 (cherry picked from commit ead88bc88e567182b3c6ae5fd2f17730f55ec3f3)
2018-08-28libdebuggerd: decode fdsan owner tags.Josh Gao
Test: debuggerd `pidof system_server` | grep " fd " Change-Id: Ic4bb30b8602acf5912e776a61825d9645ec93c65
2018-08-21debuggerd: delete accidentally merged log spam.Josh Gao
Test: none Change-Id: I4237b4f0c8d5cdc559766fc3c73742b013c1df86
2018-08-06libdebuggerd: extract and print the fdsan table.Josh Gao
This commit only prints the raw value of the owner tag, pretty-printing will come in a follow-up commit. Test: debuggerd `pidof adbd` Test: static_crasher fdsan_file + manual inspection of tombstone Change-Id: Idb7375a12e410d5b51e6fcb6885d4beb20bccd0e
2018-07-16Clean up logging code.Christopher Ferris
Test: Verify that tombstones still contain the log message data. Change-Id: I303dec944e58a0c4f5edfed22caaf1f2462ea3e8
2018-06-29Add support for new defines in v4.17.3 headers.Christopher Ferris
Test: Builds and unit tests pass. Change-Id: Ibd5711effb1e599d3239d45124383fe91e0f573d
2018-05-30Improve SIGILL support.Elliott Hughes
Include the illegal instruction in the header if we get a SIGILL. Otherwise (since these tend to be one-off bit flips), we don't usually have any information to try to confirm our suspicion that any given instance is actually a one-off bit flip. Also add `SIGILL` as a crasher option to easily generate such crashes. Before: signal 4 (SIGILL), code 1 (ILL_ILLOPC), fault addr 0xab1456da After: signal 4 (SIGILL), code 1 (ILL_ILLOPC), fault addr 0xab1456da (*pc=0xe7f0def0) Bug: http://b/77274448 Test: ran crasher Change-Id: I5f8dedca5eea2b117b1b1e48430214b38e1366ed
2018-04-26Show signal sender for SI_FROMUSER signals.Elliott Hughes
Suicide doesn't change: signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr -------- But homicide now looks like this (this is `sleep 666` killed by `kill -SEGV` as root: signal 11 (SIGSEGV), code 0 (SI_USER from pid 4446, uid 0), fault addr -------- Bug: http://b/78594105 Test: manual Change-Id: I8c2feafba8cc5a3db85e8250004d428a464c5d9e
2018-04-20libdebuggerd: fix out of bounds write.Josh Gao
Bug: http://b/78363964 Test: treehugger Change-Id: I79ae818e4e0c29f064335d59789afc3b1bf87c69
2018-04-20libdebuggerd: clone registers before we Unwind with them.Josh Gao
Bug: http://b/77296294 Test: manual inspection of tombstone generated by crasher Change-Id: I4b017701d7d2041db4aefbbb90977e99b844c328
2018-04-13debuggerd: remove maximum abort message length.Josh Gao
Let the logging implementation be the imposer of limits. Bug: http://b/64759619 Test: debuggerd_test Change-Id: I8bc73bf2301ce071668993b740880224846a4e75
2018-02-15Include the map name when dumping memory around a register.Elliott Hughes
Bug: http://b/19590178 Test: ran tests, ran crasher Change-Id: Ib9afa34c860d8732ef1943eb4decd0b7c8fb55fd
2018-01-20Fix regression caused by libbacktrace API change.Christopher Ferris
The stack dump was not printing leading zeros for data after the change to remove uintptr_t types from the libbacktrace API. Bug: 65682279 Test: Created an arm tombstone and an arm64 tombstone and verified Test: that the stack data has leading zeros. Change-Id: I1fbec2c4fa7c8b0fab18894c5628d18c5a580299
2018-01-18Change all uintptr_t to uint64_t in API.Christopher Ferris
In order to support the offline unwinding properly, get rid of the usage of non-fixed type uintptr_t from all API calls. In addition, completely remove the old local and remote unwinding code that used libunwind. The next step will be to move the offline unwinding to the new unwinder. Bug: 65682279 Test: Ran unit tests for libbacktrace/debuggerd. Test: Ran debuggerd -b on a few arm and arm64 processes. Test: Ran crasher and crasher64 and verified tombstones look correct. Change-Id: Ib0c6cee3ad6785a102b74908a3d8e5e93e5c6b33
2017-12-22debuggerd: restore the location of abort message.Josh Gao
The abort message was accidentally relocated to be printed below the registers, backtrace, and stack, which isn't very helpful. Move it back to its rightful place. Test: treehugger Change-Id: I8aa5b63e58081f27ccdb42481fed8d9eb3a892a4
2017-12-18Increased number of Android log lines for tombstoneschirag honnavar
5 lines are not enough for debug Bug: b/69815742 Change-Id: I3117f221f4945941ec277064ffd2765dda74e192
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-12-05Demand read load bias for a map.Christopher Ferris
Add a static GetLoadBias method to the Elf object that only reads just enough to get the load bias. Add a method to MapInfo that gets the load bias. First attempt to get it if the elf object already exists. If no elf object was created, use the new static method to get the load bias. In BacktraceMap, add a custom iterator so that when code dereferences a map element, that's when the load bias will be retrieved if it hasn't already been set. Bug: 69871050 Test: New unit tests, verify tombstones have non-zero load bias values for Test: libraries with a non-zero load bias. Change-Id: I125f4abc827589957fce2f0df24b0f25d037d732
2017-10-27Only call one unwinder.Christopher Ferris
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-12Merge "Move some properties users to __system_property_read_callback()"Tom Cherry
2017-10-10Move some properties users to __system_property_read_callback()Tom Cherry
This is needed if they will ever handle ro. properties that have values longer than 92 characters. Bug: 23102347 Bug: 34954705 Test: read and write properties with value length > 92 characters Change-Id: I44aa135c97ec010f12162c30f743387810ae2c5d
2017-10-10libdebuggerd: fix tombstone tests.Josh Gao
Update the tests to match new output (and stop pluralizing '1 entries'). Test: `debuggerd_test{32,64} --gtest_filter="TombstoneTest.*" on hikey960 Change-Id: I16b0335715303252fad3a35d6a053a50fefdac30
2017-09-26Show the number of VMAs in the tombstone.Elliott Hughes
Tombstones (especially ones with lots of VMAs) are regularly truncated. We can at least show the number of VMAs, though, for anyone interested in knowing whether they got close to the default 64Ki limit. Bug: http://b/66911122 Test: ran crasher, examined tombstone Change-Id: I286db66f28f132307d573dbe5164efc969dc6ddc
2017-09-13debuggerd_fallback: print maps.Josh Gao
Bug: http://b/63400743 Bug: http://b/65590288 Test: killall -ABRT media.codec Change-Id: I58e47dcd8e99ad7a5945604c27876dd01259e501