Commit graph

159 commits

Author SHA1 Message Date
Mike Frysinger
042c3d406a crash_sender: log product info in new list format
The 00A0 unicode space hack hasn't been reliable.  The latest Chromium
code supports a 3rd field in the crash list though, so let's use that
instead.  The UI has already been updated to look for this:
https://codereview.chromium.org/219383008/

BUG=chromium:210624
TEST=logged a system crash and looked at crashes page
TEST=logged a chrome crash and looked at crashes page
TEST=`cbuildbot {x86,amd64}-generic-full` pass (VMTests)

Change-Id: Icce0d9d26276143a1604b8eef5c68a2a6417c912
Reviewed-on: https://chromium-review.googlesource.com/193611
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
2014-04-09 02:26:25 +00:00
Pawel Osciak
0446aab3b5 crash_collector: Disable kernel task state collection for chrome crashes
Currently this results in outputting a lot of backtraces to system logs,
making it hard to find other failures.
Disable until a better way to do this is introduced.

BUG=chromium:352834
TEST=P2_TEST_FILTER="crash-reporter::*" FEATURES=test emerge-link
platform2

Change-Id: If6aa7c2d0d5fc9b0e0a902caacec84c2beb22b9c
Reviewed-on: https://chromium-review.googlesource.com/191623
Reviewed-by: Pawel Osciak <posciak@chromium.org>
Tested-by: Pawel Osciak <posciak@chromium.org>
Commit-Queue: Pawel Osciak <posciak@chromium.org>
2014-04-02 02:29:46 +00:00
Ben Chan
dffc8ced0b crash-reporter: Update OWNERS file to set 'noparent'.
BUG=None
TEST=None

Change-Id: I560e5247114f6be2c1689e8cdb636dc914332ef7
Reviewed-on: https://chromium-review.googlesource.com/191944
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Ben Chan <benchan@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
2014-03-27 20:36:00 +00:00
Mike Frysinger
bfdf4a8913 user_collector: use %P instead of %p
The latter will give us the PID as seen in the current PID namespace,
but since the crash handler always runs in the top most PID namespace,
that is meaningless to us.  Instead, use the %P option so we see the
PID in the top most namespace.

BUG=chromium:351568
TEST=`cbuildbot amd64-generic-full` passes # linux-3.10
TEST=`cbuildbot x86-alex-release` passes   # linux-3.4
TEST=`cbuildbot link-release` passes       # linux-3.8
CQ-DEPEND=CL:190011
CQ-DEPEND=CL:190020
CQ-DEPEND=CL:190012
CQ-DEPEND=CL:190021

Change-Id: Ic619c4e7514e2824f7ba31b73cb9e11ec4092774
Reviewed-on: https://chromium-review.googlesource.com/190010
Reviewed-by: Ben Chan <benchan@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
2014-03-18 20:34:53 +00:00
B. simonnet
d24164e255 Use GOOGLE_CRASH_ID as the default crash report id
crash_sender will use crash id and crash version id, in order:
* the product name and product version in the meta file if present or
* GOOGLE_CRASH_ID and GOOGLE_CRASH_VERSION_ID from /etc/os-release or
* ID and VERSION_ID from /etc/os-release
* ChromeOS and chrome os version otherwise

BUG=chromium:343615
TEST=Built chromeos-base/platform2 and deployed it to a Chromebook.
Added a test report in /var/spool/crash.
Ran crash_sender in MOCK_CRASH_SENDING mode
Changed the values of variable in /etc/os-release and observed that the
sent values were correct
TEST=Set GOOGLE_CRASH_ID to Brillo, remove protection for test images,
observe that the crashes got logged in the Brillo bucket.
TEST=trybot on x86, amd64, daisy and duck

Change-Id: I30b87a344e7868e4a937c79b89c6d07ff0fcc6e4
Reviewed-on: https://chromium-review.googlesource.com/187035
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Bertrand Simonnet <bsimonnet@chromium.org>
Tested-by: Bertrand Simonnet <bsimonnet@chromium.org>
2014-03-01 02:38:41 +00:00
Yunlian Jiang
9f52040ac9 crash-reporter: convert number to int before calling abs()
BUG=chromium:347721
TEST=emerge-x86-generic crash-reporter passes.

