Commit Graph

89 Commits

Author SHA1 Message Date
Nick Kralevich
cd67e9f059 dumpstate: add O_CLOEXEC
Add O_CLOEXEC to various file descriptor calls, to avoid
leaking file descriptors to dumpstate's child processes.

Bug: 18342188
Change-Id: I74c47a98dfddc29c618067ad53d879b98ed1d87a
2015-03-19 11:32:02 -07:00
Christopher Ferris
69a141e07f am 9d68ed0e: Merge "Add timeout for dump_file."
* commit '9d68ed0ecd3a101c13a163cfe730b13b1564b442':
  Add timeout for dump_file.
2015-02-26 18:40:42 +00:00
Christopher Ferris
9d68ed0ecd Merge "Add timeout for dump_file." 2015-02-26 18:35:02 +00:00
Mark Salyzyn
2f655daeea am bb67beca: Merge "dumpstate: add pstore read"
* commit 'bb67beca35e7d570ede193a316a92022fbc2f810':
  dumpstate: add pstore read
2015-02-26 17:29:07 +00:00
Mark Salyzyn
2262c16372 dumpstate: add pstore read
Call logcat -L to pull any LAST Android logs. If the kernel is not
configured for PSTORE and PSTORE_PMSG, the hopes are the empty
content will pressure vendors to slice up and configure support.

Change-Id: I5fddfa1e0f59f24fccc30b257ba68af8a8cf8640
2015-02-26 07:41:41 -08:00
Christopher Ferris
54bcc5ffd5 Add timeout for dump_file.
It turns out dump_file is used on a number of /proc and system files.
In one case, the read of a file stalled and caused a bugreport to
hang forever. It's still possible if there is a kernel bug that this
could stall forever, but less likely.

Also, change the return type of nanotime to uint64_t.

Testing:
- Created a named fifo and verified that dump_file fails with a timeout.
- Created a large /data/anr/traces.txt to verify that large files still
  dump properly and that the additional NONBLOCK parameter doesn't cause
  a problem.
- Created a dummy /data/tombstones/tombstone_00 to verify that the
  dump of these files still works.
- Compared a dump using the old dumpstate to the new dumpstate to verify
  nothing obviously different.

Bug: 19117030
Change-Id: I0d3dd27583c853cdaccd2fd278748cb5f9ccd4fb
2015-02-25 19:59:29 -08:00
Christopher Ferris
34e3246646 am 8511b3ae: Merge "Remove -z option."
* commit '8511b3ae5eb42810f97f7c3e993d7f80d3393b83':
  Remove -z option.
2015-02-10 16:53:52 +00:00
Christopher Ferris
ff4a4dc7e6 Remove -z option.
This option doesn't work with the current selinux protections and
doesn't serve much of a purpose. You can get the same results running
this:

dumpstate | gzip > /data/local/tmp/dump.txt.gz

Bug: 19271141
Change-Id: Icc76200df33dc708e30c556ec8a0f393f995fe7c
2015-02-09 16:45:35 -08:00
Christopher Ferris
16c62c468a am 50ad67e4: Merge "Add better timeout mechanism for running commands."
* commit '50ad67e4ce6b07b5f5f4649ace81ed9a8b2c2eac':
  Add better timeout mechanism for running commands.
2015-02-04 02:08:44 +00:00
Christopher Ferris
1a9a338615 Add better timeout mechanism for running commands.
Change-Id: I60fc9e7d59c3e0e4b8b2f69f79c6903240bfd131
2015-02-03 14:53:44 -08:00
Elliott Hughes
e55073a96c am 0e17a265: Merge "Switch dumpstate to "ip link list"."
* commit '0e17a265f5e8bf233a3e3b74fc03ada3dc467bed':
  Switch dumpstate to "ip link list".
2015-01-28 17:34:16 +00:00
Elliott Hughes
a59828a5d2 Switch dumpstate to "ip link list".
Change-Id: Ia1db51c866890f09fbd4316764dea5982554598f
2015-01-28 08:45:40 -08:00
Christopher Ferris
31ef85529d Use the timeout stack dump functions.
Use the native stack dumping functions that allows time outs. If
debuggerd locks up, before a bugreport would hang forever. Now
it will timeout properly and still get all of the other information.

