summaryrefslogtreecommitdiff
path: root/debuggerd/debuggerd.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
| * debuggerd: don't send SIGSTOP to crashing processes.Josh Gao2016-03-171-5/+0
| | | | | | | | | | | | | | | | | | | | 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)
| * debuggerd: monitor the worker process for failure.Josh Gao2016-03-171-45/+111
| | | | | | | | | | | | | | | | | | | | 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)
| * debuggerd: fork the signal sender once.Josh Gao2016-03-171-91/+14
| | | | | | | | | | | | Bug: http://b/27427439 Change-Id: I6294ff68a150bc9950a300264c31d2141307ac66 (cherry picked from commit f5e8f0b9cd9ec0214a6f9cd38dd6d9af3268f9aa)
| * Clean up CLOEXEC in debuggerd.Elliott Hughes2016-03-171-9/+6
| | | | | | | | | | Change-Id: I1cd75f6a8f98e99f4a4fedfc706103ce34035765 (cherry picked from commit 17ba68d0cde001c2e73a310ee9a895a5b3bb5d32)
| * Remove dead code from debuggerd.Elliott Hughes2016-03-171-7/+0
| | | | | | | | | | | | | | | | | | | | 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)
| * debuggerd: kill crashing processes with the signal they died with.Josh Gao2016-03-161-5/+6
| | | | | | | | | | | | Bug: http://b/27675306 Change-Id: I951c5d7e54c35d88c65c5dc856e0b9d5a93d47b2 (cherry picked from commit 561497c0a8073d8e04b387be0e0aa995424cee59)
| * debuggerd: make sure that we kill the process after dumping.Josh Gao2016-03-091-61/+85
| | | | | | | | | | | | Bug: http://b/27367422 Change-Id: Icd704b1effd558904975cfc524714b51917a653f (cherry picked from commit f0c8723bddd00bcaccef59a5a4518cd8d2412d84)
* | Merge "debuggerd: waitpid for all children, and log the result."Josh Gao2016-03-231-1/+12
|\ \
| * | debuggerd: waitpid for all children, and log the result.Josh Gao2016-03-231-1/+12
| | | | | | | | | | | | Change-Id: Ic575e6db76ab153b4b238589a8cd299812d0e046
* | | Merge "debuggerd: always send SIGCONT after detaching."Josh Gao2016-03-231-12/+11
|\| |
| * | debuggerd: always send SIGCONT after detaching.Josh Gao2016-03-231-12/+11
| | | | | | | | | | | | | | | Bug: http://b/27330889 Change-Id: I104248af1cde03dbdbacc03c87fe7e2dffd6c037
* | | Switch debuggerd over to unique_fd.Elliott Hughes2016-03-221-2/+2
|/ / | | | | | | Change-Id: I858b9ac6a3ed47b4cc81cfe49f1ceb1e06356a03
* | debuggerd: don't apply timeout when wait_for_gdb is on.Josh Gao2016-03-171-3/+7
| | | | | | | | Change-Id: Ic632dde4a0510c212a4b1c01890df9a41e9771c9
* | debuggerd: don't send SIGSTOP to crashing processes.Josh Gao2016-03-171-5/+0
| | | | | | | | | | | | | | | | | | 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
* | debuggerd: monitor the worker process for failure.Josh Gao2016-03-171-45/+111
| | | | | | | | | | | | | | | | | | 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
* | debuggerd: fork the signal sender once.Josh Gao2016-03-171-91/+14
| | | | | | | | | | Bug: http://b/27427439 Change-Id: I6294ff68a150bc9950a300264c31d2141307ac66
* | debuggerd: kill crashing processes with the signal they died with.Josh Gao2016-03-161-5/+6
| | | | | | | | | | Bug: http://b/27675306 Change-Id: I951c5d7e54c35d88c65c5dc856e0b9d5a93d47b2
* | debuggerd: make sure that we kill the process after dumping.Josh Gao2016-03-091-61/+85
| | | | | | | | | | Bug: http://b/27367422 Change-Id: Icd704b1effd558904975cfc524714b51917a653f
* | Clean up CLOEXEC in debuggerd.Elliott Hughes2016-02-191-9/+6
| | | | | | | | Change-Id: I1cd75f6a8f98e99f4a4fedfc706103ce34035765
* | Remove dead code from debuggerd.Elliott Hughes2016-02-191-7/+0
|/ | | | | | | | | system/core/debuggerd/debuggerd.cpp:683:5: warning: Value stored to 'logsocket' is never read logsocket = -1; ^ ~~ Bug: http://b/27264392 Change-Id: I8eab8a02b67f219c32aea49e4d4957e5642df38f
* debuggerd: fix debug.debuggerd.wait_for_gdb.Josh Gao2016-01-151-21/+100
| | | | | Bug: http://b/26513486 Change-Id: I01c28ce810a49f8a4e0e2a86c7d018d95f9617c8
* debuggerd: fix several bugs caused by fork/setuid change.Josh Gao2016-01-141-97/+162
| | | | | | | | | | | | 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
* debuggerd: fork and drop privileges when dumping.Josh Gao2016-01-051-28/+66
| | | | | Bug: http://b/25195825 Change-Id: I913d8425232e79df3f7a051a8cc63de9c60f4780
* Switch from using sockaddr to sockaddr_storage.Erik Kline2015-12-071-3/+4
| | | | | | This is to ensure sufficient space is always available. Change-Id: Ifa87b93ecdc90dcacbfb24446c872344da6703d3
* debuggerd: remove some levels of indentation.Josh Gao2015-11-171-136/+123
| | | | | | | Use ScopedFd and unique_ptr to manage resources, so that we can early exit instead of having 9 levels of indentation. Change-Id: Ia5fed76c7d959f1f198ea540c56c508f7e1585c4
* Remove __DATE__/__TIME__ from init and debuggerdDan Willemsen2015-10-221-1/+1
| | | | | | | | | | | | | 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
* debuggerd: audit pid, uid and gid on SE Linux denialWilliam Roberts2015-10-061-8/+23
| | | | | | | | | | | | | | | 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>
* bionic no longer sends SIGPIPE to debuggerd.Elliott Hughes2015-07-301-1/+0
| | | | | | | | | 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
* New property that determines when to wait for gdb.Christopher Ferris2015-07-081-4/+1
| | | | | | | | | 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
* Fix debuggerd's gdbclient instructions.Elliott Hughes2015-07-071-20/+6
| | | | | | | | We improved gdbclient to make the process simpler, but didn't update debuggerd to match. Bug: http://b/22233857 Change-Id: If4137943f567a9e566a3ac7f485c9b1eab2c68e9
* Remove calls to is_selinux_enabled()Nick Kralevich2015-06-121-6/+0
| | | | | | | | | | | 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
* Don't use TEMP_FAILURE_RETRY on close in system/core.Elliott Hughes2015-05-151-5/+5
| | | | | Bug: http://b/20501816 Change-Id: I1839b48ee4f891b8431ecb809e37a4566a5b3e50
* Move 32 bit/64 bit check into debuggerd.Christopher Ferris2015-01-201-2/+107
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Fix debuggerd issues.Christopher Ferris2014-11-031-23/+19
| | | | | | | | | | | | | | - 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
* Add SELinux MAC to debuggerd.Stephen Smalley2014-07-241-0/+56
| | | | | | | | | | | | | 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>
* Fixed tid/pid mixup in debuggerd gdbclient output.Brigid Smith2014-06-271-5/+5
| | | | | | | Now the debugging output shows the tid of the crashed thread instead of the pid of the process that crashed. Change-Id: I637f409ff02d73d458edc6d1a5c462c21d128211
* Fixed pathname for connecting to debugger.Brigid Smith2014-06-241-11/+1
| | | | | | | 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
* Fix debuggerd "format '%p'" build breakage.Elliott Hughes2014-06-191-3/+1
| | | | Change-Id: I589d44485e55c23d1f1a6edfa8310a90cac2429e
* Removed log.quiet and log = NULL cases from debuggerd.Brigid Smith2014-06-191-42/+40
| | | | | | | | | 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
* Changing how debuggerd filters log messages to different locations.Brigid Smith2014-06-161-18/+17
| | | | | | | | | | | | | 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
* Teach debuggerd the name of SIGTRAP.Elliott Hughes2014-05-161-9/+7
| | | | | | | Also add SIGTRAP to the list of signals we don't want to double fault on. Bug: 15024256 Change-Id: I23ab80800563c007fcd3e42527329fedf762f0c8
* Remove the broken LED flashing code from debuggerd.Elliott Hughes2014-05-161-63/+2
| | | | Change-Id: I4d0cbe14daa90ac5f91ce4597584448ee3c65dda
* Output correct gdbserver instructions from debuggerd.Elliott Hughes2014-05-161-14/+34
| | | | | Bug: 15021938 Change-Id: I2df433d939f5f83ed2a2a30af357b83e4d8e5331
* Add SIGTRAP support to crasher and debuggerd.Elliott Hughes2014-05-161-2/+3
| | | | | Bug: 15024256 Change-Id: I3f34993fcfd9799306852b0a2195db468370be6e
* Use the si_code value bionic passes us.Elliott Hughes2014-04-251-6/+10
| | | | | | | | | 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
* Use socklen_t instead of int in debuggerd.Elliott Hughes2014-02-071-11/+9
| | | | | | Also other trivial C++ cleanup. Change-Id: I9b5278c5205e0ea4f9dcbbe3e7b99921dd2436dc
* AArch64: Port debuggerdKévin PETIT2014-01-301-1/+2
| | | | | Change-Id: Ib18f76f375a1d70c84e0a09d221e17ac43144b96 Signed-off-by: Kévin PETIT <kevin.petit@arm.com>
* Next phase of the move, reformat use C++ features.Christopher Ferris2014-01-131-447/+422
| | | | | | | | | | | | | | | | | 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
* Move to C++ for debuggerd.Christopher Ferris2014-01-101-0/+539
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