Change-Id: Id37528c44d5c318b917932ebc755eb6b4ca01e8f
Reviewed-on: https://chromium-review.googlesource.com/188212
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Yunlian Jiang <yunlian@chromium.org>
Tested-by: Yunlian Jiang <yunlian@chromium.org>
2014-02-28 03:41:43 +00:00
Luigi Semenzato
325a2e313d crash reporter: avoid repeated warning collection
The warning collector daemon parses the entire syslog every time it
starts (almost exclusively at boot).  This change makes the collector
start reading at the end of /var/log/messages (where it waits for further
input) rather than the beginning.  The collector will miss any warnings
that may have occurred between the last warning reported, and the daemon
restart.

BUG=chromium:343954
TEST=none yet
BRANCH=none

Change-Id: I5e9b141561365b9a1d328ed6283c27e8b3369a6f
Reviewed-on: https://chromium-review.googlesource.com/186605
Reviewed-by: Grant Grundler <grundler@chromium.org>
Commit-Queue: Luigi Semenzato <semenzato@chromium.org>
Tested-by: Luigi Semenzato <semenzato@chromium.org>
2014-02-25 04:03:09 +00:00
Luigi Semenzato
b20c9ef8e9 Push full warning signature instead of its hash only.
A previous change computed a signature including the
function name and offset, but failed to send it to
the crash server.  This fixes the problem.

BUG=chromium:328948
TEST=none

Change-Id: I2ff2e548ee1a8feebd6352433c9bd0f96076f15d
Reviewed-on: https://chromium-review.googlesource.com/180561
Reviewed-by: Luigi Semenzato <semenzato@chromium.org>
Tested-by: Luigi Semenzato <semenzato@chromium.org>
Commit-Queue: Luigi Semenzato <semenzato@chromium.org>
2014-02-14 18:52:41 +00:00
Ben Chan
82deea83b0 Update metrics dependency to use slotted libmetrics library.
BUG=chromium:342866
CQ-DEPEND=CL:185187
CQ-DEPEND=CL:186026
TEST=Trybot run on paladin, release, and chromiumos-sdk builders.

Change-Id: I54f3f2055293160ad807c48a126e411c6188b6f9
Reviewed-on: https://chromium-review.googlesource.com/186028
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
Commit-Queue: Ben Chan <benchan@chromium.org>
2014-02-12 19:40:02 +00:00
Mike Frysinger
f1a557d198 drop unused makefiles
We use platform2 now w/gyp, so don't need these anymore.

BUG=chromium:337753
TEST=`FEATURES=test emerge-x86-alex platform2` still passes

Change-Id: I677b646dd56342be5cd98cb57852cc62c805240b
Reviewed-on: https://chromium-review.googlesource.com/185561
Reviewed-by: Ben Chan <benchan@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
2014-02-08 23:50:29 +00:00
Mike Frysinger
a557c1187f update to libbase-242728
BUG=chromium:331128
TEST=`FEATURES=test emerge-x86-alex platform2` works
TEST=`cbuildbot chromiumos-sdk` works
CQ-DEPEND=CL:185131

Change-Id: Ia03a6ea7aaf6b4ee5d9c512ebf7080c0c28920f1
Reviewed-on: https://chromium-review.googlesource.com/185150
Reviewed-by: Ben Chan <benchan@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
2014-02-07 11:45:42 +00:00
Mike Frysinger
01ca40d690 convert list_proxies to base::CommandLine
We need libbase already, so use that for command line processing rather
than gflags.

BUG=None
TEST=`FEATURES=test emerge-x86-alex platform2` builds & runs crash tests
TEST=`list_proxies --help` works
TEST=ran other list_proxies commands and checked results

Change-Id: I569fa88edb8fee4d6920965d644f69a0998a3202
Reviewed-on: https://chromium-review.googlesource.com/184627
Reviewed-by: Ben Chan <benchan@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
2014-02-04 23:04:53 +00:00
Mike Frysinger
1646eb87cb add platform2 support
BUG=chromium:337753
TEST=`FEATURES=test emerge-x86-alex platform2` builds & runs crash tests
TEST=`cbuildbot chromiumos-sdk` passes

Change-Id: Ia1f98b6058ff615ffc862955934096531c5d237d
Reviewed-on: https://chromium-review.googlesource.com/183661
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
2014-02-03 01:01:41 +00:00
Ben Chan
8563d20e10 Replace deprecated scoped_array<T> with scoped_ptr<T[]>
BUG=chromium:338610
TEST=Build and run unit tests.

Change-Id: I782cd5ddb0a112a51fca1972faba47b9ed2f7690
Reviewed-on: https://chromium-review.googlesource.com/184069
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Ben Chan <benchan@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
2014-01-28 19:59:08 +00:00
Mike Frysinger
83ce73eac5 remove unused gflags includes
These files don't use gflags, so drop the includes.