Bug: 18766581

(cherry picked from commit 457731f69e)

Change-Id: I39e8e9c60209e3ef9efac795fedb8e1edce2bd3e
2015-01-15 15:35:40 -08:00
Christopher Ferris
457731f69e Use the timeout stack dump functions.
Use the native stack dumping functions that allows time outs. If
debuggerd locks up, before a bugreport would hang forever. Now
it will timeout properly and still get all of the other information.

Bug: 18766581
Change-Id: I85053b8dcfe6224e2b64b4d8f7f2ef448b3cda34
2015-01-14 16:58:55 -08:00
Christopher Ferris
d195f87b2d Fix message when a command times out.
The previous version printed out the nanoseconds elapsed, not seconds.

Bug: 18766581

(cherry picked from commit 67c5a8af9e)

Change-Id: Icbaaee83a92767694fd98e3c790f36f4d24681b0
2015-01-14 16:10:11 -08:00
Christopher Ferris
67c5a8af9e Fix message when a command times out.
The previous version printed out the nanoseconds elapsed, not seconds.

Change-Id: I10f6d7bf7b7a4647658313ed83781fda6fd744a5
2015-01-09 16:42:56 -08:00
Dianne Hackborn
4ba58f69cd Work on issue #18486438: Reduce size of bugreport output
Don't put packages.xml in to the output.

Change-Id: I88a682866365886506a003a64deb4a29c16ba21c
2014-11-21 16:41:31 -08:00
Mark Salyzyn
9cea6ccbd8 dumpstate: report device uptime mmc performance
Bug: 18085992
Change-Id: Ibc0a37d3d2649d1e6708d9357f37ed75f2cea121
2014-11-04 09:39:27 -08:00
Arve Hjønnevåg
2db0f5f31c dumpstate: Add trusty version if driver is found
Change-Id: I7780ea8e1d777c222a73408f70d8a6d49dee1d92
2014-10-16 16:11:07 -07:00
Christopher Ferris
ed9354fc84 Accept socket connection before tracing.
Sometimes dumping threads takes a long time and bugreport times
out. This change will cause us to accept the bugreport socket connection
before dumping threads and should avoid the failed to connect to dumpstate
service problems we've seen.

Bug: 17758374
Change-Id: I80afa0353cf1c340873f481a8d1d7faffff54120
2014-10-01 17:35:01 -07:00
Jeff Brown
1dc94e3156 Make dumpstate vibrate immediately.
Previously, the vibration was not performed until after stacks
were gathered which takes a long time.  Moved the vibration
to happen earlier so we provide better user feedback for the
three-button salute when collecting a bug report.

Deleted some dead code for playing begin/end sounds.

Improved the timing measurement code to help track down why
bug reports are so slow.  (They take over a minute now which
can cause us to lose valuable diagnostic information.)

Bug: 17474152
Change-Id: Iac73f7993d7dc85196aad96f459b22fd4a710f94
2014-09-11 14:19:04 -07:00
Christopher Ferris
89d4949f86 Use time() instead of clock() for timeouts.
The clock() function returns the processor time used by the process. This
is not a good timeout mechanism since the code is suspended most of the
time waiting for the forked process to finish. Replace with the time()
function.

Bug: 17154069
Change-Id: Ib383329f9db269445d71a100553b08e71fddda3f
2014-09-09 13:10:49 -07:00
Andres Morales
2e671bbdb7 Fix deadlock when killing adb bugreport
Leave default signal handler (terminate) for parent process,
add SIG_IGN as signal handler for children and let them
go down when the parent gets SIGPIPE.

Bug: 17109154
Change-Id: Id33db3e97a32f289eb2a9a1a0ca8acbe3dcd285d
2014-08-22 12:10:44 -07:00
Lorenzo Colitti
d4c3d38957 Improve network connectivity dumping.
1. Explicitly dump IP addresses.

   Currently, some IP addresses are dumped using netcfg, but that
   only dumps the first IPv4 address on each interface. Instead,
   call ip -4 addr and ip -6 addr explicitly to dump all IPv4 and
   IPv6 addresses on the system.

