Commit Graph

186 Commits

Author SHA1 Message Date
Christopher Ferris 9774df6134 Move 32 bit/64 bit check into debuggerd.
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
2015-01-20 17:22:07 -08:00
Elliott Hughes c184d5655a #include <arpa/inet.h> for htonl.
Not sure why this only shows up with clang.

Change-Id: Id5603483e32f8a8d4b091dbb31b3142e3f77deac
2014-12-18 23:49:17 +00:00
Yabin Cui 2331b95609 Make crasher smash-stack work.
Bug: 18721888
Change-Id: Id0280df7cb2c29832256d3d395e6399fcef9aa2b
2014-12-11 17:49:12 -08:00
Dmitriy Ivanov 052fc0a225 Print ASCII near register for all archs
Bug: 17880617
Change-Id: I6870e8ac670c08e45d8efb64479976a38edfdc93
2014-12-10 10:21:12 -08:00
Dan Albert 80b88cb5d2 Move debuggerd to libc++.
Bug: 15193147
Change-Id: I935a08e98077b688d1735fb5b84a615cb7df8810
2014-11-15 16:35:30 -08:00
Christopher Ferris d4c7a1cfad am a11ac455: Merge "Fix debuggerd issues."
* commit 'a11ac45536f0722becefccdb6b58378c5d9d0d4b':
  Fix debuggerd issues.
2014-11-03 20:23:55 +00:00
Christopher Ferris 1072f917cf Fix debuggerd issues.
- 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 84ddb34a3a)

Change-Id: I45e33865614d4c96f4a89cf117398666b556d500
2014-11-03 11:26:33 -08:00
Chih-Hung Hsieh 845867b2c2 am d88323b2: Merge "Add volatile to avoid clang optimization."
* commit 'd88323b2667c443c2738eb601eb0b9eaad1c3049':
  Add volatile to avoid clang optimization.
2014-10-28 04:49:12 +00:00
Chih-Hung Hsieh a1ff475b07 Add volatile to avoid clang optimization.
BUG: 18108178
Change-Id: Ie5b8b1808fcf6d1eacc14a7c6ac0c8d49641fec2
2014-10-23 16:50:51 -07:00
Jeff Brown 55fbad69a1 am c3e6eb21: Merge "Move ABI: line below header when dumping stacks." into lmp-dev
* commit 'c3e6eb21b58ae3067ed03358687d1edb851f2abf':
  Move ABI: line below header when dumping stacks.
2014-09-12 05:43:08 +00:00
Jeff Brown 9b12d53b1a Move ABI: line below header when dumping stacks.
Bug: 17474152
Change-Id: I66b6e7e1cbb004f7a1915a2c1515df6555fe176f
2014-09-11 14:20:04 -07:00
Dmitriy Ivanov a639b97d4a Do not suppress maps dump when si_addr<PAGE_SIZE
Also remove alignment of si_addr.

(cherry picked from commit f10aa3ae9d)

Bug: 16950250
Change-Id: I60170b9eb7dd8fe99c0eeeaec74d13cfbaa920d9
2014-08-11 10:01:58 -07:00
Dmitriy Ivanov c326115115 am 75ef453e: am 2f40ddf3: Merge "Do not suppress maps dump when si_addr<PAGE_SIZE"
* commit '75ef453e5d3352aad8c55cd8fa572945c6f4bbfa':
  Do not suppress maps dump when si_addr<PAGE_SIZE
2014-08-10 00:08:34 +00:00
Dmitriy Ivanov f10aa3ae9d Do not suppress maps dump when si_addr<PAGE_SIZE
Also remove alignment of si_addr.

Change-Id: Ie5445bf8a5baa49e04e37c643c25ebd0f1dc9d22
2014-08-09 12:07:51 -07:00
Mark Salyzyn a9d3ed32e9 am 1d497f8a: am cddc97cb: Merge "debuggerd: tombstone: suppress logger request for logd process"
* commit '1d497f8a92994abeb5baeaacdec037268838af20':
  debuggerd: tombstone: suppress logger request for logd process
2014-07-29 23:26:05 +00:00
Mark Salyzyn 45ae446cab debuggerd: tombstone: suppress logger request for logd process
Change-Id: I619880342ee6febd1a6cc98d2a4f536120efc1c8
2014-07-28 15:16:05 -07:00
Mark Salyzyn 2f2e79de0c debuggerd: tombstone: suppress logger request for logd process
(cherry pick from 45ae446cab)