BUG=chromium:337753
TEST=`FEATURES=test emerge-x86-alex crash-reporter` passes

Change-Id: I0a57e45cd16cd37b1361858e3313d59dced4eb5e
Reviewed-on: https://chromium-review.googlesource.com/183644
Reviewed-by: Ben Chan <benchan@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
2014-01-25 07:09:53 +00:00
Luigi Semenzato
a59b3df60a Append function name/offset to kernel warning signature.
The current crash reporter signature for a kernel warning
is the 8-digit hex hash for the warning.  For convenience,
add the function name + offset to the hash, when it is
available.

BUG=chromium:328948
TEST=ran unit test

Change-Id: I8f047497c0556227a1dbdf650dabcd4c51aa8340
Reviewed-on: https://chromium-review.googlesource.com/180320
Tested-by: Luigi Semenzato <semenzato@chromium.org>
Reviewed-by: Sameer Nanda <snanda@chromium.org>
Commit-Queue: Luigi Semenzato <semenzato@chromium.org>
2013-12-17 01:32:09 +00:00
Mike Frysinger
f4c39b09f4 crash_sender: upload oldest crashes first
The current logic is sorting crashes by date (which is good), except it
sorts it such that the newest is first (which is bad).

This means if a new process continues to crash, old crash reports will
be perpetually stalled (it's a stack).  Instead, let's start with the
oldest first (like a fifo).

BUG=chromium:326583
TEST=`cbuildbot x86-generic-full` passes VMTests

Change-Id: Ifadedba80cb8c602c094c91d419e4d9645abda51
Reviewed-on: https://chromium-review.googlesource.com/179210
Reviewed-by: Ben Chan <benchan@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
2013-12-07 10:20:00 +00:00
Mike Frysinger
9f3bf88120 warn_collector: fix building with newer flex
Flex before 2.5.37 would call YY_INPUT with a result of type int*.
But now it passes result as a yy_size_t* which leaders to errors:

lex.yy.c:1419:3: error: passing 'yy_size_t *' (aka 'unsigned int *') to
	parameter of type 'int *' converts between pointers to integer types
	with different sign

Change the type to match the newer flex.  This means we'll fail when
built with older versions, but we don't care about that.

BUG=chromium:219621
TEST=`emerge-x86-alex crash-reporter` works w/flex-2.5.37
TEST=`emerge-stumpy crash-reporter` works w/flex-2.5.37
CQ-DEPEND=CL:176183

Change-Id: I64e7fdf43af50b7a8aa65125c6a83b9c77ea6ae6
Reviewed-on: https://chromium-review.googlesource.com/176248
Reviewed-by: Luigi Semenzato <semenzato@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
2013-11-13 07:07:49 +00:00
Albert Chaulk
130265e4bf Copy in new common.mk
BUG=chromium:304400
TEST=cros_run_unit_tests for daisy-drm, lumpy & amd64-corei7

Change-Id: I51a97881aace3cfd5b182f92bf3083a35ff56e72
Reviewed-on: https://chromium-review.googlesource.com/174053
Commit-Queue: Albert Chaulk <achaulk@chromium.org>
Tested-by: Albert Chaulk <achaulk@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2013-10-26 00:29:02 +00:00
Ben Chan
62b0c42baf crash-reporter: Remove unused constants reported by clang.
BUG=chromium:309859
TEST=`FEATURES=test USE=clang emerge-lumpy crash-reporter`

Change-Id: Ie6f78ad420322f44ce0c108cb23de299981f60a4
Reviewed-on: https://chromium-review.googlesource.com/173937
Tested-by: Ben Chan <benchan@chromium.org>
Reviewed-by: Yunlian Jiang <yunlian@chromium.org>
Commit-Queue: Ben Chan <benchan@chromium.org>
2013-10-22 23:17:45 +00:00
Mike Frysinger
d2db5ff988 crash_reporter: clarify chrome crash ignore message
We ignore Chrome crashes when it is the kernel that runs us.  When Chrome
itself runs us, we will take their crashes.  The log output here though
has long confused developers, so rephrase it slightly.

BUG=None
TEST=`cros_run_unit_tests -p crash-reporter --board x86-alex` passes
TEST=`cbuildbot {amd64,x86}-generic-full` passes (VMTests)

Change-Id: Ia13a766134f5a20a1cc4eaab74ac46633d3177eb
Reviewed-on: https://chromium-review.googlesource.com/172261
Reviewed-by: Chris Masone <cmasone@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
2013-10-09 13:56:20 +00:00
Aaron Gable
d9cd84277f Rewrite git/gerrit/gerrit-int urls to googlesource
BUG=chromium:281665,chromium:290413

TEST=None

Change-Id: I114bcb152e1bf1823ee49134e0f7f51719b21944
Reviewed-on: https://chromium-review.googlesource.com/171253
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
2013-10-01 03:39:40 +00:00
Mike Frysinger
a569da0a2f build: respect CFLAGS when building warn_collector.l
We update common.mk to the latest (not really needed, by might as well).

Then we fix the lex building so it uses CFLAGS.  This in turn triggers a
clang warning in the file which we fix by adding proper printf attributes.

BUG=chromium:297661
TEST=`VERBOSE=1 emerge-x86-alex crash-reporter` showed flags used w/lex

Change-Id: I8db4b8b54b2ca748bb400ec6541287fa764f6d43
Reviewed-on: https://chromium-review.googlesource.com/170351
Reviewed-by: Yunlian Jiang <yunlian@chromium.org>
Reviewed-by: Ben Chan <benchan@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
2013-09-26 19:12:56 +00:00
Mike Frysinger
55a515c311 crash_sender: use more random tmpdir
The POSIX spec often requires 6 X's in temp paths.  Change the code
to use that rather than the non-standard 4.

BUG=chromium:275910
TEST=`cbuildbot {arm,amd64,x86}-generic-full` works
TEST=`crash_sender` on board works

Change-Id: I97f5959afcb9f60dfd379d517904d5bbf5c502e3
Reviewed-on: https://chromium-review.googlesource.com/169680
Reviewed-by: Ben Chan <benchan@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
2013-09-17 21:22:09 +00:00
Mike Frysinger
8a17bb928a crash_sender: add support for command line options
This lets us pass in custom env var settings w/out manipulating the
environment.  This makes execution a bit simpler in some cases.

BUG=chromium:275910
TEST=`cbuildbot {arm,amd64,x86}-generic-full` works
TEST=`crash_sender` on board works

Change-Id: Icc32d7a179fee6a2e28d105d5790b2c55f12158b
Reviewed-on: https://chromium-review.googlesource.com/169571
Reviewed-by: Ben Chan <benchan@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
2013-09-16 23:31:41 +00:00
Albert Chaulk
49a7c92023 Append all crashes to Chrome's crash log
Currently chrome://crashes reports no crashes due to the switch to using
crash_reporter. This adds reports of all crashes, with the report ID and
product (Chrome or Chrome OS) to Chrome's log.

BUG=chromium:210624
TEST=none

Change-Id: I7e47f6af0374095250830f46b693ac2fa053fa54
Reviewed-on: https://gerrit.chromium.org/gerrit/65886
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Albert Chaulk <achaulk@chromium.org>
Tested-by: Albert Chaulk <achaulk@chromium.org>
2013-08-14 17:05:35 -07:00
Rohit Makasana
c3f7973c24 Adding a lock mechanism to crash_sender.
This is to avoid situations when crash_sender is already running
and while test crash reporting, we execute crash_sender manually.

BUG=None
TEST=Manually

Change-Id: I3beea8d503940d7a1af24c8f16eebb365d447434
Reviewed-on: https://gerrit.chromium.org/gerrit/65556
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Rohit Makasana <rohitbm@chromium.org>
Reviewed-by: Rohit Makasana <rohitbm@chromium.org>
Tested-by: Rohit Makasana <rohitbm@chromium.org>
2013-08-13 04:10:48 -07:00
Yuly Novikov
2aa552ad43 crash_collector: Collect kernel task states for chrome crashes
When handling chrome crash:
call debugd to write kernel task states into syslog,
parse only the relevant task states out of syslog,
pack them into the log file to be uploaded.

BUG=chromium:244916
TEST=Kill chrome, see the task states in crash log, on Link, Snow and Alex.

Change-Id: Ib8aad79622886581ae5ce50c03097f01db9153a7
Reviewed-on: https://gerrit.chromium.org/gerrit/63205
Reviewed-by: Albert Chaulk <achaulk@chromium.org>
Reviewed-by: Balazs Engedy <engedy@chromium.org>
Tested-by: Yuly Novikov <ynovikov@chromium.org>
Commit-Queue: Yuly Novikov <ynovikov@chromium.org>
2013-07-26 12:16:24 -07:00
Yuly Novikov
8ec93fa0d0 crash_collector: Handle compressed i915_error_state for chrome crashes
i915_error_state was previously truncated by debugd,
and will be compressed in the future to prevent that.

Because of compression, it will now be received in base64 format,
so to reduce it's size, decode it back.

Also, use xz compression, since it's more compact.
The second compression is a preparation for adding task states to the logs.

BUG=chromium:219121
TEST=Kill chrome, see the log gathered. Uploaded report id 5e5a6f9bf6ff4b5f.

Change-Id: I316cdaef8f8f42d4ac839f7c880960cdf6d7a1e8
Reviewed-on: https://gerrit.chromium.org/gerrit/62568
Reviewed-by: Albert Chaulk <achaulk@chromium.org>
Tested-by: Yuly Novikov <ynovikov@chromium.org>
Commit-Queue: Yuly Novikov <ynovikov@chromium.org>
2013-07-19 18:01:56 -07:00
Daniel Erat
9c9e1c43d3 crash: Remove references to low-battery state file.
Remove references to the low-battery state file formerly
written by powerd. The system shuts down immediately when it
enters the low-battery state.

BUG=chromium:259189
TEST=ran unit tests

Change-Id: I2122210b448af58fb4ecac2c234b9faa9d231e2b
Reviewed-on: https://gerrit.chromium.org/gerrit/62578
Reviewed-by: Chris Masone <cmasone@chromium.org>
Tested-by: Daniel Erat <derat@chromium.org>
Commit-Queue: Daniel Erat <derat@chromium.org>
2013-07-19 13:41:04 -07:00
Yuly Novikov
8b05c32b5d crash_collector: Collect i915_error_state for chrome crashes
Since crash_collector runs as chronos for chrome crashes,
it doesn't have permission to read i915_error_state.

Switch to getting it from debugd instead of reading directly.

Also, collect it for all chrome crashes.

BUG=chromium:219121
TEST=Kill chrome, see the log gathered. Uploaded report id 7cbae7f70da9bd3e.

Change-Id: Ic74abea2fc86b16c5a7f0f11df73137d93e5220c
Reviewed-on: https://gerrit.chromium.org/gerrit/61606
Reviewed-by: Albert Chaulk <achaulk@chromium.org>
Commit-Queue: Yuly Novikov <ynovikov@chromium.org>
Tested-by: Yuly Novikov <ynovikov@chromium.org>
2013-07-15 15:57:12 -07:00
Albert Chaulk
33dfd47146 Add error logging and fix uploading for chrome crash reports
Adds some logging of parse errors in case there's a format mismatch in future.
Fixes detection of the minidump, was checking the wrong variable.
Modifies crash_sender to properly upload a Chrome dump, including all of the
extra options that get included, and identifies it as a Chrome and not ChromeOS
dump so that it shows up in the right lists server-side.

BUG=chromium:216523
TEST=loaded build of chrome with matching changes, verified about:crash causes
  a dump to be created and placed in the right spot, and that it uploads
  properly by crash_sender

Change-Id: I8a114ad6798f09f33b78df1680153c0412eabf45
Reviewed-on: https://gerrit.chromium.org/gerrit/59572
Reviewed-by: Albert Chaulk <achaulk@chromium.org>
Tested-by: Albert Chaulk <achaulk@chromium.org>
Commit-Queue: Albert Chaulk <achaulk@chromium.org>
2013-07-03 13:31:18 -07:00
mukesh agrawal
32f827f9dd crash_collector: pedantically document hashed string for warn_collector
When computing a hash of a kernel warning message, we include the
trailing newline character. Document this fact, to make it easier
to write separate tools that compute the hash.

BUG=none
TEST=cros_workon_make --board=link --test --reconf crash-reporter

Change-Id: I5d78235db5c8bff7e3639c9d1cd3915d343f471e
Reviewed-on: https://gerrit.chromium.org/gerrit/60797
Commit-Queue: mukesh agrawal <quiche@chromium.org>
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Tested-by: mukesh agrawal <quiche@chromium.org>
2013-07-02 16:31:25 -07:00
Yufeng Shen
4c9f576605 kernel_log_collector.sh : correct kernel message pattern
The timestamp in the kernel message can have either "+" or "-"
sign. We want to match both of them.

BUG=chromium:226186
TEST=Make sure the script can capture message starting with
"2013-06-19T20:38:58.663410+00:00 localhost kernel: ["

Change-Id: I93647d4fc8b3d796166d2e959b24364de4bc60c5
Reviewed-on: https://gerrit.chromium.org/gerrit/59297
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Yufeng Shen <miletus@chromium.org>
Tested-by: Yufeng Shen <miletus@chromium.org>
2013-06-19 16:19:38 -07:00
Yufeng Shen
5f23bbb37e Add support for sending Atmel TP/TS error message
This adds the support that when Pixel touchscreen/trackpad driver
atmel_mxt_ts is misbehaving, e.g. failed to update firmware, failed
to read messages from the chip, trigger crash reporter to send system
logging message for further debugging.

We also follow the policy that, for atmel/cypress logs, we only fetch
the last 30s of the logs.

BUG=chromium:226186
TEST=1. On Pixel, replace the touchscreen firmware file
        /opt/google/touch/firmware/162.0_1.1.170.bin
        with an empty file with the same name
     2. Force touchscreen firmware update
        /opt/google/touch/scripts/chromeos-touch-firmware-update.sh -d atmel_mxt_ts -f -n maxtouch-ts.fw
     3. After the firmware update fails, check crash report exists at
        /var/spool/crash/change__i2c_atmel_mxt_ts.XXX
     4. Check that the log contains only 30s of entries with "atmel" keyword.

Change-Id: If46a575491378405e60ad1ccbd39026ae6bf2033
Reviewed-on: https://gerrit.chromium.org/gerrit/48239
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Will Drewry <wad@chromium.org>
Commit-Queue: Yufeng Shen <miletus@chromium.org>
Tested-by: Yufeng Shen <miletus@chromium.org>
2013-06-18 16:11:36 -07:00
Albert Chaulk
72e72712b9 Update chrome crash reports to require the exe name
When invoked from chrome we execute too late to get any of the crashing
process' info as it's already been cleaned up by the kernel. So, require
chrome to pass along the name too

BUG=chromium:216523
TEST=manual invocation of /sbin/crash_reporter, verified supplied name gets
  used & it doesn't check /proc for any info

Change-Id: Id74cae3ba93426bd0ac74959741a11baf83c2694
Reviewed-on: https://gerrit.chromium.org/gerrit/58929
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Albert Chaulk <achaulk@chromium.org>
Tested-by: Albert Chaulk <achaulk@chromium.org>
2013-06-18 10:31:08 -07:00
Mike Frysinger
fc6bafab0e crash_sender: disable uploading on test images
Not sure what has changed, but we're uploading crashes now for test images
when we don't want to.  When the channel in /etc/lsb-release is marked as
a test channel (which happens for all test images), exit early.

BUG=chromium:239862
TEST=passed vmtests (logging_CrashSender & logging_UserCrash)
TEST=`cbuildbot {arm,amd64,x86}-generic-full` pass

Change-Id: I4a35aaa34b590c575de639888ed8be68bc9608b6
Reviewed-on: https://gerrit.chromium.org/gerrit/51084
Reviewed-by: Chris Masone <cmasone@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
2013-06-12 13:04:03 -07:00
Mike Frysinger
37843a9f8a crash_collector: add /crash to the user crash path
The recent multiprofile work forgot to append /crash to the user-specific
crash path.  It was in the fallback path, but not the dynamic one.

BUG=chromium:248629
TEST=`cros_run_unit_tests --board=x86-alex -p crash-reporter` works
TEST=`cbuildbot x86-generic-full` works

Change-Id: If87848526b0e78f3f76fd412b0f46e37b7022bd6
Reviewed-on: https://gerrit.chromium.org/gerrit/58232
Reviewed-by: Chris Masone <cmasone@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
2013-06-11 17:52:51 -07:00
Luigi Semenzato
20980d71ee Fix initialization of kernel_crash_reporter objects.
This fixes a copy-paste error that initialized (twice)
the wrong object.

BUG=chromium:244574
TEST=none

Change-Id: I8ada187483a7b8dbfd8ec19ca284cf08a685844e
Reviewed-on: https://gerrit.chromium.org/gerrit/56845
Reviewed-by: Sonny Rao <sonnyrao@chromium.org>
Tested-by: Luigi Semenzato <semenzato@chromium.org>
Commit-Queue: Luigi Semenzato <semenzato@chromium.org>
2013-06-11 16:56:56 -07:00
Mike Frysinger
f19b518532 add support for multiprofile
Update crash_sender to scan /home/chronos/u-*/crash/ paths since it's
a shell script and there's no easy way to get the right info via shell
commands.  We want to scan all paths in case of different ordering.

For crash_collector, update it to use SessionManager's dbus call to
query the active profiles.  We select the first one and use that to
process crashes.  This should be fine.

We also need to handle the edge case where no user is logged in (yet a
crash occurs with a program running as chronos uid; e.g. the login).
In the past, we just wrote to /home/chronos/user/crash/ even when there
wasn't a user home dir mounted there.  With this change, we formalize
(and document) things a bit more by moving to /home/chronos/crash/.  We
want this behavior rather than re-using the system path as our tests
specifically verify system vs user crashes.

BUG=chromium:221778
TEST=`cros_run_unit_tests --board=x86-alex -p crash-reporter` passes
TEST=logging_UserCrash autotest passes in a vm
CQ-DEPEND=CL:56112
CQ-DEPEND=CL:57067

Change-Id: If9f2ffd0740533537718b2a5e7d215200f5a41d6
Reviewed-on: https://gerrit.chromium.org/gerrit/55600
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
2013-06-03 14:32:14 -07:00
Chris Masone
b3fe6c3a4e Replace some LOGs with PLOGs
PLOG automatically appends an error message appropriate
for errno, so use it when logging errors after operations
that would set errno meaningfully.

BUG=None
TEST=None

Change-Id: I63549e149bd699469293e5a7f0e48efa9e388162
Reviewed-on: https://gerrit.chromium.org/gerrit/57213
Reviewed-by: Chris Masone <cmasone@chromium.org>
Tested-by: Chris Masone <cmasone@chromium.org>
Commit-Queue: Chris Masone <cmasone@chromium.org>
2013-06-03 14:31:53 -07:00
Mike Frysinger
44054a0052 warn_collector_test: make it actually work
The warn_collector_test.c wrapper which calls system() assumes that the
return value of system() is the exit code when it's really a wait status.
That means we'd often get back values like 256 which, when masked with
0377, we get back 0 and so this test would always "pass".

Once we fix that, we see that the script has been failing for all boards
other than link because of hardcoded paths in the setup:
warn_collector: error while loading shared libraries: libmetrics.so:
	cannot open shared object file: No such file or directory

Analysis of these vars show that we haven't even been testing the local
compiled binary.  Instead, we've been trying to test the one installed
into the $SYSROOT due to the $PATH munging.  I cleaned that up as well
as generally tidied up this test script.

Once we fix that, we then see that the collection doesn't work properly
and fails with:
expected 2 lines in warn-test-log, found this:
6c1b181c

This last bug is due to the regex matching less than was expected:
<PRE_WARN>[^ ]+\n         if (WarnStart()) {  /* yytext is file:line */
But the actual line looks like:
Apr 31 25:25:25 localhost kernel: [117959.231100] WARNING: at /mnt/host/source/src/third_party/kernel/files/drivers/gpu/drm/i915/intel_dp.c:351 intel_dp_check_edp+0x6b/0xb9()

You can see there is a space between the <file> and the <symbol> which
means we pass in to the start function in this (*not* the file:line):
intel_dp_check_edp+0x6b/0xb9()

When the test script runs, it tries to use sed to mung the error message
to get a new file path, but the collector only looks at the func name,
so the calculated hashes continue to match.

We can fix this latter part in two ways: change the test to mung the
func name, or change the lex to pass in the file+func name.  I've gone
the latter route as that seems to have been the intention.

BUG=chromium:217382
TEST=`cros_run_unit_tests --board=x86-alex -p crash-reporter` passes

Change-Id: I5b3490c56280bb5260198af930b6744cea585c46
Reviewed-on: https://gerrit.chromium.org/gerrit/56305
Reviewed-by: Luigi Semenzato <semenzato@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
2013-05-24 14:03:01 -07:00
Mike Frysinger
77bd156185 warn_collector: handle non-fatal signals
If we pause the process (standard SIGSTOP/SIGCONT), the read() on the
inotify handle gets angry and aborts.  This can happen if you ctrl+z
the program, or if you attach to it with strace.  This is undesirable,
so ignore EINTR errors from the read().

BUG=None
TEST=ran `./warn_collector --test` and hit ctrl+z then fg

Change-Id: I49e99abb12ace847e88f973817854d8ba95cf689
Reviewed-on: https://gerrit.chromium.org/gerrit/56303
Reviewed-by: Luigi Semenzato <semenzato@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
2013-05-23 14:42:27 -07:00
Albert Chaulk
426fcc0bd5 Handle Chrome crashes
Chrome will be modified to pass crashes to crash_reporter via a specially
formatted file, a TLV-style designed to be easily parsed, instead of
multipart/form-data. Extra attributes are added into the .meta file.

BUG=chromium:187808
TEST=new unit tests created

Change-Id: I0d65d118e0e348329d14bb4004c8f7bad5a44a97
Reviewed-on: https://gerrit.chromium.org/gerrit/49972
Reviewed-by: Chris Masone <cmasone@chromium.org>
Commit-Queue: Albert Chaulk <achaulk@chromium.org>
Tested-by: Albert Chaulk <achaulk@chromium.org>
2013-05-16 13:07:17 -07:00
Luigi Semenzato
5eb471c416 Hash only warning "file:line" in warning collector.
Before this change, the signature of a warning is computed from
a string such as this one:

/mnt/host/source/src/third_party/kernel/files/drivers/gpu/drm/i915/intel_dp.c:351 intel_dp_check_edp+0x6b/0xb9()

This change removes all text after the first space, i.e. the function name
and IP offset.  The latter varies across architectures and can vary across
builds, giving different signatures for the same warning.

BUG=chromium:227080
TEST=manual

Change-Id: Ied65dbd8edd734bd152a9dd35aaa48f1e8f1b9e8
Reviewed-on: https://gerrit.chromium.org/gerrit/49505
Commit-Queue: Luigi Semenzato <semenzato@chromium.org>
Reviewed-by: Luigi Semenzato <semenzato@chromium.org>
Tested-by: Luigi Semenzato <semenzato@chromium.org>
2013-05-01 22:45:06 -07:00
Luigi Semenzato
6fdc0b48cb Collect and report kernel warnings.
A flex-based daemon collects kernel warnings by parsing /var/log/messages
as lines are added to it.  For every warning the daemon sends a sample
to a sparse UMA histogram using a hash of the warning as the bucket.
Then, if the warning hasn't been seen before, the daemon invokes the
crash collector to upload the warning stack trace.

BUG=chromium:217382
TEST=manually tested (for now), automated test on its way
CQ-DEPEND=Ic8d5773d05d717a275c4a4b5616e0e4c307337b8
CQ-DEPEND=I6a4010acad0ffe20c702bb0fc455e3da7cdf3ac1

Change-Id: I89090e5c2b61ec46b4e740f0895c591728d70e77
Reviewed-on: https://gerrit.chromium.org/gerrit/48277
Commit-Queue: Luigi Semenzato <semenzato@chromium.org>
Reviewed-by: Luigi Semenzato <semenzato@chromium.org>
Tested-by: Luigi Semenzato <semenzato@chromium.org>
2013-05-01 20:30:10 -07:00
Simon Que
9f90acaa4d Replace FilePath declaration with file_path.h include
Fixes a clang error.  Also use "base::FilePath" since FilePath has been
moved to the base namespace.

BUG=chromium-os:39046
TEST=The following command passes:
USE="chrome_internal" CFLAGS="-clang -print-cmdline"
CXXFLAGS="-clang -print-cmdline" emerge-x86-alex crash-reporter

Change-Id: I7da82093c5685b5b556cba971b1e1b14ac0f59c4
Signed-off-by: Simon Que <sque@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/43577
Reviewed-by: Ben Chan <benchan@chromium.org>
2013-02-20 10:09:31 -08:00
Mike Frysinger
1a8780d309 update to libchrome 180609
Purely mechanical changes here.

BUG=chromium-os:38933
TEST=`cros_run_unit_tests --board=stumpy -p crash-reporter` passes
CQ-DEPEND=CL:43376

Change-Id: I62d5d12556517bedf48d36ada4c651ff1c671fe9
Reviewed-on: https://gerrit.chromium.org/gerrit/43378
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
2013-02-15 12:46:09 -08:00
Mike Frysinger
9a7ce9fbef use volatile markings in crash test
This makes it work with clang (supposedly).

BUG=chromium-os:37965
TEST=`cros_run_unit_tests --board=stumpy -p crash-reporter` passes

Change-Id: I598df1be7c8a38e14cde5f5328a3b6e2e1532ea7
Reviewed-on: https://gerrit.chromium.org/gerrit/43377
Reviewed-by: Ben Chan <benchan@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
2013-02-15 10:40:02 -08:00
Ryan Harrison
570dd0ccae crash-reporter: Updating common.mk to ToT to enable profiling
This update replaces the current common.mk used in this project with the newest
version. This will allow all of the common.mk based projects to be on the same
version for debugging and enables profiling support.

BUG=chromium-os:37854
TEST=Exectuted the following commands to confirm the build works:
     MODE=profiling cros_workon_make --board=link
     MODE=profiling cros_workon_make --board=link --test
     cros_workon_make --board=link
     cros_workon_make --board=link --test
     Repeated these with emerge-link, USE=profiling, and
     FEATURES=test as need.
     For the emerge command with profiling and testing enable, confirmed the
     appropriate coverage files were created in /usr/share/profiling/...

Change-Id: I12fcd4a590994223ddc42cf22670db82e94f0e03
Reviewed-on: https://gerrit.chromium.org/gerrit/42777
Tested-by: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2013-02-07 11:43:59 -08:00