summaryrefslogtreecommitdiff
path: root/debuggerd/debuggerd.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Always use main thread pid for manual dumping.Christopher Ferris2021-07-301-4/+18
| | | | | | | | | | | | | | | | | | | | | | | When running debuggerd from the command line, it's possible that the signal will happen on a side thread. The original intercept in tombstoned is set to only handle crashes from the main thread pid, so in this case, the intercept doesn't occur. To fix this, modify the code so that running debuggerd always sends the signal to the main pid. In addition, modify the signal handler is entered due to the BIONIC_SIGNAL_DEBUGGER signal, then the crashing tid is set to the main thread pid instead of the current thread. Add unit test to cover this case. Bug: 194346289 Test: All unit tests pass. Test: Verify the new unit test is getting the signal on the non-main Test: thread and still properly handling the intercept. Test: Modify the debuggerd code to send the signal to the non main pid Test: and verify the dump still occurs correctly. Change-Id: I2dd1bd11fc8ef4a6fe87f05ecc67ae349a101c82
* debuggerd: add support for Java traces.Josh Gao2018-06-141-5/+17
| | | | | Test: `debuggerd -j $(pidof com.android.settings)` Change-Id: I051c9b6d313e5350416b3d0743c3fc75f43fbd0c
* Remove unnecessary SELinux dependenciesNick Kralevich2017-07-011-1/+0
| | | | | | | These are unused. Test: code compiles. Change-Id: Idd707dfcc8f6daac3a489c791ecc364841cf31f9
* debuggerd: diagnostics for dumps that are guaranteed to fail.Josh Gao2017-06-271-0/+19
| | | | | | | | | Print diagnostics when the user requests a dump that is guaranteed to fail, such as trying to dump a process you can't send a signal to. Bug: http://b/63008395 Change-Id: I5c6bf2a5751f858e0534990b8d2ab6932eb9f11d Test: manually tested
* tombstoned: allow intercepts for java traces.Narayan Kamath2017-05-311-2/+2
| | | | | | | | | | | | | | | | | All intercept requests and crash dump requests must now specify a dump_type, which can be one of kDebuggerdNativeBacktrace, kDebuggerdTombstone or kDebuggerdJavaBacktrace. Each process can have only one outstanding intercept registered at a time. There's only one non-trivial change in this changeset; and that is to crash_dump. We now pass the type of dump via a command line argument instead of inferring it from the (resent) signal, this allows us to connect to tombstoned before we wait for the signal as the protocol requires. Test: debuggerd_test Change-Id: I189b215acfecd08ac52ab29117e3465da00e3a37
* tombstoned: Add a shared library version of libtombstoned_client...Narayan Kamath2017-05-221-1/+1
| | | | | | | | | | | | | | | | | | | .. for ART and the frameworks to link against. In the new stack dumping scheme (see related bug), the Java runtime will communicate with tombstoned in order to obtain a FD to which it can write its traces. Also move things around to separate headers that are private implementation details from headers that constitute the public debuggerd API. There are currently only three such headers : - tombstoned/tombstoned.h - debuggerd/client.h - debuggerd/handler.h Bug: 32064548 Test: make Change-Id: If1b8578550e373d84828b180bbe585f1088d1aa3
* Small debuggerd improvements.Elliott Hughes2017-03-021-3/+5
| | | | | | | | | | | | 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
* debuggerd: fix `debuggerd <pid>`Josh Gao2017-01-301-1/+1
| | | | | | Bug: none Test: `debuggerd mediaserver` Change-Id: Ibd7bbddb92a99ce49622c0ecc9329a3723f2085d
* debuggerd: advance our amazing bet.Josh Gao2017-01-171-910/+41
| | | | | | | | | Remove debuggerd in favor of a helper process that gets execed by crashing processes. Bug: http://b/30705528 Test: debuggerd_test Change-Id: I9906c69473989cbf7fe5ea6cccf9a9c563d75906
* liblog: use log/log.h when utilizing ALOG macrosMark Salyzyn2017-01-111-1/+1
| | | | | | Test: compile Bug: 30465923 Change-Id: Id6d76510819ebd88c3f5003d00d73a0dbe85e943
* Merge "debuggerd: Dump list of open files on process crash."Richard Uhler2016-11-301-5/+13
|\ | | | | | | | | | | am: b675f7cd32 Change-Id: Iec231fc7eb57fa2c51aabc0fb75b4a09c47004cd
| * debuggerd: Dump list of open files on process crash.Richard Uhler2016-11-211-5/+13
| | | | | | | | | | | | | | | | | | | | Test: Open a bunch of files, wait for the process to crash, verify dubuggerd includes the list of open files the tombstone it generates. Test: Added OpenFilesListTest to debuggerd_test. Bug: 32013594 Change-Id: I6f939ae1d04dc58dc99abff0ed930da9e0ef0d1c
* | Merge "system/core: preparation to pull back interfaces from android/log.h"Mark Salyzyn2016-10-201-0/+2
|\| | | | | | | | | | | am: 27d2d49f48 Change-Id: I604bb1d4cf62636663fa92e3d14a55887dbcae23
| * system/core: preparation to pull back interfaces from android/log.hMark Salyzyn2016-10-201-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Point to log/log.h where necessary, define LOG_TAG where necessary. Accept that private/android_logger.h is suitable replacement for log/logger.h and android/log.h. Correct liblog/README Effectively a cleanup and controlled select revert of 'system/core: drop or replace log/logger.h' and 'system/core: Replace log/log.h with android/log.h'. Test: compile Bug: 30465923 Change-Id: Ic2ad157bad6f5efe2c6af293a73bb753300b17a2
* | Merge commit 'd3896c106d6a6e4d461be658a9e66efbde31f28d' into nyc-dev-plus-aospJosh Gao2016-10-101-3/+5
|\| | | | | | | Change-Id: I77d77be5ba21c55cdf1172d7a7f7b4ba04dcbc81
| * debuggerd: report crashes even when out of file descriptors.Josh Gao2016-10-071-3/+5
| | | | | | | | | | | | | | | | | | Use nasty clone hacks to let us close random file descriptors to be able to connect to debuggerd when the fd table is full. Bug: http://b/32013594 Test: crasher exhaustfd-SIGSEGV Change-Id: I47772e9a5994da4473bd935b105d9c36827c017a
* | Merge "system/core: drop or replace log/logger.h" am: 1f90485804Mark Salyzyn2016-10-041-4/+2
|\| | | | | | | | | | | am: cb670780be Change-Id: I532a0f6143511f53f3303751f95de115ac034cd7
| * system/core: drop or replace log/logger.hMark Salyzyn2016-10-041-4/+2
| | | | | | | | | | | | | | | | | | | | | | debuggerd does not require log/logger.h, can use android/log.h In some cases, mark why log/logger.h was required. Test: Compile and boot smoke test Bug: 26552300 Bug: 31289077 Bug: 31456426 Change-Id: Ia34987e25a01d81971ec8d785415f732b8376c4f
* | Merge "Fix debuggerd argument parsing." am: 99ed65234cElliott Hughes2016-09-161-21/+17
|\| | | | | | | | | | | am: 014d9df418 Change-Id: I2565eb9a4b631e51bfe6bd57d328c8cdd2c3eff6
| * Fix debuggerd argument parsing.Elliott Hughes2016-09-151-21/+17
| | | | | | | | | | | | | | | | | | We weren't detecting incorrect input before. Also clean up the help output to match the style of all the toybox output. Also flush stdout so that we don't report failure before even saying that we're going to try to contact debuggerd... Change-Id: I9e4bfa878f270fe46c3c210c7a7138959a108d67
* | Merge "Most accept/accept4 calls in system/core don't actually want the ↵Elliott Hughes2016-08-231-5/+1
|\| | | | | | | | | | | | | | | remote address." am: 299d64144b am: 8615d79d85 Change-Id: I89aeabf6efa8217c9acd3f8a766bbd18f7e994fa
| * Merge "Most accept/accept4 calls in system/core don't actually want the ↵Elliott Hughes2016-08-231-5/+1
| |\ | | | | | | | | | | | | | | | | | | | | | remote address." am: 299d64144b Change-Id: I3fb9678dfed08f0b1d6e90e547ecae6cdcabc9a1
| | * Most accept/accept4 calls in system/core don't actually want the remote address.Elliott Hughes2016-08-231-5/+1
| | | | | | | | | | | | | | | | | | | | | So don't write the extra code for it or waste the kernel's time copying it around. Change-Id: I93de64064c2d4fe58ba5b5322cfa69bf31a76dad
* | | Merge "debuggerd: set SOCK_NONBLOCK in accept rather than later." am: 82b67fff06Elliott Hughes2016-08-231-3/+1
|\| | | | | | | | | | | | | | | | | am: 0d2ef3dc86 Change-Id: Ie8ae5707455f4d1741ca87ef515ea9a142e05aa5
| * | Merge "debuggerd: set SOCK_NONBLOCK in accept rather than later."Elliott Hughes2016-08-231-3/+1
| |\| | | | | | | | | | | | | | | | am: 82b67fff06 Change-Id: I6f2e72a4847fbfac8e1ba78321be7e026f7629bd
| | * debuggerd: set SOCK_NONBLOCK in accept rather than later.Elliott Hughes2016-08-221-3/+1
| | | | | | | | | | | | Change-Id: I95586984dd7aec798d75b150be238d5f6f7c91da
* | | Merge "debuggerd: remove unnecessary arguments." am: 7a746f3a68Josh Gao2016-08-131-6/+6
|\| | | | | | | | | | | | | | | | | am: 60083bed75 Change-Id: I6f575a9662319db0dffeb121e0400eaa8f8cee55
| * | Merge "debuggerd: remove unnecessary arguments."Josh Gao2016-08-131-6/+6
| |\| | | | | | | | | | | | | | | | am: 7a746f3a68 Change-Id: I0a01639dd3096372eb5bbbe28362cdbf1c1da4af
| | * debuggerd: remove unnecessary arguments.Josh Gao2016-08-121-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | These were previously required when bionic used tgkill to reraise signals, but now that we use rt_tgsigqueueinfo to reraise signals, they are no longer necessary. Change-Id: I46ba9f14039a727d0a2c4c3a9d93a3532ba8f263
* | | Merge "debuggerd: remove useless timeout from wait_for_signal." am: 5f2bc28ebfJosh Gao2016-08-121-2/+3
|\| | | | | | | | | | | | | | | | | am: 4c4a172ee9 Change-Id: Ibbf4ff52d9349e8ceee5a6550c997328b204f332
| * | Merge "debuggerd: remove useless timeout from wait_for_signal."Josh Gao2016-08-121-2/+3
| |\| | | | | | | | | | | | | | | | am: 5f2bc28ebf Change-Id: Iee4f22c04ad330c91f86ca03583f8e36b2816039
| | * debuggerd: remove useless timeout from wait_for_signal.Josh Gao2016-08-121-2/+3
| | | | | | | | | | | | | | | | | | | | | The watchdog already handles things for us, so the timeout logic in wait_for_signal is pointless. Change-Id: Id81ad5f294068216b73e04c4e2ceca072ae1bbc0
* | | Merge \"debuggerd: verify that traced threads belong to the right process.\" ↵Josh Gao2016-07-191-12/+62
|\ \ \ | |/ / |/| | | | | | | | | | | | | | | | | into nyc-dev am: d3d04f4d72 Change-Id: I65cd7507a24b7148dd67d748dede8e664dd70328
| * | debuggerd: verify that traced threads belong to the right process.Josh Gao2016-07-131-12/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix two races in debuggerd's PTRACE_ATTACH logic: 1. The target thread in a crash dump request could exit between the /proc/<pid>/task/<tid> check and the PTRACE_ATTACH. 2. Sibling threads could exit between listing /proc/<pid>/task and the PTRACE_ATTACH. Bug: http://b/29555636 Change-Id: I4dfe1ea30e2c211d2389321bd66e3684dd757591
* | | Merge changes from topic \'debuggerd_client\'Josh Gao2016-06-201-1/+1
|\ \ \ | | |/ | |/| | | | | | | | | | am: abf88685e3 Change-Id: I2a61e4e8b5ec5a4ab6566ab4f8eb31653255fbc5
| * | debuggerd: add libdebuggerd_client.Josh Gao2016-06-171-1/+1
| | | | | | | | | | | | | | | Bug: http://b/24414818 Change-Id: I079c534d2c952b6975bf0428eb86cc7a55525737
| * | Set groups before dropping privileges.Christopher Ferris2016-05-051-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The code for dumping tombstones tries to read the log data. This was silently failing after the change to drop root privileges. Fix this by explicitly setting the groups allowed before dropping privileges. Bug: 28590884 (cherry picked from commit edc23801091f1a909efe130e0dba8abab3329eb5) Change-Id: I225365edccb11f8752027566fd42f3b10ce10260
| * | Fix problem with wait_for_gdb.Christopher Ferris2016-05-051-7/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When someone enables wait_for_gdb, activity manager will kill the stopped process before a developer can attach to the process. To allow debugging in this case, change the code to only contact the activity manager right before continuing the process that is crashing. Also, modify the conditions under which to do a gdb attach. The previous code did a partial attach if perform_dump failed. The new version simply allows an attach regardless of whether perform_dump passes or fails. Bug: 28409358 (cherry picked from commit 9818bd2bbee00c387247210eeae2a0a0d3912c8b) Change-Id: I42f464b69332748e16b07d9d00f44b3aa26ce8b7
| * | Connect to activity manager as root.Christopher Ferris2016-04-201-4/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before dropping root privileges, connect to the activity manager. Also, only connect to the activity manager if this is a crash. Bug: 28210681 (cherry picked from commit 0fc89f34b99f20f0ebc0111df74490f4ebd44076) Change-Id: Id25b92e550d71ffe1b9eafe43976ef514a83714b
* | | Merge "Set groups before dropping privileges." into nyc-devChristopher Ferris2016-05-051-2/+10
|\ \ \ | | |/ | |/| | | | | | | | | | | | | | | | | | | am: fd1eee58f9 * commit 'fd1eee58f985b3d528ca352ff278d7b200390ab2': Set groups before dropping privileges. Change-Id: I85c98abb0e7cc3b36ec714899540d65e6ca908c7
| * | Set groups before dropping privileges.Christopher Ferris2016-05-051-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | The code for dumping tombstones tries to read the log data. This was silently failing after the change to drop root privileges. Fix this by explicitly setting the groups allowed before dropping privileges. Bug: 28590884 Change-Id: Iaccb1d2928268fc9fc855f6e3814c31ce019badf
* | | Merge "Fix problem with wait_for_gdb." into nyc-devChristopher Ferris2016-05-051-7/+58
|\| | | | | | | | | | | | | | | | | | | | | | | | | | am: a7431cfa57 * commit 'a7431cfa570c6385ecd2041d56ead2603d7b7b80': Fix problem with wait_for_gdb. Change-Id: I6d995c423f4ad9134965a215b1eea4cc7fd338b9
| * | Fix problem with wait_for_gdb.Christopher Ferris2016-05-041-7/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When someone enables wait_for_gdb, activity manager will kill the stopped process before a developer can attach to the process. To allow debugging in this case, change the code to only contact the activity manager right before continuing the process that is crashing. Also, modify the conditions under which to do a gdb attach. The previous code did a partial attach if perform_dump failed. The new version simply allows an attach regardless of whether perform_dump passes or fails. Bug: 28409358 Change-Id: I4fe8d390c212d47e007cbe6543c2d114c3c7aeff
* | | Connect to activity manager as root.Christopher Ferris2016-04-201-4/+52
|\| | | | | | | | | | | | | | | | | | | | | | | | | | am: 0fc89f3 * commit '0fc89f34b99f20f0ebc0111df74490f4ebd44076': Connect to activity manager as root. Change-Id: I28ad7d209d6d94be790bd4ffd1e5b31da4cd8589
| * | Connect to activity manager as root.Christopher Ferris2016-04-201-4/+53
| | | | | | | | | | | | | | | | | | | | | | | | Before dropping root privileges, connect to the activity manager. Also, only connect to the activity manager if this is a crash. Bug: 28210681 Change-Id: Ie266031910519fa2aa6835644a95c1fc56e24d8d
* | | debuggerd: add SIGSYS to the list of handled signals.Josh Gao2016-03-261-0/+1
|\| | | |/ |/| | | | | | | | | am: dfa163d * commit 'dfa163df500ca71b71be315aa55e8859c946d0fb': debuggerd: add SIGSYS to the list of handled signals.
| * debuggerd: add SIGSYS to the list of handled signals.Josh Gao2016-03-251-0/+1
| | | | | | | | | | | | | | | | | | | | | | Processes using seccomp will get SIGSYS when attempting to use a disallowed syscall. We're currently not handling SIGSYS in bionic's signal handler, but this change will let us dump a backtrace pointing at rt_tgsigqueueinfo in our signal handler if seccomp policies block it during a real crash. Bug: http://b/27853687 Change-Id: I4e4aacc95eeef7249d895e19dc4ccd77a51c7a17
| * debuggerd: waitpid for all children, and log the result.Josh Gao2016-03-231-1/+12
| | | | | | | | | | Change-Id: Ic575e6db76ab153b4b238589a8cd299812d0e046 (cherry picked from commit 280800552165b4685fbe86fd8e9dc3b9d9b062cb)
| * debuggerd: always send SIGCONT after detaching.Josh Gao2016-03-231-12/+11
| | | | | | | | | | | | Bug: http://b/27330889 Change-Id: I104248af1cde03dbdbacc03c87fe7e2dffd6c037 (cherry picked from commit 24464185eb260b4af577895e1c2d35b734a7f99b)
| * debuggerd: don't apply timeout when wait_for_gdb is on.Josh Gao2016-03-171-3/+7
| | | | | | | | | | Change-Id: Ic632dde4a0510c212a4b1c01890df9a41e9771c9 (cherry picked from commit 676a756b7b6e4028633dac85110767a3cf6785a7)