platform_system_core/crash_reporter
Chih-Hung Hsieh f10383c1be Fix clang-tidy performance warnings in crash_reporter.
* Use faster overloaded string find function.

Bug: 30411878
Change-Id: I1bbb382428424140b61062ba729fcc229126c164
Test: build with WITH_TIDY=1
2016-07-27 16:18:05 -07:00
..
dbus_bindings crash: Convert list_proxies to chromeos-dbus-bindings generator 2015-02-18 23:53:21 +00:00
init crash-reporter: disable device coredumps in verified mode 2014-11-26 06:07:52 +00:00
.project_alias crash: Shorten crash-reporter project alias. 2015-01-30 05:10:46 +00:00
99-crash-reporter.rules crash-reporter: add support for device coredump 2015-04-01 19:37:06 +00:00
Android.mk crash_reporter_tests: Compile only on 'eng' builds. 2016-02-04 13:56:25 -08:00
crash_collector.cc Fix clang-tidy performance warnings in crash_reporter. 2016-07-27 16:18:05 -07:00
crash_collector.h crash_reporter: Fix product_id in kernel crash reports 2016-02-25 03:37:33 -08:00
crash_collector_test.cc crash_reporter: Fix a -Wmissing-field-initializers warning. 2016-02-26 15:15:06 -08:00
crash_collector_test.h crash_reporter: Relicense as Apache 2. 2015-08-20 18:54:43 +00:00
crash_reporter.cc crash_reporter: Fix paths for kernel panic collection 2016-02-02 16:14:52 -08:00
crash_reporter.rc crash_reporter: Fix paths for kernel panic collection 2016-02-02 16:14:52 -08:00
crash_reporter_logs.conf crash_reporter: Relicense as Apache 2. 2015-08-20 18:54:43 +00:00
crash_reporter_logs_test.cc crash_reporter: Fix unit tests 2015-12-07 14:21:00 -08:00
crash_sender crash_reporter: Use cacerts_google 2015-11-23 17:55:11 -08:00
kernel_collector.cc crash_reporter: Fix paths for kernel panic collection 2016-02-02 16:14:52 -08:00
kernel_collector.h crash_reporter: Relicense as Apache 2. 2015-08-20 18:54:43 +00:00
kernel_collector_test.cc Fix clang-tidy performance warnings in crash_reporter. 2016-07-27 16:18:05 -07:00
kernel_collector_test.h crash_reporter: Relicense as Apache 2. 2015-08-20 18:54:43 +00:00
kernel_log_collector.sh crash_reporter: Relicense as Apache 2. 2015-08-20 18:54:43 +00:00
kernel_warning_collector.cc crash_reporter: Relicense as Apache 2. 2015-08-20 18:54:43 +00:00
kernel_warning_collector.h crash_reporter: Relicense as Apache 2. 2015-08-20 18:54:43 +00:00
list_proxies.cc crash_reporter/metricsd: Update libchrome APIs to r369476 2016-01-20 13:43:30 -08:00
OWNERS crash: update OWNERS file 2015-04-27 23:29:42 +00:00
periodic_scheduler crash_reporter: Fix a couple crash_sender issues 2015-09-14 03:08:27 -07:00
README.md crash_reporter: Add README.md 2016-01-15 14:58:17 -08:00
TEST_WARNING Collect and report kernel warnings. 2013-05-01 20:30:10 -07:00
testrunner.cc system/core: Rename "chromeos" -> "brillo" in include paths and namespaces 2015-10-13 15:29:24 -07:00
udev_collector.cc system/core: Rename "chromeos" -> "brillo" in include paths and namespaces 2015-10-13 15:29:24 -07:00
udev_collector.h crash_reporter: Relicense as Apache 2. 2015-08-20 18:54:43 +00:00
udev_collector_test.cc system/core: Rename "chromeos" -> "brillo" in include paths and namespaces 2015-10-13 15:29:24 -07:00
unclean_shutdown_collector.cc crash_reporter: Relicense as Apache 2. 2015-08-20 18:54:43 +00:00
unclean_shutdown_collector.h crash_reporter: Relicense as Apache 2. 2015-08-20 18:54:43 +00:00
unclean_shutdown_collector_test.cc crash_report: Fix several signed-unsigned comparison warnings in tests. 2016-02-26 11:24:38 -08:00
user_collector.cc crash_reporter: Fix product_id in kernel crash reports 2016-02-25 03:37:33 -08:00
user_collector.h crash_reporter: Use the actual GID of the crashing process 2015-10-09 17:16:48 -07:00
user_collector_test.cc Merge "crash_report: Fix several signed-unsigned comparison warnings in tests." 2016-02-26 22:32:32 +00:00
warn_collector.l crash_reporter: Relicense as Apache 2. 2015-08-20 18:54:43 +00:00
warn_collector_test.c crash_reporter: Relicense as Apache 2. 2015-08-20 18:54:43 +00:00
warn_collector_test.sh crash_reporter: Relicense as Apache 2. 2015-08-20 18:54:43 +00:00
warn_collector_test_reporter.sh crash_reporter: Relicense as Apache 2. 2015-08-20 18:54:43 +00:00

crash_reporter

crash_reporter is a deamon running on the device that saves the call stack of crashing programs. It makes use of the Breakpad library.

During a build, Breakpad symbol files are generated for all binaries. They are packaged into a zip file when running m dist, so that a developer can upload them to the crash server.

On a device, if the user has opted in to metrics and crash reporting, a Breakpad minidump is generated when an executable crashes, which is then uploaded to the crash server.

On the crash server, it compares the minidump's signature to the symbol files that the developer has uploaded, and extracts and symbolizes the stack trace from the minidump.

SELinux policies

In order to correctly generate a minidump, crash_reporter needs to be given the proper SELinux permissions for accessing the domain of the crashing executable. By default, crash_reporter has only been given access to a select number of system domains, such as metricsd, weave, and update_engine. If a developer wants their executable's crashes to be caught by crash_reporter, they will have to set their SELinux policies in their .te file to allow crash_reporter access to their domain. This can be done through a simple macro:

allow_crash_reporter(domain_name)

Replace domain_name with whatever domain is assigned to the executable in the file_contexts file.

Configuration

crash_reporter has a few different configuration options that have to be set.

  • Crashes are only handled and uploaded if analytics reporting is enabled, either via the weave call to set _metrics.enableAnalyticsReporting or by manually creating the file /data/misc/metrics/enabled (for testing only).
  • The BRILLO_CRASH_SERVER make variable should be set in the product.mk file to the URL of the crash server. For Brillo builds, it is set automatically through the product configuration. Setting this variable will populate the /etc/os-release.d/crash_server file on the device, which is read by crash_sender.
  • The BRILLO_PRODUCT_ID make variable should be set in the product.mk file to the product's ID. For Brillo builds, it is set automatically through the product configuration. Setting this variable will populate the /etc/os-release.d/product_id, which is read by crash_sender.

Uploading crash reports in eng builds

By default, crash reports are only uploaded to the server for production user and userdebug images. In eng builds, with crash reporting enabled the device will generate minidumps for any crashing executables but will not send them to the crash server. If a developer does want to force an upload, they can do so by issuing the command SECONDS_SEND_SPREAD=5 FORCE_OFFICIAL=1 crash_sender from an ADB shell. This will send the report to the server, with the image_type field set to force-official so that these reports can be differentiated from normal reports.