summaryrefslogtreecommitdiff
path: root/debuggerd/debuggerd.cpp
AgeCommit message (Collapse)Author
2016-03-23debuggerd: waitpid for all children, and log the result.Josh Gao
Change-Id: Ic575e6db76ab153b4b238589a8cd299812d0e046
2016-03-23debuggerd: always send SIGCONT after detaching.Josh Gao
Bug: http://b/27330889 Change-Id: I104248af1cde03dbdbacc03c87fe7e2dffd6c037
2016-03-22Switch debuggerd over to unique_fd.Elliott Hughes
Change-Id: I858b9ac6a3ed47b4cc81cfe49f1ceb1e06356a03
2016-03-17debuggerd: don't apply timeout when wait_for_gdb is on.Josh Gao
Change-Id: Ic632dde4a0510c212a4b1c01890df9a41e9771c9 (cherry picked from commit 676a756b7b6e4028633dac85110767a3cf6785a7)
2016-03-17debuggerd: don't apply timeout when wait_for_gdb is on.Josh Gao
Change-Id: Ic632dde4a0510c212a4b1c01890df9a41e9771c9
2016-03-17debuggerd: don't send SIGSTOP to crashing processes.Josh Gao
This was actually nonfunctional until f5e8f0b, because it was using kill after privileges were dropped. This doesn't seem necessary after the changes to the sibling thread ptrace logic, though. Bug: http://b/27427439 Change-Id: I6bffbc14e0cf5e377bbfa39c945518e0d436c223 (cherry picked from commit b17f228ff6cdc73f0ca3ab4578f78faf1a7f1b86)
2016-03-17debuggerd: don't send SIGSTOP to crashing processes.Josh Gao
This was actually nonfunctional until f5e8f0b, because it was using kill after privileges were dropped. This doesn't seem necessary after the changes to the sibling thread ptrace logic, though. Bug: http://b/27427439 Change-Id: I6bffbc14e0cf5e377bbfa39c945518e0d436c223
2016-03-17debuggerd: monitor the worker process for failure.Josh Gao
Use sigtimedwait on SIGCHLD to watch our forked worker processes for failure, so that we can guarantee that we always resume/kill the target process if libunwind crashes. Bug: http://b/27427439 Change-Id: I5a5da1f1abd7dc9d01223f5b3778e946e2d47d20 (cherry picked from commit 630bc80e185f0c596a15822b67c62a0ecd6c982c)
2016-03-17debuggerd: fork the signal sender once.Josh Gao
Bug: http://b/27427439 Change-Id: I6294ff68a150bc9950a300264c31d2141307ac66 (cherry picked from commit f5e8f0b9cd9ec0214a6f9cd38dd6d9af3268f9aa)
2016-03-17Clean up CLOEXEC in debuggerd.Elliott Hughes
Change-Id: I1cd75f6a8f98e99f4a4fedfc706103ce34035765 (cherry picked from commit 17ba68d0cde001c2e73a310ee9a895a5b3bb5d32)
2016-03-17Remove dead code from debuggerd.Elliott Hughes
system/core/debuggerd/debuggerd.cpp:683:5: warning: Value stored to 'logsocket' is never read logsocket = -1; ^ ~~ Bug: http://b/27264392 Change-Id: I8eab8a02b67f219c32aea49e4d4957e5642df38f (cherry picked from commit 6da1353863dea7ed6835bd776a0cf4a49d12f910)
2016-03-17debuggerd: monitor the worker process for failure.Josh Gao
Use sigtimedwait on SIGCHLD to watch our forked worker processes for failure, so that we can guarantee that we always resume/kill the target process if libunwind crashes. Bug: http://b/27427439 Change-Id: I5a5da1f1abd7dc9d01223f5b3778e946e2d47d20
2016-03-17debuggerd: fork the signal sender once.Josh Gao
Bug: http://b/27427439 Change-Id: I6294ff68a150bc9950a300264c31d2141307ac66
2016-03-16debuggerd: kill crashing processes with the signal they died with.Josh Gao
Bug: http://b/27675306 Change-Id: I951c5d7e54c35d88c65c5dc856e0b9d5a93d47b2 (cherry picked from commit 561497c0a8073d8e04b387be0e0aa995424cee59)
2016-03-16debuggerd: kill crashing processes with the signal they died with.Josh Gao
Bug: http://b/27675306 Change-Id: I951c5d7e54c35d88c65c5dc856e0b9d5a93d47b2
2016-03-09debuggerd: make sure that we kill the process after dumping.Josh Gao
Bug: http://b/27367422 Change-Id: Icd704b1effd558904975cfc524714b51917a653f (cherry picked from commit f0c8723bddd00bcaccef59a5a4518cd8d2412d84)
2016-03-09debuggerd: make sure that we kill the process after dumping.Josh Gao
Bug: http://b/27367422 Change-Id: Icd704b1effd558904975cfc524714b51917a653f
2016-02-19Clean up CLOEXEC in debuggerd.Elliott Hughes
Change-Id: I1cd75f6a8f98e99f4a4fedfc706103ce34035765
2016-02-19Remove dead code from debuggerd.Elliott Hughes
system/core/debuggerd/debuggerd.cpp:683:5: warning: Value stored to 'logsocket' is never read logsocket = -1; ^ ~~ Bug: http://b/27264392 Change-Id: I8eab8a02b67f219c32aea49e4d4957e5642df38f
2016-01-15debuggerd: fix debug.debuggerd.wait_for_gdb.Josh Gao
Bug: http://b/26513486 Change-Id: I01c28ce810a49f8a4e0e2a86c7d018d95f9617c8
2016-01-14debuggerd: fix several bugs caused by fork/setuid change.Josh Gao
Previously, we weren't PTRACE_ATTACHing to all of the threads of a process, and we were also trying to do it after forking and dropping privileges. This patch ensures that all ptrace attaching/detaching happens in one place, before forking/exiting respectively. Bug: http://b/26443860 Bug: http://b/26436605 Bug: http://b/26436486 Change-Id: Id94e0c1d9d56c051d0dd281d895aaa3285079198
2016-01-05debuggerd: fork and drop privileges when dumping.Josh Gao
Bug: http://b/25195825 Change-Id: I913d8425232e79df3f7a051a8cc63de9c60f4780
2015-12-07Switch from using sockaddr to sockaddr_storage.Erik Kline
This is to ensure sufficient space is always available. Change-Id: Ifa87b93ecdc90dcacbfb24446c872344da6703d3
2015-11-17debuggerd: remove some levels of indentation.Josh Gao
Use ScopedFd and unique_ptr to manage resources, so that we can early exit instead of having 9 levels of indentation. Change-Id: Ia5fed76c7d959f1f198ea540c56c508f7e1585c4
2015-10-22Remove __DATE__/__TIME__ from init and debuggerdDan Willemsen
Keeping these means that every build has different init and debuggerd binaries, even if the source was the same. So OTAs that don't touch these sources would still need to update the binaries. Both of these messages are only informational, so can be safely removed. Bootchart already encodes build-specific information from the system properties. Bug: 24204119 Change-Id: I7ebd65a20a3e031e7528c9f741616e20b3cd7446
2015-10-06debuggerd: audit pid, uid and gid on SE Linux denialWilliam Roberts
When debugging SE Linux audit messages from debuggerd, its unclear what process is triggering the access violation. To assist in debugging, we also log pid, uid and gid. Before: avc: denied { dump_backtrace } for scontext=u:r:dumpstate:s0 ... After: avc: denied { dump_backtrace } for pid=198 uid=1019 gid=1019 .. Change-Id: I8263e6f5e77917139b73c3e84b76f7f97fd98003 Signed-off-by: William Roberts <william.c.roberts@intel.com>
2015-07-30bionic no longer sends SIGPIPE to debuggerd.Elliott Hughes
Static binaries don't get the signal handler installed (that's done by the dynamic linker) so we don't need to worry about seeing SIGPIPE crashes from old binaries. Bug: http://b/20659371 Change-Id: I3b5566634fadd3e822262561188d29814bccd1fd
2015-07-08New property that determines when to wait for gdb.Christopher Ferris
Use debug.debuggerd.wait_for_gdb being set to non-zero to determine if debuggerd should stop and wait for someone to attach gdb to the crashing process. Bug: 22233908 Change-Id: Id55a1572b479a70d395b7270392ce6fb70dbfdca
2015-07-07Fix debuggerd's gdbclient instructions.Elliott Hughes
We improved gdbclient to make the process simpler, but didn't update debuggerd to match. Bug: http://b/22233857 Change-Id: If4137943f567a9e566a3ac7f485c9b1eab2c68e9
2015-06-12Remove calls to is_selinux_enabled()Nick Kralevich
d34e407aeb5898f19d4f042b7558420bbb3a1817 removed support for running with SELinux completely disabled. SELinux must either be in permissive or enforcing mode now. Remove unnecessary calls to is_selinux_enabled(). It always returns true now. Change-Id: Ife3156b74b13b2e590afe4accf716fc7776567e5
2015-05-15Don't use TEMP_FAILURE_RETRY on close in system/core.Elliott Hughes
Bug: http://b/20501816 Change-Id: I1839b48ee4f891b8431ecb809e37a4566a5b3e50
2015-01-20Move 32 bit/64 bit check into debuggerd.Christopher Ferris
On 64 bit systems, calls to dump_backtrace_to_file or dump_tombstone try and directly contact the correct debuggerd (32 bit vs 64 bit) by reading the elf information for the executable. Unfortunately, system_server makes a call to dump_backtrace_to_file and it doesn't have permissions to read the executable data, so it defaults to always contacting the 64 bit debuggerd. This CL changes the code so that all dump requests go to the 64 bit debuggerd, which reads the elf information and redirects requests for 32 bit processes to the 32 bit debuggerd. Testing: - Forced the watchdog code in system_server to dump stacks and verified that all native stacks are dumped correctly. - Verified that dumpstate and bugreport still properly dump the native processes on a 64 bit and 32 bit system. - Intentionally forced the 64 bit to 32 bit redirect to write only a byte at a time and verified there are no errors, and no dropped data. - Used debuggerd and debuggerd64 to dump 32 bit and 64 bit processes seemlessly. - Used debuggerd on a 32 bit system to dump native stacks. Bug: https://code.google.com/p/android/issues/detail?id=97024 Change-Id: Ie01945153bdc1c4ded696c7334b61d58575314d1
2014-11-03Fix debuggerd issues.Christopher Ferris
- Fix a problem where a tid exits before the attach completes, and it causes debuggerd to self terminate. - Fix a problem where sibling tid dumps do not properly wait for the tid to get signalled. Bug: 17800180 Bug: 12567315 (cherry picked from commit 84ddb34a3af77dbe490aaa07b738bbfd7109d5ba) Change-Id: I45e33865614d4c96f4a89cf117398666b556d500
2014-07-24Add SELinux MAC to debuggerd.Stephen Smalley
debuggerd allows uid-0 processes to dump tombstones or backtraces of any process, and uid-system processes to dump backtraces of any processes. Restrict these operations via SELinux based on the client context, the target process context, and the action. Depends on I8e120d319512ff207ed22ed87cde4e0432a13dda for the corresponding policy definitions. Change-Id: Ib317564e54e07cc21f259e75124b762ad17c6e16 Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-06-27Fixed tid/pid mixup in debuggerd gdbclient output.Brigid Smith
Now the debugging output shows the tid of the crashed thread instead of the pid of the process that crashed. Change-Id: I637f409ff02d73d458edc6d1a5c462c21d128211
2014-06-24Fixed pathname for connecting to debugger.Brigid Smith
The debug output was still showing the pathname that worked with gdbclient before my changes, and therefore did not work after the fact. Change-Id: Ie12d79f5346088914ce0a70bda69780707b31d31
2014-06-19Fix debuggerd "format '%p'" build breakage.Elliott Hughes
Change-Id: I589d44485e55c23d1f1a6edfa8310a90cac2429e
2014-06-19Removed log.quiet and log = NULL cases from debuggerd.Brigid Smith
Now the functionality implemented by these semi-confusing cases has been replaced with the same logtype enum behavior that is easier to understand, and cases that used log-looking behavior to print to logcat (when log = NULL) now use the more transparent ALOGE/ALOGD functions. Change-Id: I7e38f2d4ca74a828df4d2266b3ea34edd3c6f5bb
2014-06-16Changing how debuggerd filters log messages to different locations.Brigid Smith
The system by which debuggerd filters its output to different locations is now based on an enum called logtype with easy to understand categories for log messages (like THREAD, MEMORY, etc.) instead of the old, fairly esoteric scope_flags variable. Now much of the output that previously went to logcat does not show up on the screen, but all output can be found in the tombstone file. In addition, the tombstone's location is now printed so it can be located easily. Bug: 15341747 Change-Id: Ia2f2051d1dfdea934d0e6ed220f24345e35ba6a2
2014-05-16Teach debuggerd the name of SIGTRAP.Elliott Hughes
Also add SIGTRAP to the list of signals we don't want to double fault on. Bug: 15024256 Change-Id: I23ab80800563c007fcd3e42527329fedf762f0c8
2014-05-16Remove the broken LED flashing code from debuggerd.Elliott Hughes
Change-Id: I4d0cbe14daa90ac5f91ce4597584448ee3c65dda
2014-05-16Output correct gdbserver instructions from debuggerd.Elliott Hughes
Bug: 15021938 Change-Id: I2df433d939f5f83ed2a2a30af357b83e4d8e5331
2014-05-16Add SIGTRAP support to crasher and debuggerd.Elliott Hughes
Bug: 15024256 Change-Id: I3f34993fcfd9799306852b0a2195db468370be6e
2014-04-25Use the si_code value bionic passes us.Elliott Hughes
Bionic needs to re-raise various signals, which means the si_code debuggerd sees has been clobbered. If bionic sends us the original si_code value, we can use that instead of the one we see when the ptrace the crashed process' siginfo. Change-Id: If116a6bc667d55a6fb39b74f96673292af4e4c8c
2014-02-07Use socklen_t instead of int in debuggerd.Elliott Hughes
Also other trivial C++ cleanup. Change-Id: I9b5278c5205e0ea4f9dcbbe3e7b99921dd2436dc
2014-01-30AArch64: Port debuggerdKévin PETIT
Change-Id: Ib18f76f375a1d70c84e0a09d221e17ac43144b96 Signed-off-by: Kévin PETIT <kevin.petit@arm.com>
2014-01-13Next phase of the move, reformat use C++ features.Christopher Ferris
Use the libbacktrace C++ interface instead of the C interface in debuggerd. Reformat the debuggerd code to be closer to Google C++ style. Fix all debuggerd casts to be C++ casts. Add a frame number to the frame data structure for ease of formatting and add another FormatFrameData function. Change the format_test to use the new FormatFrameData function. Modify all of the backtrace_test to use the C++ interface. Change-Id: I10e1610861acf7f4a3ad53276b74971cfbfda464
2014-01-10Move to C++ for debuggerd.Christopher Ferris
This is part 1, only including the bare minimum changes because our diff tool doesn't easily show differences when a file moves. This also breaks it into a small chunk in case some other changes break things, as unlikely as I think that will be. Change-Id: Ib7a3e7a2cc1ac574d15b65fda23813ebcf5d31af