summaryrefslogtreecommitdiffstats
path: root/debuggerd/libdebuggerd
Commit message (Collapse)AuthorAgeFilesLines
* libdebuggerd: decode fdsan owner tags.Josh Gao2018-08-281-2/+5
| | | | | Test: debuggerd `pidof system_server` | grep " fd " Change-Id: Ic4bb30b8602acf5912e776a61825d9645ec93c65
* debuggerd: delete accidentally merged log spam.Josh Gao2018-08-211-1/+0
| | | | | Test: none Change-Id: I4237b4f0c8d5cdc559766fc3c73742b013c1df86
* libdebuggerd: extract and print the fdsan table.Josh Gao2018-08-063-17/+94
| | | | | | | | | 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
* Clean up logging code.Christopher Ferris2018-07-161-27/+19
| | | | | Test: Verify that tombstones still contain the log message data. Change-Id: I303dec944e58a0c4f5edfed22caaf1f2462ea3e8
* Add support for new defines in v4.17.3 headers.Christopher Ferris2018-06-291-17/+29
| | | | | Test: Builds and unit tests pass. Change-Id: Ibd5711effb1e599d3239d45124383fe91e0f573d
* Improve SIGILL support.Elliott Hughes2018-05-301-4/+11
| | | | | | | | | | | | | | | | | | | 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
* Show signal sender for SI_FROMUSER signals.Elliott Hughes2018-04-263-27/+43
| | | | | | | | | | | | | | | 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
* libdebuggerd: fix out of bounds write.Josh Gao2018-04-201-3/+2
| | | | | | Bug: http://b/78363964 Test: treehugger Change-Id: I79ae818e4e0c29f064335d59789afc3b1bf87c69
* libdebuggerd: clone registers before we Unwind with them.Josh Gao2018-04-201-1/+3
| | | | | | Bug: http://b/77296294 Test: manual inspection of tombstone generated by crasher Change-Id: I4b017701d7d2041db4aefbbb90977e99b844c328
* debuggerd: remove maximum abort message length.Josh Gao2018-04-132-17/+18
| | | | | | | | Let the logging implementation be the imposer of limits. Bug: http://b/64759619 Test: debuggerd_test Change-Id: I8bc73bf2301ce071668993b740880224846a4e75
* Include the map name when dumping memory around a register.Elliott Hughes2018-02-154-38/+42
| | | | | | Bug: http://b/19590178 Test: ran tests, ran crasher Change-Id: Ib9afa34c860d8732ef1943eb4decd0b7c8fb55fd
* Fix regression caused by libbacktrace API change.Christopher Ferris2018-01-201-1/+1
| | | | | | | | | | | 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
* Change all uintptr_t to uint64_t in API.Christopher Ferris2018-01-185-27/+27
| | | | | | | | | | | | | | | | | 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
* debuggerd: restore the location of abort message.Josh Gao2017-12-221-4/+4
| | | | | | | | | 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
* Increased number of Android log lines for tombstoneschirag honnavar2017-12-181-1/+1
| | | | | | | | 5 lines are not enough for debug Bug: b/69815742 Change-Id: I3117f221f4945941ec277064ffd2765dda74e192
* crash_dump: fork a copy of the target's address space.Josh Gao2017-12-1523-1347/+618
| | | | | | | | | | | | | | 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
* Demand read load bias for a map.Christopher Ferris2017-12-051-14/+15
| | | | | | | | | | | | | | | | | | | 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
* Only call one unwinder.Christopher Ferris2017-10-274-135/+22
| | | | | | | | | | 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
* Merge "Move some properties users to __system_property_read_callback()"Tom Cherry2017-10-121-11/+8
|\
| * Move some properties users to __system_property_read_callback()Tom Cherry2017-10-101-11/+8
| | | | | | | | | | | | | | | | | | | | 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
* | libdebuggerd: fix tombstone tests.Josh Gao2017-10-102-15/+17
|/ | | | | | | 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
* Show the number of VMAs in the tombstone.Elliott Hughes2017-09-261-5/+7
| | | | | | | | | | 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
* debuggerd_fallback: print maps.Josh Gao2017-09-131-1/+13
| | | | | | | Bug: http://b/63400743 Bug: http://b/65590288 Test: killall -ABRT media.codec Change-Id: I58e47dcd8e99ad7a5945604c27876dd01259e501
* libdebuggerd: cleanup.Josh Gao2017-08-2923-88/+44
| | | | | | | | | 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
* Define current ABI string in android-base/macros.hdimitry2017-08-231-18/+1
| | | | | Test: make Change-Id: I8200d7b3232edba43a583c5ff1e1b0f78c768f69
* Compare new unwinder to old unwinder in debuggerd.Christopher Ferris2017-08-112-16/+88
| | | | | | | | | | | 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
* Cleanup the libbacktrace interface a bit.Christopher Ferris2017-07-192-72/+72
| | | | | | | | | | | | - 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
* Decode ptrace-induced SIGTRAP si_code values.Elliott Hughes2017-06-211-0/+20
| | | | | | | | | | | | | Example: signal 5 (SIGTRAP), code -32763 (PTRACE_EVENT_STOP), fault addr 0x274e00005fb3 I'm tempted to say that %d isn't the best choice for si_code, but as long as we're fully decoding all the values, I don't think it matters. Bug: http://b/62856172 Test: manual debuggerd run Change-Id: Ieeca690828e1e12f4162bbadece53f4aa7b9537a
* libdebuggerd: print the build fingerprint in fallback.Josh Gao2017-05-081-0/+2
| | | | | | Bug: http://b/37798209 Test: killall -ABRT media.codec on internal Change-Id: I0ff1fc5ca1e0bcec2c1b2553d6af7099deebfeda
* libdebuggerd: implement fallback register dumping on arm/aarch64.Josh Gao2017-05-084-27/+45
| | | | | | Bug: http://b/35439781 Test: killall -ABRT media.codec on internal Change-Id: I7a23d3bfcf07ad584e677b2ef5fff28436ef0972
* crash_dump: during early boot, output to kmsg on userdebug.Josh Gao2017-04-061-1/+45
| | | | | | | | | | | | | | | Crashes that happen before tombstoned is running are extremely hard to diagnose, because tombstones aren't written to disk, and the window of opportunity to get logs via `adb logcat` is small (potentially nonexistent). Solve this by adding a world-writable /dev/kmsg_debug on userdebug builds, and writing to it in addition to logcat when tombstoned hasn't started yet. Bug: http://b/36574794 Test: stop tombstoned; crasher; dmesg Change-Id: Ib22c02a002afb602933155fb2c9b7a8abbe9ed38
* 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
* Do not access device maps.Christopher Ferris2017-03-221-1/+1
| | | | | | | | | | | | | It's possible that a device map has memory controlled by a single entry device driver. Thus, you can deadlock if a process is touching that device memory and we try to unwind it and also touch that device memory. Simply skip any attempts to step through, or get function names from device memory maps. Bug: 36130325 Test: Ran new unit tests, ran bionic unit tests, ran art ThreadStress. Change-Id: Ibc62d7ec8106c619ee08968f05e04aea55d7cbfa
* crash_dump: fetch process/thread names before dropping privileges.Josh Gao2017-03-156-95/+85
| | | | | | | | | | | | Processes that don't have dumpable set to 1 cannot have their process/thread names read by processes that don't have all of their capabilities. Fetch these names in crash_dump before dropping privileges. Bug: http://b/36237221 Test: debuggerd_test Test: debuggerd -b `pidof android.hardware.bluetooth@1.0-service` Change-Id: I174769e7b3c1ea9f11f9c8cbdff83028a4225783
* crash_dump: fix warnings, turn on -Werror.Josh Gao2017-03-131-0/+1
| | | | | Test: mma Change-Id: I0722fef7b513be976cbbe89f73e8bb7138a80442
* libdebuggerd: add compatibility shim.Josh Gao2017-03-091-0/+6
| | | | | | | | | | Avoid breaking internal code when AOSP automerges to internal. This will be reverted after fixing up the uses on the other end. Bug: http://b/35858739 Test: treehugger Change-Id: If1ee03d8d7c218d3ad9f451cfe9a9077753dda02
* debuggerd_handler: implement missing fallback functionality.Josh Gao2017-03-094-9/+55
| | | | | | | | | 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
* Define _LOG as a weak symbol.Chenjie Luo2017-03-061-0/+1
| | | | | | | | | So _LOG could be overridden by customized logging implementations in non-Android systems. Bug: 35919515 Test: Test on device Change-Id: I0885c15353c0b1bf66f6f156e7f502f326b85d57
* Small debuggerd improvements.Elliott Hughes2017-03-021-1/+2
| | | | | | | | | | | | Include the ABI in seccomp causes. Slightly improved command-line usage information. Fix crasher for seccomp failures. Bug: N/A Test: crasher Change-Id: Ie419ecfe72ee4f5ccf49c927be18350a58a66a90
* There's no longer a limit to property names.Elliott Hughes2017-02-281-1/+0
| | | | | | Bug: http://b/33926793 Test: boots Change-Id: I8554d7af74e064c114cf817f5a2ba1247fa2a2db
* libdebuggerd_handler: in-process crash dumping for seccomped processes.Josh Gao2017-02-152-24/+49
| | | | | | | | | 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
* Better seccomp/kuser_helper diagnostics from debuggerd.Elliott Hughes2017-02-011-11/+37
| | | | | | | | | | 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
* debuggerd: advance our amazing bet.Josh Gao2017-01-1730-0/+3935
Remove debuggerd in favor of a helper process that gets execed by crashing processes. Bug: http://b/30705528 Test: debuggerd_test Change-Id: I9906c69473989cbf7fe5ea6cccf9a9c563d75906