Change-Id: I619880342ee6febd1a6cc98d2a4f536120efc1c8
2014-07-29 16:13:23 -07:00
Brigid Smith 166cfe68c3 Added default constructor for log_t.
Bug: 16357258

(cherry picked from commit c75a02fe3f)

Change-Id: I96be34ee1664af54b0dcbc928ea542cd749852fd
2014-07-29 16:08:34 -07:00
Nick Kralevich d753da344e am c70ebca4: am 6bc762b2: Merge "Add SELinux MAC to debuggerd."
* commit 'c70ebca44cc37b0d261736446ccf52bbdb61e7d1':
  Add SELinux MAC to debuggerd.
2014-07-24 20:31:11 +00:00
Stephen Smalley 69b800391c Add SELinux MAC to debuggerd.
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-07-24 16:01:56 -04:00
Elliott Hughes 8d2136922a am 4a95a209: am 719fd238: Merge "Added default constructor for log_t."
* commit '4a95a209e8fc472461aa75282b486e1860edde19':
  Added default constructor for log_t.
2014-07-17 23:09:05 +00:00
Brigid Smith c75a02fe3f Added default constructor for log_t.
Bug: 16357258
Change-Id: I39169b35653d2b717fadbcff75978db01cc375ef
2014-07-17 15:49:39 -07:00
Nick Kralevich 04f9b2a809 debuggerd: use O_NOFOLLOW|O_CLOEXEC for tombstones
Change-Id: I71bdfba30346a9fad3129b404f39eda8190698e3
2014-07-16 20:08:41 -07:00
Elliott Hughes e9f7361ea9 Add SIGFPE to crasher.
Bug: 3399996

(cherry picked from commit 3ecc42106e)

Change-Id: I075613ca3c022ce8d38a06a5ba236ceff32d181c
2014-07-15 13:18:32 -07:00
Elliott Hughes aae5d43755 Add missing arm64 registers.
Also fix dumping of arm64's vector registers, which are actually 128 bits wide.

Also move the arm/arm64 FP registers to the tombstone. (We've never dumped
them at all for the other architectures.)

(cherry picked from commit b40c50351e)

Change-Id: Ic646fb9ea01e9beb42e1757feb8742c1d4efafa7
2014-07-14 18:56:53 -07:00
Elliott Hughes 3ecc42106e Add SIGFPE to crasher.
Bug: 3399996
Change-Id: I115caf846a47f57984c1b1844104e37d29e6f24e
2014-07-15 11:38:47 -07:00
Elliott Hughes b40c50351e Add missing arm64 registers.
Also fix dumping of arm64's vector registers, which are actually 128 bits wide.

Also move the arm/arm64 FP registers to the tombstone. (We've never dumped
them at all for the other architectures.)

Change-Id: I239a86dd225b47fa90109bc824b7610df67ad812
2014-07-14 17:12:20 -07:00
Elliott Hughes cb7aae167e Fix arm emulator "D register out of range for selected VFP version" build failure.
Change-Id: Ia37cb3f8ecb00a927fa3fc8b4131c158413646e7
2014-07-09 16:41:04 -07:00
Elliott Hughes e7f18e14a9 Integrate vfp-crasher with crasher.
There's no good reason to separate "fill the integer registers with
recognizable patterns and crash" from "fill the FP registers with recognizable
patterns and crash".

Also remove the incorrect use of ARCH_ARM_HAVE_VFP_D32 rather than try to fix
it.

Change-Id: I3a4a3aca1575de5489314027ae52168997404d79
2014-07-09 12:19:32 -07:00
Elliott Hughes 7e775952e1 Fix LP64 tombstone.cpp build failure.
Change-Id: Id071417f56dd883e9d2e38a6f3296cb23a0352fb
2014-07-08 11:35:58 -07:00
Brigid Smith 8606eaa770 Improving maps output.
Maps output now displays fault address location more intelligently.  If
the fault is not in a mapped region, it now shows where that address is
with respect to the other maps.

In addition, the size of the map is now printed as part of the output.

Also, crasher now supports an "mmap" option which mmaps/munmaps a region
of memory and then attempts to access it, causing a fault address in
between mapped regions that can be used to test that new part of the
maps output.

