summaryrefslogtreecommitdiff
path: root/debuggerd/libdebuggerd/test
Commit message (Collapse)AuthorAgeFilesLines
* Remove dead non-proto tombstone reporting code.Peter Collingbourne2022-03-071-205/+0
| | | | | Bug: 197981919 Change-Id: I58a98070198ef0b686229bd54f87b9073df12d66
* debuggerd: add the PAC keys to the tombstones.Elliott Hughes2022-01-131-0/+9
| | | | | | | | Hard to get otherwise if you're trying to debug PAC issues. Bug: http://b/214314197 Test: treehugger Change-Id: I2e5502809f84579bf287364e59d6e7ff67770919
* Remove non-protobuf path.Christopher Ferris2021-11-191-281/+0
| | | | | | | | | | | | | It is expensive to keep the non-protobuf path around and it hasn't been used for an entire release without anyone noticing, so remove it. Create new end-to-end unit tests that cover tests of the non-proto code paths that are being deleted. Bug: 197981919 Test: Unit tests pass. Change-Id: Ia1c45572300bd63e5f196ad61e5e5386830c8ece
* Merge "Add a human readable description of the tagged_addr_ctrl value to ↵Peter Collingbourne2021-11-101-0/+33
|\ | | | | | | tombstones."
| * Add a human readable description of the tagged_addr_ctrl value to tombstones.Peter Collingbourne2021-11-051-0/+33
| | | | | | | | Change-Id: Ib9860b282cf749891e0f6ef7697669b94235c236
* | Update for libunwindstack shared_ptr MapInfos.Christopher Ferris2021-10-281-1/+3
| | | | | | | | | | | | | | | | | | Bug: 120606663 Test: Unit tests pass. Change-Id: Ieae157388e8571345ed8968a2b5c2aa34464689f Merged-In: Ieae157388e8571345ed8968a2b5c2aa34464689f (cherry picked from commit 853733b627dc5bbb07b2463a1f10f10ddee06bbc)
* | Revert "strerror: incl enum name"Steven Moreland2021-10-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Revert "strerror: incl enum name" Revert submission 1833622-usable-strerror Reason for revert: b/202330586 Bug: 202330586 Reverted Changes: I4d8f617a0:Track strerror(3) change. I8ea86220c:strerror: incl enum name I407bd9f4d:strerror: incl enum name Change-Id: I293ac322160c6a82ff7004a3de085cafbd514458
* | strerror: incl enum nameSteven Moreland2021-09-231-1/+1
|/ | | | | | | | | strerror is nice, but usually I don't care about the text, I care about the uppercase enum Bug: N/A Test: N/A Change-Id: I8ea86220cb04cbded701379c47b8aba8ea8864b8
* Merge "debuggerd: store commandline instead of process name."Josh Gao2021-03-311-5/+5
|\
| * debuggerd: store commandline instead of process name.Josh Gao2021-03-301-5/+5
| | | | | | | | | | | | Bug: http://b/180605583 Test: debuggerd_test Change-Id: I018d399a5460f357766dc1b429f645f78fe88565
* | Adjust libunwindstack MapInfo APIDavid Srbecky2021-03-231-2/+1
|/ | | | | Test: m debuggerd_test Change-Id: I63a2379bad3ace4755ae48bf0a83eaa0070f9077
* Merge "Support MTE and GWP-ASan features in proto tombstones."Peter Collingbourne2021-03-191-70/+6
|\
| * Support MTE and GWP-ASan features in proto tombstones.Peter Collingbourne2021-03-161-70/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | Proto tombstones were missing tagged fault addresses, tagged_addr_ctrl, tags in memory dumps and Scudo and GWP-ASan error reports. Since text tombstones now go via protos, all of these features broke when we switched to text tombstones generated from protos by default. Fix the features by adding support for them to the proto format, tombstone_proto and tombstone_proto_to_text. Bug: 135772972 Bug: 182489365 Change-Id: I3ca854546c38755b1f6410a1f6198a44d25ed1c5
* | Merge "[GWP-ASan] Add debuggerd end-to-end tests and remove unique wording."Peter Collingbourne2021-03-191-6/+4
|\ \
| * | [GWP-ASan] Add debuggerd end-to-end tests and remove unique wording.Mitch Phillips2021-03-111-6/+4
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Looks like we unintentionally had a breakage after aosp/1595302, where both GWP-ASan and MTE tests started failing because the extra information wasn't plumbed through the tombstones. MTE has end-to-end tests but aren't run continuously, and GWP-ASan was missing the e2e tests. Also remove some unique wording for GWP-ASan, a UaF on the free'd pointer is now "0 bytes into a 16-byte allocation" instead of "on a 16-byte allocation". The former is more descriptive and is more ubiquitously used in our tooling. This patch adds the E2E tests, but the underlying problem needs to be fixed as well, before this patch can land. Bug: 182489365 Test: atest debuggerd_test Change-Id: I0fe8aba7ea443b3071724987f46b19a6525cda3c
* / debuggerd: remove unused file.Elliott Hughes2021-03-161-37/+0
|/ | | | | Test: treehugger Change-Id: I17f5f88e91be3dccbf01b93ca93b0879a997bb4d
* [GWP-ASan] Update metadata field name.Mitch Phillips2021-02-101-6/+6
| | | | | | Bug: N/A Test: Build succeeds. Change-Id: I889fbc6722695c9c738352c174c8817548a0faa1
* Adjust to MapInfo to new api.David Srbecky2020-11-241-1/+1
| | | | Change-Id: Ic3818a8b001657e6b54ba6fcbf68f8c1d7ef2683
* Merge "debuggerd: use One True timestamp function."Elliott Hughes2020-07-241-7/+0
|\
| * debuggerd: use One True timestamp function.Elliott Hughes2020-07-231-7/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | An OEM asks for sub-second granularity, and that's most easily done if we only have one timestamp generator. I'm not convinced sub-second granularity is particularly useful myself, and I definitely don't think that nanosecond resolution is meaningful but I do like this cleanup, and if I'm going to use sub-second precision I may as well use the maximum precision available to me. Also reduce some duplication of code reading cmdline/comm. Bug: https://issuetracker.google.com/161860597 Test: head /data/tombstones/* Change-Id: I035ecfd4a3338ccd84dae0ef973a998a7c7c5056
* | Include memory tags in memory dump output.Peter Collingbourne2020-07-211-64/+66
| | | | | | | | | | | | | | | | | | | | Tags appear in the addresses printed in the memory dump, which seems like a reasonable place to put them because tagged addresses will also appear in other places in the tombstone, such as registers and the fault address. Bug: 135772972 Change-Id: I52da338347ff6b7503cf5ac80763c540695dc061
* | Adjust conditions for dumping the memory around a register.Peter Collingbourne2020-07-211-194/+63
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, we would do a simple bounds check before deciding whether to dump the memory around a register. On 64-bit platforms, the register's value was required to be less than (4 << 60). However, after stripping tags on AArch64 as part of r.android.com/1365229, all pointer values became less than (4 << 60), so the check became useless for filtering out invalid pointers. As a result, we would attempt to dump memory for all registers, which for a register not containing a valid pointer would typically consist of 16 lines of dashes. One possible fix may be to replace the constant (4 << 60) with the process's actual address space limit (known as TASK_SIZE inside the kernel; typically 39 bits on AArch64 and 48 bits on x86_64), but the kernel provides no API for retrieving a process's TASK_SIZE value. We could guess it by looking at for example the highest bit set in the value of getauxval(AT_EXECFN), which points to an address on the stack which typically is mapped at the end of the address space on program startup, but at least on AArch64 it is possible to dynamically extend TASK_SIZE at runtime by providing a hint to mmap(), so this is not always sufficient. Instead, it seems best to remove most of the early bounds check, and simply issue ptrace() calls for each register value, bailing out of the entire output if none of the calls ended up succeeding. This also has the nice side effect of avoiding 16 lines of noise per register whose value looks like a pointer but actually points to unmapped memory. We still retain part of the bounds check in order to avoid integer overflow during the dump (including overflows into the tag part of the address on architectures that support tagging). Bug: 154272452 Change-Id: I94e4b7124b7735b92fd83a49c80ebded3483cd4e
* Create a ProcessInfo structure with the process-wide information from the ↵Peter Collingbourne2020-02-281-1/+1
| | | | | | | | | | | | 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
* [GWP-ASan] Add GWP-ASan information to tombstones.Mitch Phillips2020-02-181-0/+134
| | | | | | | | | | | | | | | | | 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
* debuggerd: remove the raw stack dump.Elliott Hughes2020-01-221-464/+0
| | | | | | | | | | 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
* [debuggerd] fix -Wreorder-init-listNick Desaulniers2019-10-101-1/+1
| | | | | | | | | C++20 wants members to be ordered unlike C99. Bug: 139945549 Test: mm Change-Id: I3cbca589511c1e0bbc10c691949e18de77e16031 Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
* Add UID printing to tombstone headersMisha Wagner2019-04-231-0/+10
| | | | | | | | | This is for Android Telemetry to be able to categorise the processes that produce tombstones. Test: atest debugerd_test:TombstoneTest Change-Id: Ie635347c9839eb58bfd27739050bd68cbdbf98da
* Remove include of backtrace/Backtrace.h.Christopher Ferris2019-04-081-0/+1
| | | | | | | | | | | | 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
* Replace libbacktrace with libunwindstack directly.Christopher Ferris2019-01-293-238/+556
| | | | | | | | | | 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
* libdebuggerd: add timestamp to tombstones.Josh Gao2018-12-141-0/+8
| | | | | | Bug: http://b/120099273 Test: debuggerd_test Change-Id: I457506f8d9920d969e1eba0265f85693b484f1a9
* switch to using android-base/file.h instead of android-base/test_utils.hMark Salyzyn2018-11-141-2/+1
| | | | | | Test: compile Bug: 119313545 Change-Id: I4f7ad84743e974b4b4d1d7256088f6c8b749a237
* libdebuggerd: extract and print the fdsan table.Josh Gao2018-08-061-3/+3
| | | | | | | | | 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
* Include the map name when dumping memory around a register.Elliott Hughes2018-02-151-23/+23
| | | | | | Bug: http://b/19590178 Test: ran tests, ran crasher Change-Id: Ib9afa34c860d8732ef1943eb4decd0b7c8fb55fd
* Change all uintptr_t to uint64_t in API.Christopher Ferris2018-01-181-2/+2
| | | | | | | | | | | | | | | | | 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
* crash_dump: fork a copy of the target's address space.Josh Gao2017-12-156-367/+113
| | | | | | | | | | | | | | 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
* Only call one unwinder.Christopher Ferris2017-10-272-47/+6
| | | | | | | | | | 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
* libdebuggerd: fix tombstone tests.Josh Gao2017-10-101-11/+11
| | | | | | | 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
* libdebuggerd: cleanup.Josh Gao2017-08-296-5/+10
| | | | | | | | | 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
* Cleanup the libbacktrace interface a bit.Christopher Ferris2017-07-191-70/+70
| | | | | | | | | | | | - Change the field name load_base to load_bias (which is what it really is). - Add a rel_pc field so that callers do not need to compute it themselves. - Remove the BacktraceMap::GetRelativePc() since nobody should need to compute this themselves. Bug: 23762183 Test: Compiles and unit tests pass (debuggerd, libbacktrace). Change-Id: I2cb579767120adf08c407a58f3c487ee3f2b45fc
* Initialize si_code in siginfo.Christopher Ferris2017-03-221-2/+14
| | | | | | | | There was at least one failure due to si_code being unitialized and then examined. Test: Run the 32 bit and 64 bit version of the unit tests on angler. Change-Id: I5455a2cd29afafcd26a49f696e61141bb48478dc
* There's no longer a limit to property names.Elliott Hughes2017-02-281-1/+0
| | | | | | Bug: http://b/33926793 Test: boots Change-Id: I8554d7af74e064c114cf817f5a2ba1247fa2a2db
* debuggerd: advance our amazing bet.Josh Gao2017-01-1713-0/+1932
Remove debuggerd in favor of a helper process that gets execed by crashing processes. Bug: http://b/30705528 Test: debuggerd_test Change-Id: I9906c69473989cbf7fe5ea6cccf9a9c563d75906