2. Disable dumping /proc/net/{ipv6,}route, because:

 - We already dump all IPv4 and IPv6 routes in the tables that
   we use.
 - /proc/net/route is confusing because it only includes routes
   in the main table, which are all but unused. It's also in
   unreadable host-byte-order hex.
 - /proc/net/ipv6_route is confusing because it includes routes
   from all tables but does not say what table they are in.

3. Instead of dumping the contents of /proc/net/arp , use
   "ip -4 neigh show" and "ip -6 neigh show" to dump the
   neighbour caches for both IPv4 and IPv6.

Bug: 16663736
Change-Id: Id3e509b877ab7b00eb2399b6a9868b12245da2f0
2014-07-31 01:56:12 +00:00
Christopher Ferris
7dc7f3221f Add dumping of tombstones to dumpstate.
Dump only those tombstones modified within the last half an hour.

Change-Id: I8ce836b2e19eba7a9c0c31a4f312f9a382526da7
2014-07-23 19:18:07 -07:00
Elliott Hughes
d2a049220a Always #include <sys/...>, not <linux/...>.
(cherry picked from commit 1e4ee9afd2)

Change-Id: Ie005774484f98bb33c8f867cddb778ac04a1d4ea
2014-07-18 18:19:54 -07:00
Colin Cross
0d6180f122 dumpstate: fix dumping traces for vm processes on 64-bit
dumpstate was not dumping any stack traces for vm processes because
it was failing the string compare for /system/bin/app_process.
64-bit devices use app_process32 and app_process64 instead of
app_process, and zygote64 alongside zygote.  Change the string
matching to be prefix matching.

(cherry picked from commit 8eb25d552b)

Change-Id: I6b1568161fae278f0e6107990e5b750cf0ca902b
2014-07-17 12:42:14 -07:00
Matthew Xie
f3381cf1a6 dump bluedroid kernel status do not merge
Change-Id: I4617f770088f86ceda2caf58bd1fdae81b3e31df
(cherry picked from commit ed3b9a0977)
2014-07-14 20:53:32 +00:00
Sreeram Ramachandran
c88da7cc21 resolved conflicts for merge of 928e05b1 to master
Change-Id: I1d1e623a1f95baa4375a87242ce71ea789884649
2014-07-09 08:05:04 -07:00
Sreeram Ramachandran
928e05b12b am 0d2bee0c: Merge "Dump all the correct routing tables."
* commit '0d2bee0c0baec56ec98867d7e044602097525248':
  Dump all the correct routing tables.
2014-07-09 00:13:15 +00:00
Sreeram Ramachandran
2b3bba34ae Dump all the correct routing tables.
The list of tables is maintained in /data/misc/net/rt_tables by netd.

Change-Id: I55475c08c5e43bcf61af916210e680c47480ac32
2014-07-08 16:29:45 -07:00
Nick Vaccaro
bd81c258c2 am 45fcfb48: am 85453ecc: dumpstate: increase poll timeout waiting for SIGQUIT logging
* commit '45fcfb48ef9e65747e7a3f35e1a4da232f6e161a':
  dumpstate: increase poll timeout waiting for SIGQUIT logging
2014-04-30 23:35:03 +00:00
Nick Vaccaro
45fcfb48ef am 85453ecc: dumpstate: increase poll timeout waiting for SIGQUIT logging
* commit '85453ecc90a94564e586f0f97c9ec2c0cf831501':
  dumpstate: increase poll timeout waiting for SIGQUIT logging
2014-04-30 20:35:15 +00:00
Nick Vaccaro
85453ecc90 dumpstate: increase poll timeout waiting for SIGQUIT logging
Increased the maximum time dumpstate will wait for SIGQUIT process
to finish dumping its thread stacks to the logfile to 5 seconds.

Bug: 14057177
Change-Id: I0b43004512855d202f2fe0ea7b0e934e77a3a070
2014-04-30 11:28:31 -07:00
Nick Kralevich
165c8bdfb5 am 0e4d2885: am 2044ac43: Merge "Convert all selinux_android_restorecon and _setfilecon calls to new API."
* commit '0e4d2885a34d31f5dbe5a08bdb654953abaf82a2':
  Convert all selinux_android_restorecon and _setfilecon calls to new API.
