Commit Graph

113 Commits

Author SHA1 Message Date
Nick Kralevich c91bafb88a DO NOT MERGE: dumpstate: execute procrank using su
procrank is a setuid binary which only exists on userdebug/eng
builds. Instead of executing the setuid binary, run the binary using
the su command. This eliminates one more setuid binary, and allows
the tightening of the SELinux policy.

Bug: 18342188

(cherry picked from commit 2b1f88b6ac78e330ff006da6fecf8bc9d976ec67)
Bug: 25951005

Change-Id: I90c86f89974b3878273a29277b2a5d5d7c4b81c7
2016-07-20 04:16:16 -07:00
Scott Mertz ea0ee316d8 dumpstate: add CM version to output
Change-Id: Ibd804872d7d32ac1d26efaf30927a2359d2da287
2016-05-26 16:32:59 -07:00
Mark Salyzyn 03d61d95fa dumpstate: increase logcat timeout to 40 seconds (DO NOT MERGE)
- temporary measure until root issues can be resolved.

Bug: 23685592
Change-Id: Ia33f4e3928a457c3dcd730ad2c2c57d13fbf133d
2015-12-18 10:18:58 -08:00
Sharvil Nanavati 804339a59e Increase raft timeout to 10min so we get complete logs from older devices.
Devices like dory get slammed when bugreports are taken and can't
compress all the raft logs in the current 5min timeout. Our dogfooders
spend their precious time getting us bugreports and then we can't act
on them because we have broken raft logs. :(

This change bumps up the timeout in the hopes that we can get complete
logs from even our slowest devices.

Change-Id: I10741a6185b39544f4c0531f0ee74864d74a1aa4
2015-11-27 21:04:11 -08:00
Jason Parks 31baf8d3c2 Revert "do not dumpstate raft BUG: 24159112"
This reverts commit 05c862252d.

Change-Id: Ib5984796734d2a0e33f47e0fb4e446b787e0d14f
2015-10-12 15:27:10 +00:00
Erik Wolsheimer 05c862252d do not dumpstate raft
BUG: 24159112

Change-Id: I344aa73808992b5f84cb0536201a3ab2eb6f2b3c
2015-10-02 10:02:24 -07:00
Lorenzo Colitti 872269a579 am 6afc38c4: Dump the ND offload status and address table in bugreports.
* commit '6afc38c45af45eb8f64793bca2903b3f4c55579b':
  Dump the ND offload status and address table in bugreports.
2015-09-15 02:46:32 +00:00
Lorenzo Colitti 6afc38c45a Dump the ND offload status and address table in bugreports.
Also, move NetworkDiagnostics between the two runs of getting the
wifi counters, so we can see the effect on the counters of
sending our probe packets.

Bug: 23661687
Change-Id: I3f81c003a35f50ac1cb8e77d0a8c73dae4fd91f3
2015-09-09 22:59:25 +09:00
Mark Salyzyn df1bc67019 resolved conflicts for merge of d213f5e7 to cw-e-dev
Change-Id: Iaea0fdd483b4d0988df442f9b291b99943009829
2015-08-11 16:27:05 -07:00
Mark Salyzyn ecc0763e6c dumpstate: add logcat -b all -S
(cherry pick from commit e3c4df96083231b519dad919fd0ed6624100b368)

- For those that are proud to call themselves logspam police
- Every time someone declares that something is too chatty, or that
  they lost their logs because they were declared too chatty and
  their associated logs were aggresively pruned we generally
  ask them to report the logger statistics to pinpoint what software
  product that is the elephant in the room.
- Every time we want to spawn a new 'stop being so spammy' bug spawned
  off a bugreport collected for another purpose, we *wish* we had the
  logger statistics to help add gravitas to the claim that some piece
  of software is the top, or near the top, polluter.

Bug: 22351810
Change-Id: Ifae33cd21d0ae2917a3b4381502d723725b1701c
2015-08-11 14:56:49 -07:00
Sharvil Nanavati 8d4cb7ffc1 Dump raft logs in bugreports if they exist.
Change-Id: I7773b8b86675d9ebf3f6d158eaaa11e47619800e
2015-07-24 02:01:13 -07:00
Mark Salyzyn 8f37aa5011 dumpstate: modify logcat timeout to compensate for storage speed
(cherry pick from commit f989162bb8)

Discover the logcat buffer size, divide by the worst storage
speed in kb/s, and multiply by ten to estimate the timeout in
ms for each named buffer. If that value is less than 20 seconds,
then select 20 seconds. Apply this to each logcat request.

Bug: 21555259
Change-Id: Id36aebff83cb06e94350e4a84fa266b66a8444fc
2015-06-15 07:28:28 -07:00
Sharvil Nanavati 94a9875f75 Merge "Remove Bluedroid kernel dump from dumpstate." into mnc-dev 2015-06-12 21:30:03 +00:00
Sharvil Nanavati 3ba7e729a7 Remove Bluedroid kernel dump from dumpstate.
Bluedroid doesn't have much of a kernel component and no devices
expose a bluedroid node in debugfs.

Change-Id: I5600e88c543a109257d95591704a8f2a7261dfdc
2015-06-12 11:35:24 -07:00
Erik Kline 90926336c1 Incorporate network diagnostics during a bugreport
Bug: 21449922
Change-Id: I81a3774683c08f5d4ab4ea75bec45d279fb210ec
2015-06-09 17:38:12 +09:00
Elliott Hughes bfb1f1cc83 Don't use TEMP_FAILURE_RETRY on close in frameworks/native.
Bug: http://b/20501816
Change-Id: Id13a62f02243c6c4831e2f47944dc34fa822f5b6
(cherry picked from commit 997abb668b)
2015-05-15 17:26:44 -07:00
Mark Salyzyn 326842fca4 dumpstate: report per-partition MMC performance
(Cherry pick from commit 540e3de99f)

Change-Id: If5cabe186d8377056effa1c0672a90e277cd7221
2015-05-01 14:50:55 -07:00
Ashish Sharma 8b3e133e41 Inclide checkin format of dumpsys package in bugreport.
Change-Id: I809377f80e314b358eba22fa916e53c81cac2c47
2015-04-28 13:32:54 -07:00
Mark Salyzyn 82f393aad6 am d029e95a: am 1b0a8702: am ad436ab5: Merge "dumpstate: scrub APANIC"
* commit 'd029e95a58ea0927ebd3431d9991cd316e568002':
  dumpstate: scrub APANIC
2015-04-08 22:07:20 +00:00
Mark Salyzyn f423b57dd9 dumpstate: scrub APANIC
Bug: 19525200
Change-Id: Ia2d2857cac953fb4ceafb66ddf775d89d7a777b1
2015-04-08 10:51:51 -07:00
Nick Kralevich 4796bc3b27 am 4b9d0b9b: am f3201498: Merge "dumpstate: add O_CLOEXEC"
* commit '4b9d0b9b676afec086bf579015b2f74623b357fd':
  dumpstate: add O_CLOEXEC
2015-03-19 19:11:11 +00:00
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 123edd9f81 resolved conflicts for merge of 04e13acd to master
Change-Id: I9bbc9907a5cbde8b374398493bc0dc6b056ea734
2015-02-26 11:01:57 -08: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 59b0b568d0 resolved conflicts for merge of d6c8ae9c to master
Change-Id: I3cbb6ed0958b4328aca1798c7fe6080c31555a3a
2015-02-26 10:05:40 -08: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
Svetoslav d527bcbc10 Remove unnecessary settings state dump.
The settings provider now implements dump, hance special dump
code is no longer needed.

Change-Id: I93af3f6acac4ac70d6bbf569d2348cb16b8c0946
2015-02-17 12:55:55 -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