summaryrefslogtreecommitdiff
path: root/debuggerd/handler
AgeCommit message (Collapse)Author
2021-06-18Merge SP1A.210616.001Daniel Norman
Change-Id: Ifacd718e7a3cbde1afa75d11a1b14e64286c2847
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-03-29Merge SP1A.210329.001Scott Lobdell
Change-Id: I5658dcb0f7ed2ca7deb5eeb333981daaf76592ca
2021-03-17debuggerd: prepare to abandon ship^Wgdb.Elliott Hughes
Talk of "gdb" when we currently mean "gdb or lldb" and will soon mean "lldb" is starting to confuse people. Let's use the more neutral "debugger" in places where it really doesn't matter. The switch from gdbclient.py to lldbclient.py is a change for another day... Test: treehugger Change-Id: If39ca7e1cdf4c8bb9475f1791cdaf201fbea50e0
2021-02-08Merge SP1A.210208.001Daniel Norman
Change-Id: I16e0e3c65461673b714dd66a389670445608d017
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-26Merge SP1A.210122.003Scott Lobdell
Change-Id: Ife25f38176831b7e5595ab7a42c8690d88a12e77
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-25Merge changes from topic "tombstone_proto"Josh Gao
* changes: libdebuggerd: add protobuf implementation. tombstoned: support for protobuf fds. tombstoned: make it easier to add more types of outputs. tombstoned: switch from goto to RAII.
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
2021-01-19Remove unnecessary #includes.Elliott Hughes
Sadly, it looks like we do still really use libcutils for some of the socket functions. Test: treehugger Change-Id: Ic71f97507c89b10d2f3b7a2971064a9e6b1d349d
2020-11-30Merge SP1A.201130.001Daniel Norman
Change-Id: Ifcb754098c052feda32283cc056a9d760048832f
2020-11-13Switch to the new kernel API for obtaining fault address tag bits.Peter Collingbourne
The discussion on LKML is converging on v16 of the fault address tag bits patch [1]. In this version of the patch the presence of the tag bits in si_addr is controlled by a sa_flags bit, and a protocol is introduced to allow userspace to detect kernel support for sa_flags bits. Update the tombstone signal handler to use this API to read the tag bits, update the interceptors in libsigchain to implement the flag support detection protocol and hide the tag bits in si_addr from chained signal handlers that did not request them to match the kernel behavior. [1] https://lore.kernel.org/linux-arm-kernel/cover.1605235762.git.pcc@google.com/ Change-Id: I57f24c07c01ceb3e5b81cfc15edf559ef7dfc740
2020-10-15Merge SP1A.201015.001Scott Lobdell
Change-Id: Idf7137d68ac83320742eace6e055045c3279f769
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
2020-09-03Merge SP1A.200727.001Daniel Norman
Change-Id: I8f6750352c361cdc5b23825395234de12384ddd7
2020-04-10debuggerd: don't leave a zombie child if crash_dump is killed.Josh Gao
If crash_dump dies before it gets a chance to write to the pipe we use to let the debugged-process know that it successfully started, we weren't cleaning up the child we fork to start it, leaving a zombie child. Bug: http://b/152119184 Test: debuggerd_test Change-Id: Id01cc05f693995e9998941774f74ab8e3d8b4d8a
2020-03-30Merge "Read fault address on arm64 using proposed kernel API."Peter Collingbourne
2020-03-30Merge "Create a debugger_process_info data structure with the process info ↵Peter Collingbourne
pointers."
2020-03-27Read fault address on arm64 using proposed kernel API.Peter Collingbourne
On aarch64, the top 8 bits of the address (i.e. the tag bits) of the fault address in si_addr are always clear. This isn't ideal for MTE which will require these bits in order to correctly diagnose tag mismatches. A proposed kernel patch [1] exposes the full fault address including the tag bits as part of the ucontext. Change debuggerd to read this fault address if available. [1] https://patchwork.kernel.org/patch/11435077/ Bug: 135772972 Change-Id: Ia05be574113860f4e9ecc36a310c4b740e0c4afb
2020-03-24Create a debugger_process_info data structure with the process info pointers.Peter Collingbourne
Similar to r.android.com/1247247 I'll be adding more of them for MTE. Also, change the protocol between the crasher and crash_dump to make it easier to add new fields and change the referenced data structures without needing to worry about versioning. The version number for static executables is now always 1 (where the protocol will never change), while the version number for dynamic executables is always 4 (where the protocol can change, because the linker and crash_dump are version locked). Bug: 135772972 Change-Id: Ib4696d0544d7c87cb429aaaa15f18c3640059e16
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-24Merge RP1A.200221.003Bill Peckham
Change-Id: I3c418d0dd1be8839a740194f461ad38e278f4343
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-23Merge RP1A.200123.001Steven Laver
Change-Id: I9a5261600a4bbae9e68b1e7ee554be2fd1c7525c
2020-01-17debuggerd_handler: increase thread stack size.Josh Gao
1 page isn't enough to log on AArch64, and clean pages are free, so increase the stack size to 8 pages. Bug: http://b/144887737 Test: treehugger Change-Id: I731b3bc27ab37f4b830a9478a04cd34d4f7648d3
2020-01-06Merge RP1A.200106.001Steven Laver
Change-Id: Iac92eee679219e76109967cf7d49914759313ccd
2019-12-17debuggerd: switch to using platform headers for DEBUGGER_SIGNAL.Josh Gao
Test: treehugger Change-Id: Ie9736c4a077dba1029d2352bd94d47ce07323aec
2019-11-05Merge RP1A.191024.001Steven Laver
Change-Id: Ia87bdd95c8f51e6fdb6ce86b473189bc073862bc
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-05-02Merge QP1A.190501.001Scott Lobdell
Change-Id: I4400cfb92e362af46838594efd98e636c24189ca
2019-04-26Merge QP1A.190418.001Scott Lobdell
Change-Id: I5dab30887faa50059b7023ed316e66ffd3553695
2019-04-17debuggerd: call setsid in our children.Josh Gao
There appears to be a kernel bug that causes SIGHUP and SIGCONT to be sent to the parent process group we spawn from if the process group contains stopped jobs (e.g. the parent itself, because of wait_for_gdb). Call setsid in all of our children to prevent this from happening. Bug: http://b/31124563 Test: adb shell 'setprop debug.debuggerd.wait_for_gdb 1; killall -ABRT surfaceflinger' Change-Id: I1a48d70886880a5bfbe2deb80d48deece55faf09 (cherry picked from commit 18cb6812474e00050efab19e242c8a04ed470bec)
2019-04-16debuggerd: call setsid in our children.Josh Gao
There appears to be a kernel bug that causes SIGHUP and SIGCONT to be sent to the parent process group we spawn from if the process group contains stopped jobs (e.g. the parent itself, because of wait_for_gdb). Call setsid in all of our children to prevent this from happening. Bug: http://b/31124563 Test: adb shell 'setprop debug.debuggerd.wait_for_gdb 1; killall -ABRT surfaceflinger' Change-Id: I1a48d70886880a5bfbe2deb80d48deece55faf09
2019-04-12Revert "Check for data races when reading JIT/DEX entries."David Srbecky
This reverts commit 85b5fecec920208ec43b42488f08d4c2e5aaeda2. Reason for revert: Breaks ART tests, reverting to investigate. Exempt-From-Owner-Approval: Revert. (cherry picked from commit b9cc4fbb268652744c812415cb2e5d1fbe04879a) Bug: 130406806 Change-Id: I634e37060b97484d627fc544e3b406fd90aaa784
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-04-04Merge QP1A.190404.001Scott Lobdell
Change-Id: I8b3fd7290b0ec86f06977ee73d12c16a64a0889b
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-26Merge QP1A.190324.001Scott Lobdell
Change-Id: Ib8e341b5da57c0db00a208d1a8323bef84e9124f
2019-03-18debuggerd_handler: demote abort on exec failure to log.Josh Gao
If a process is ptraced already, we might not be able to exec crash_dump due to selinux. Since we can be called for non-fatal events, we shouldn't abort in that case. Bug: http://b/128054996 Test: treehugger Change-Id: I1442041caa7af908df2ab87b9e010c44082e7587
2019-02-07Merge QP1A.190205.002Yifan Hong
Conflicts: libprocessgroup/sched_policy.cpp Bug: 124069173 Change-Id: I0409464e297a67f5d615e50f928ff52da3bb7f31
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-11-21Merge QP1A.181119.002Bill Peckham
Change-Id: I08e78c1c547910eedc83f919facb680355372cb2
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-24Merge QP1A.180918.001Bill Peckham
Change-Id: I6e221d7a92b6ecb92bb8364757522d4906b86877
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-08-31Merge QP1A.180823.001Bill Peckham
Change-Id: I43a054f155f100b3d7f414e17d3af9b900a05ab5
2018-08-27debuggerd_handler: receive abort messages via sigqueue(DEBUGGER_SIGNAL).Josh Gao
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