Change-Id: Ia5e1926802bdfcbbdb7857e3631ddf395ae0c5b8
2014-07-08 10:53:49 -07:00
Mark Salyzyn 17e85c0671 debuggerd: synchronize cosmetics to internal
Change-Id: I66bc2b181cd75da188c046571492224d5ac3fc98
2014-06-27 15:55:19 -07:00
Elliott Hughes e080be5754 Merge "Fixed tid/pid mixup in debuggerd gdbclient output." 2014-06-26 18:34:59 +00:00
Brigid Smith 75582957cf Fixed tid/pid mixup in debuggerd gdbclient output.
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-27 09:21:12 -07:00
Mark Salyzyn e43290d7ed tombstone: log output header suppressed in crash
Bug: 15520846
Change-Id: I18934cc60af3dda98ab729fbabc4c7a66834512e
2014-06-27 10:32:22 -07:00
Michael Wright 80f596984e Print ABI in backtraces.
This lets the stack tool figure out which toolchain to use
automatically.

Change-Id: Ia235d6904622423fe6fbc7b0315a1861e52a41ad
2014-06-24 17:14:26 -07:00
Brigid Smith 20c214f857 Fixed pathname for connecting to debugger.
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-24 10:04:41 -07:00
Brigid Smith f473200d35 Fixing debuggerd header output.
PID and TID output line was missing.

Change-Id: I609af5727bc22ea0b97f3975ddb3cf0102910bc2
2014-06-23 11:03:40 -07:00
Brigid Smith 2e8290463e Maps output now marks the fault address location.
If the fault address is not within a mapped region, it logs an error
message after the output.  Otherwise, it prefixes the location of the
fault address with "--->" to make it easier to locate.

Change-Id: I330adaade4402ffeb09f1a6d34a944c2f054d06d
2014-06-20 09:30:16 -07:00
Elliott Hughes e901c1bf8a Fix debuggerd "format '%p'" build breakage.
Change-Id: I589d44485e55c23d1f1a6edfa8310a90cac2429e
2014-06-19 11:46:27 -07:00
Brigid Smith e17f267b2a Updated non-ARM archs to reflect logging changes.
Change-Id: I0af865881c19ea4a57ec1aa9455bc32c08a60d75
2014-06-19 11:33:38 -07:00
Brigid Smith 50eb546ec1 Removed log.quiet and log = NULL cases from debuggerd.
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-19 10:59:01 -07:00
Brigid Smith 7b2078eeb4 Changed maps output in debuggerd.
Now the map output is only sent to the tombstone, and the entire
contents of /prod/$PID/maps is logged, not just 3 lines.  Additionally,
crasher now supports "crasher SIGSEGV-non-null", which attempts to write to a
dereferenced function address, causing a SIGSEGV at a non-zero address.
This new crasher mode can be used to test the new maps output.

Bug: 15343662
Change-Id: I796d92e8352a6b9714bbbfe96f3143c56565ef2f
2014-06-17 15:32:22 -07:00
Brigid Smith 1babede38b Fixed logcat debug output issue.
Change-Id: Ibeb048b683ec11b05af23371e5e4b17cdd50fea0
2014-06-17 14:24:43 -07:00
Brigid Smith 62ba489ba0 Changing how debuggerd filters log messages to different locations.
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-06-16 14:41:21 -07:00
Elliott Hughes 20df39a089 Merge "Adding ABI output to debuggerd tombstones." 2014-06-04 21:11:47 +00:00
Brigid Smith 9c8dacce55 Adding ABI output to debuggerd tombstones.
Bug: 15084471
Change-Id: If9fb260a3403e86f80928f2f5f79331fc0936030
2014-06-04 12:29:24 -07:00
Christopher Ferris 3520086e3d Fix x86 and x86_64 builds.
Change-Id: I1ee9117843aff2abe4067f288b8496d4bfc78c9e
2014-06-03 17:13:37 -07:00
Elliott Hughes ddde05f3ee Merge "[MIPS64] Build debuggerd for mips64" 2014-06-03 23:26:33 +00:00
Duane Sand a80b759857 [MIPS64] Build debuggerd for mips64
Change-Id: I361e9668baa218fc01e723c2df1a34ca6329cf47
2014-06-03 16:24:57 -07:00