2014-02-13 00:16:04 +00:00
Nick Kralevich
0e4d2885a3 am 2044ac43: Merge "Convert all selinux_android_restorecon and _setfilecon calls to new API."
* commit '2044ac43e53b517526b3c70dc4fbc60ffc01693f':
  Convert all selinux_android_restorecon and _setfilecon calls to new API.
2014-02-12 23:15:07 +00:00
Stephen Smalley
26288202e7 Convert all selinux_android_restorecon and _setfilecon calls to new API.
libselinux selinux_android_restorecon API is changing to the more
general interface with flags and dropping the older variants.

Also get rid of the old, no longer used selinux_android_setfilecon API
and rename selinux_android_setfilecon2 to it as it is the only API in use.

Change-Id: I1e71ec398ccdc24cac4ec76f1b858d0f680f4925
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-02-07 09:36:11 -05:00
John Spurlock
5ecd4beef8 Dump system settings for all users
Change-Id: Ic832b19fe698da1984876b2949c3f26990ae5076
2014-01-29 14:34:24 -05:00
Todd Poynor
2a83daa8a3 dumpstate: dump console-ramoops instead of last_kmsg if present
Change-Id: I41a922b33f0b6b4e8e150a92e46032501a165e33
2013-12-10 14:42:27 -08:00
Dianne Hackborn
59b1516f4c Fix issue #10422349: Limit/change the battery history data in batterystats
Use new compact option to include history when dumping battery stats.

Change-Id: I3833a88db76d8791bd5c2e8f6ff414af65472a42
2013-09-04 18:04:14 -07:00
Dmitry Shmidt
1d6b97c869 dumpstate: Fix wifi list of networks dump
Bug: 9056601

Change-Id: Ia0adb67afdf3d478033d0ee34bbb95e621e2fe51
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2013-08-21 10:58:29 -07:00
Todd Poynor
4f5b9a701b dumpstate: switch to HAL static libraries
Change-Id: I865a0b4b4a84a2d54a239e7b09874287f0c1ad56
2013-08-13 16:30:01 -07:00
Alex Ray
656a6b9e36 dumpstate: remove libutils dependency
Change-Id: I9745f389402c01b90877612e060ac996eba99964
2013-07-23 17:51:19 -07:00
Nick Kralevich
76b45c126b dumpstate: Show SELinux process labels
Change-Id: Ie19586a3b733bd4420f6b20b5d253d42c2f165ea
2013-07-15 12:21:40 -07:00
Dianne Hackborn
1bd5068a51 Fix cmd line arguments for usagestats.
Change-Id: I9a1436aa1d1665924ba62a568bb4b66d67ae2814
2013-07-12 12:19:44 -07:00
Dianne Hackborn
5cd46aa339 Update to follow procstats options changes.
Change-Id: I6f016c944cfcd01bbbcf3cf37bc7ff05482f0012
2013-07-09 15:01:40 -07:00
Dianne Hackborn
3e5fa73722 Update to use --include-committed for procstats.
Change-Id: I5ce737b624c5617c94054d6bedebca754fbf16a9
2013-07-03 16:51:15 -07:00
Dianne Hackborn
02bea9786d Add checkin dumps to bug reports.
This is a duplicate of the associated human-readable dumps
of these services, but much better for automated parsing.

Change-Id: I902b768b03aeac1472f03f96913f9b8ada5dba9c
2013-06-26 18:59:09 -07:00
jp abgrall
4b2b0a7494 am 74bd799e: Merge "Exit dumpstate on SIGPIPE to avoid cascading child crashes"
* commit '74bd799ec20d2420459fa382533b1cc39ca9a54c':
  Exit dumpstate on SIGPIPE to avoid cascading child crashes
2013-05-28 15:46:14 -07:00
John Michelau
885f888c55 Exit dumpstate on SIGPIPE to avoid cascading child crashes
When dumpstate ignores SIGPIPE it can lead to a cascade of tombstones /
coredumps since many of its children don't handle or ignore it.  It's
best to just exit dumpstate once the pipe is broken.

Change-Id: Ic0c57ecf4171f0c0a07837e51c41cb1876e1350c
2013-05-28 14:20:59 -05:00