summaryrefslogtreecommitdiffstats
path: root/debuggerd
Commit message (Collapse)AuthorAgeFilesLines
* Use new static target for libdexfile_support.Martin Stjernholm2019-02-121-11/+4
| | | | | | | | | | | This is necessary since the dynamic one is now using dlopen(), which isn't available in static builds. Test: m Test: mmma system/core/{libunwindstack,libbacktrace}, run host gtests (cannot get atest to work) Bug: 123403798 Bug: 123186083 Change-Id: I06a9cdfe7e7cc01427ffd54b66c8ebab88782260
* Replace libbacktrace with libunwindstack directly.Christopher Ferris2019-01-2912-541/+729
| | | | | | | | | | 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
* debuggerd: Fix return type in error caseGreg Kaiser2019-01-081-1/+1
| | | | | | | | With our method returning 'bool', a "return -1" is interpretted as 'true'. We change this to an explicit 'false', as desired. Test: TreeHugger Change-Id: I222858b797bc4242a2dc6d4fe81df3d2586d055a
* debuggerd_client: resolve tid to tgid when dumping Java stacks.Josh Gao2019-01-042-2/+16
| | | | | | | Bug: http://b/121438213 Test: debuggerd_test32 Test: debuggerd_test64 Change-Id: I4d114c8b0c4586ba64de5b45b47b0ec5c10354f8
* Revert^2 "Use libdexfile external API in libunwindstack."Martin Stjernholm2018-12-191-2/+21
| | | | | | | | | | | | | | | | This reverts commit cacf5bf6bca7e9806739a27589d8b6101c567c32. Reason for revert: Re-apply with proper fix for VNDK visibility on marlin and sailfish. Test: Manual repro of http://b/121110092#comment1 on reported branch Test: atest CtsRenderscriptTestCases Test: mmma system/core/{libunwindstack,libbacktrace}, run host gtests Test: Make image, flash, and reboot device. Test: Forrest cts/art/gce-all: https://android-build.googleplex.com/builds/forrest/run/L00300000240828791 Test: Forrest cts/bionic/gce-all: https://android-build.googleplex.com/builds/forrest/run/L05600000240682947 (shows 27/2958 failed, but it doesn't pass on Blackbox either: http://screen/xbjioEf6UgR) Test: Forrest cts/renderscript/gce-all: https://android-build.googleplex.com/builds/forrest/run/L66200000240680523 Bug: 119632407 Change-Id: I601aa97eac8127e30d753405f8bc1fc4ae7f849f
* Revert "Use libdexfile external API in libunwindstack."Martin Stjernholm2018-12-191-21/+2
| | | | | | | | | | | | | | | This reverts commit 444e23d2fc6d7c6f799ff9e2f69c1a82d2960c5b. The rest of the topic doesn't need to be reverted. Reason for revert: Breaks renderscript on marlin and sailfish. Test: Manual repro of http://b/121110092#comment1 on reported branch Test: "atest CtsRenderscriptTestCases" on that branch Test: mmma system/core/{libunwindstack,libbacktrace}, run host gtests Test: Make image, flash, and reboot device. Bug: 121110092, 119632407 Change-Id: If1976b19ce386c95bc5bd4fd6d523745c167de18
* Merge "libdebuggerd: add timestamp to tombstones."Josh Gao2018-12-152-0/+18
|\
| * libdebuggerd: add timestamp to tombstones.Josh Gao2018-12-142-0/+18
| | | | | | | | | | | | Bug: http://b/120099273 Test: debuggerd_test Change-Id: I457506f8d9920d969e1eba0265f85693b484f1a9
* | Use libdexfile external API in libunwindstack.Martin Stjernholm2018-12-131-2/+21
|/ | | | | | | Test: mmma system/core/{libunwindstack,libbacktrace}, run host gtests Test: Make image, flash, and reboot device. Bug: 119632407 Change-Id: I370f089a1b20ba432e136818b4325d46f99df708
* C++17 is the default now.Elliott Hughes2018-12-031-1/+0
| | | | | Test: builds Change-Id: I6814455e9ad2cdcf99ad66de38a3ad0bfb440d80
* Merge "tombstoned: fixed tombstones failed issue"Elliott Hughes2018-11-291-0/+8
|\
| * tombstoned: fixed tombstones failed issueJinguang Dong2018-11-281-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is a problem about tombstone, which it will fail to generate tombstone file in some scenarios due to socket communication exception. Reproduce step: step 1: reboot device step 2: ps -ef |grep zygote , get the pid of zygote64 (Attention: zygote64 should never been killed or reboot, otherwise we can get the tombstone file) step 3: kill -5 pid of zygote64 step 4: cd data/tombstones/, and could not find the tombstone file of zygote64. [Cause Analysis] 1. There are following logs by logcat: 11-19 15:38:43.789 569 569 F libc : Fatal signal 5 (SIGTRAP), code 0 (SI_USER) in tid 569 (main), pid 569 (main) 11-19 15:38:43.829 6115 6115 I crash_dump64: obtaining output fd from tombstoned, type: kDebuggerdTombstone 11-19 15:38:43.830 569 5836 I Zygote : Process 6114 exited cleanly (0) 11-19 15:38:43.830 777 777 I /system/bin/tombstoned: received crash request for pid 569 11-19 15:38:43.831 6115 6115 I crash_dump64: performing dump of process 569 (target tid = 569) ... 11-19 15:38:43.937 777 777 W /system/bin/tombstoned: crash socket received short read of length 0 (expected 12) 2. The last log was print by function of crash_request_cb in file of tombstoned.cpp, following related code: rc = TEMP_FAILURE_RETRY(read(sockfd, &request, sizeof(request))); if (rc == -1) { PLOG(WARNING) << "failed to read from crash socket"; goto fail; } else if (rc != sizeof(request)) { LOG(WARNING) << "crash socket received short read of length " << rc << " (expected " << sizeof(request) << ")"; goto fail; } Tombstoned read message by socket, and now the message length is zero. Some socket communication exception occurs at that time. We try to let crash_dump resend the socket message when the communication is abnormal. Just as this CL. Test: 1 reboot device 2 ps -ef |grep zygote , get the pid of zygote64 (Attention: zygote64 should never been killed or reboot, otherwise we can get the tombstone file) 3 kill -5 pid of zygote64 4 cd data/tombstones/, and could find the tombstone file of zygote64. Change-Id: Ic152b081024d6c12f757927079fd221b63445b18
* | Tombstone support for XOM-related SIGSEGVs.Ivan Lozano2018-11-271-3/+10
|/ | | | | | | | | | 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
* 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
* Merge "debuggerd_fallback: fix fd leak."Treehugger Robot2018-10-311-2/+3
|\
| * debuggerd_fallback: fix fd leak.Josh Gao2018-10-301-2/+3
| | | | | | | | | | | | | | | | | | | | 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
* | Update for v4.19 kernel headers.Christopher Ferris2018-10-301-1/+3
|/ | | | | | | | Add new trap type TRAP_UNK. Test: Unit tests pass. Change-Id: I2b9cb8ddd1d993aa4819831aaca34f8da4286b52 (cherry picked from commit ead88bc88e567182b3c6ae5fd2f17730f55ec3f3)
* Fix two clang-tidy issues in crasher.cpp.Stephen Hines2018-09-241-1/+5
| | | | | | | | | | | | | | | TEMP_FAILURE_RETRY's result was unused for the call to read(), so now mark it as such to silence a possible unused result warning. For __read_chk(), this function is an internal implementation detail of FORTIFY in Bionic. Under clang-tidy, FORTIFY checks are actually removed, so this now results in an unknown function being called. The code should not be explicitly depending on an implementation detail, but we can just suppress the failing case to retain test coverage of the actual implementation. Bug: http://b/110779387 Test: Build using WITH_TIDY=1 Change-Id: If83ac1d6f3b6dc32c0d0fb56d8e675e53b586f78
* Merge "crash_dump: annotate intended fallthrough."Treehugger Robot2018-09-191-0/+2
|\
| * crash_dump: annotate intended fallthrough.Josh Gao2018-09-181-0/+2
| | | | | | | | | | | | Bug: http://b/116020901 Test: treehugger Change-Id: I5d059d051fb257efe7f7e1790fd0bc2abd364167
* | tombstoned: don't generate tombstones for native backtraces.Josh Gao2018-09-142-2/+47
| | | | | | | | | | | | | | | | | | | | Previously, if an intercept ends before we ask for a file descriptor when doing a backtrace, we'll create a tombstone file instead. Bug: http://b/114139908 Bug: http://b/115349586 Test: debuggerd_test32 Change-Id: I23c7bb8ae5a982a4374a862d0a4f17bee03eb1d9
* | Fix multithreaded backtraces for seccomp processes.Josh Gao2018-09-124-11/+75
|/ | | | | | | | | | | 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
* debuggerd_client: improve error logging.Josh Gao2018-09-061-8/+16
| | | | | | | | | | | | system_server is sometimes failing to dump with the following error: libdebuggerd_client: received packet of unexpected length from tombstoned: expected 128, received -1 Improve the logging to try to figure out what's going on. Bug: http://b/114139908 Test: treehugger Change-Id: Iee1bdc0891b9fc7bd80a330495ec22a530febddb
* libdebuggerd: decode fdsan owner tags.Josh Gao2018-08-281-2/+5
| | | | | Test: debuggerd `pidof system_server` | grep " fd " Change-Id: Ic4bb30b8602acf5912e776a61825d9645ec93c65
* debuggerd_test: add test for fdsan abort message.Josh Gao2018-08-271-0/+26
| | | | | | | Bug: http://b/112770187 Test: debuggerd_test Test: bionic-unit-tests Change-Id: Ia93761e89074aea4629b8d0f232c580d6f0f249c
* debuggerd_handler: receive abort messages via sigqueue(DEBUGGER_SIGNAL).Josh Gao2018-08-271-9/+19
| | | | | | | | | Make it possible for code such as fdsan that generates debugging tombstones via raise(DEBUGGER_SIGNAL) to pass an abort message as well. Bug: http://b/112770187 Test: debuggerd_test Change-Id: Idc34263241c18033573e466da3a45aa6f716ddb3
* 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-065-21/+108
| | | | | | | | | 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
* crash_dump: pass the address of the fdsan table.Josh Gao2018-08-064-25/+69
| | | | | | | | | Pass the address of the fdsan table down to crash_dump so that we can dump the fdsan table along with the open file descriptor list. Test: debuggerd_test Test: manually ran an old static_crasher Change-Id: Icbac5487109f2db1e1061c4d46de11b016b299e3
* crasher: add close(fileno(FILE*)) and close(dirfd(DIR*)).Josh Gao2018-07-181-32/+40
| | | | | | | Add some cases to trigger fdsan aborts. Test: crasher fdsan_file; crasher fdsan_dir Change-Id: I48152d333dc25900f1c8d8e0f2e8728154643508
* debuggerd_handler: use syscall(__NR_close) instead of close.Josh Gao2018-07-181-2/+12
| | | | | | | | Avoid bionic's file descriptor ownership checks by calling the close syscall manually. Test: debuggerd_test Change-Id: I10af6aca0e66fe030fd7a53506ae61c87695641d
* 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
* Merge "debuggerd: add support for Java traces."Treehugger Robot2018-06-151-5/+17
|\
| * debuggerd: add support for Java traces.Josh Gao2018-06-141-5/+17
| | | | | | | | | | Test: `debuggerd -j $(pidof com.android.settings)` Change-Id: I051c9b6d313e5350416b3d0743c3fc75f43fbd0c
* | Shared libs are supported in recovery modeJiyong Park2018-06-101-1/+8
|/ | | | | | | | | | | | | | | | | | | | | | | | | | adbd has been built as a static executable since the same binary was copied to the recovery partition where shared library is not supported. However, since we now support shared library in the recovery partition, adbd is built as a dynamic executable. In addition, the dependency from adbd to libdebuggerd_handler is removed as debuggerd is handled by the dynamic linker. A few more modules in /system/core are marked as recovery_available: true as they are transitive dependencies of the dynamic linker. This change also includes ld.config.recovery.txt which is the linker config file for the recovery mode. It is installed to /etc/ld.config.txt and contains linker namespace config for the dynamic binaries under /sbin. Bug: 63673171 Test: `adb reboot recovery; adb devices` shows the device ID Test: Select 'mount /system' in the recovery mode, then `adb shell`. $ lsof -p `pidof adbd` shows that libm.so, libc.so, etc. are loaded from the /lib directory. Change-Id: I363d5a787863f1677ee40afb5d5841321ddaae77
* Improve SIGILL support.Elliott Hughes2018-05-302-4/+22
| | | | | | | | | | | | | | | | | | | 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
* Build adbd for recoveryJiyong Park2018-05-241-0/+4
| | | | | | | | | | | | | adbd (and its dependencies) are marked as recovery_available:true so that recovery version of the binary is built separately from the one for system partition. This allows us to stop copying the system version to the recovery partition and also opens up the way to enable shared libraries in the recovery partition. Then we can also build adbd as a dynamic executable. Bug: 79146551 Test: m -j adbd.recovery Change-Id: Ib95614c7435f9d0afc02a0c7d5ae1a94e439e32a
* Merge "debuggerd: fix CrasherTest.seccomp_crash_oom."Treehugger Robot2018-05-191-1/+10
|\
| * debuggerd: fix CrasherTest.seccomp_crash_oom.Josh Gao2018-05-161-1/+10
| | | | | | | | | | | | | | | | | | | | 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
* | Expect optional (offset ...) in frame dump.Chih-Hung Hsieh2018-05-141-1/+6
|/ | | | | | | | | * New lld could create files that map to non-zero offset at run time. Test: debuggerd_test Bug: 79590156 Change-Id: I12db0ebef489ba8a1e648a29d214f8d3c3703996
* Merge "Remove unnecessary references to libunwind."Christopher Ferris2018-05-041-2/+0
|\
| * Remove unnecessary references to libunwind.Christopher Ferris2018-05-031-2/+0
| | | | | | | | | | | | | | Bug: 79209464 Test: Builds. Change-Id: I4193ac664e3b118270a17fcc0131fb6c6e384c41
* | tombstoned: make missing O_TMPFILE workaround actually work around.Josh Gao2018-05-031-9/+22
|/ | | | | | | | | We can't actually link an unlinked file back onto disk if it wasn't opened with O_TMPFILE. Switch to using a temporary filename instead. Bug: http://b/77729983 Test: agampe Change-Id: I1970497114f0056065a1ba65f6358f08b51ec551
* tombstoned: don't bail out if we fail to unlink a file that isn't there.Josh Gao2018-05-031-1/+1
| | | | | Test: crasher with no tombstones Change-Id: I20e0537a347dd1f83877150ab13f53441dd65d95
* Merge "tombstoned: don't create tombstones for failed dumps."android-build-prod (mdb)2018-05-021-28/+47
|\
| * tombstoned: don't create tombstones for failed dumps.Josh Gao2018-04-191-28/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | Instead of creating tombstone FDs in place and passing them out to crash_dump directly, create them as O_TMPFILEs and link them into place when crash_dump reports success, to avoid creating empty tombstones in cases like an aborting thread racing with another thread that manages to cleanly exit_group before the dump finishes. Bug: http://b/77729983 Test: debuggerd_test Test: adb shell 'for x in `seq 0 50`; do crasher; done' Change-Id: I31ce4fd4a524abf8bde57152450209483d9d0ba9
* | Fix a debuggerd test expectation.Elliott Hughes2018-05-021-1/+3
| | | | | | | | | | | | | | | | | | 70d8f289454c9b691ec5421b0ed0354b6baaace8 broke a test that was not expecting to see the new detail about the signal's sender. Bug: http://b/78594105 Test: ran tests Change-Id: Idfa3a53b9e664308efdba560ffbb1401c1904530
* | Merge "Add test_suites lines."Elliott Hughes2018-04-281-0/+2
|\ \
| * | Add test_suites lines.Elliott Hughes2018-04-271-0/+2
| | | | | | | | | | | | | | | | | | Bug: N/A Test: builds Change-Id: Ic5e2b9206bcfcb53c774989013b5db6aab462e42