Commit Graph

282 Commits

Author SHA1 Message Date
Steve Fung 2bedc74553 crash_reporter: Fix paths for kernel panic collection
Fix the paths to the pstore mount and run data within
the kernel collector.

BUG=26774830

Change-Id: I68be0a28201cb73c3420166b2f4da77a1e586ca2
2016-02-02 16:14:52 -08:00
Steve Fung b4cf452aad Merge "crash_reporter: Add unit tests to debug builds" 2016-01-21 04:43:23 +00:00
Steve Fung 120fe6aef2 Merge "crash_reporter: Fix unit tests to use ScopedTempDir" 2016-01-21 04:42:31 +00:00
Steve Fung 78fcf66c17 crash_reporter: Fix unit tests to use ScopedTempDir
Some of the unit tests manually create their own temp
directories from a relative path.  This creates a temp folder
in the folder that the test is run from.  This is a problem
when using test_droid or a non-interactive ADB shell command,
since the root directory is not writable.  Instead use a
ScopedTempDir to handle temporary folders.

Bug: 26671657
Change-Id: Iaf71d345565dcb4393e80426784a864f7f8b5929
Test: Unit tests pass when running brillo_WhitelistedGtests
2016-01-20 14:23:13 -08:00
Alex Vakulenko ea05ff9229 crash_reporter/metricsd: Update libchrome APIs to r369476
The new libchrome has been ported from Chromium and some APIs have
changed. Make necessary changes at call sites.

Change-Id: I9e45975cdef43913270b82e3fca2c027e614a464
2016-01-20 13:43:30 -08:00
Steve Fung 333fc5c19d crash_reporter: Add unit tests to debug builds
Add crash_reporter_tests to debug builds, so that they can be
run by test_droid.

Bug: 26663796
Change-Id: Iddaa14ab55474875a45b0e8482bac310fbe8cff2
Test: /data/nativetest/crash_reporter_tests exists on eng build
2016-01-20 01:15:20 -08:00
Steve Fung 8074b16e3a Merge "crash_reporter: Add README.md" 2016-01-19 21:14:28 +00:00
Steve Fung 05de86ac25 crash_reporter: Add README.md
Add a README describing the basic functionality and configuration
of crash_reporter.  Also include some development tips based on
feedback from users.

Bug: 26387853
Change-Id: I42655841171fcfb0a8efdf587e596e6930357e4e
2016-01-15 14:58:17 -08:00
Steve Fung c490e0fe98 crash_reporter: Remove udev collector from Android build
Currently one of the udev collector tests is failing due to the lack
of gzip on the device.  Since we don't have gzip nor udev in Android builds,
remove the udev collector (and tests) from Android builds.

See http://r.android.com/184708 for discussion on removing the udev
collector completely from the source.

Bug: 25779348
Test: `/data/nativetest/crash_reporter_tests/crash_reporter_tests` passes

Change-Id: I883359ac8219f2e1fa6a78927433dbc0be295fe7
2016-01-12 01:46:51 +00:00
Alex Vakulenko 2096029743 Disable RTTI in crash_reporter and metricsd
There is no longer a reliance on RTTI in libbrillo, so disable RTTI
in the rest of Brillo codebase.

Bug: 26292405
Change-Id: I2751a2ac973a74741a82f5cd949fc0adaf2449a6
2016-01-04 11:12:48 -08:00
Todd Poynor 8361935de8 crash_reporter: use libmetricscollectorservice for user crash event reports
Drop dependencies on D-Bus.

Bug: 25929888
Change-Id: Ie21c2feee098887ebb2dac14c866e28689e9343e
2015-12-10 13:34:10 -08:00
Steve Fung 8ed101bab5 crash_reporter: Fix unit tests
- Removed obsolete unit tests.
- Fix remaining unit tests for Android.

Change-Id: I1665447d375178d2bcf941fec3585c8f96cd2bac
2015-12-07 14:21:00 -08:00
Steve Fung 5acccc682d crash_reporter: Use cacerts_google
Use /system/etc/security/cacerts_google as the default certificates
directory.  If the crash_reporter.full_certs property is set to 1,
use the full /system/etc/security/cacerts directory.  This
property can be set in a target's product.mk, if they decide to
configure crash_reporter with a crash_server not covered by the
cacerts_google subset of certificates.

Bug: 25798318
Change-Id: I617c3d13b74af8d9577823a8f1a61f8375bcb504
2015-11-23 17:55:11 -08:00
Steve Fung a76ba85783 crash_reporter: Join AID_READPROC group
Access to /proc files are limited to processes with group
permissions for AID_READPROC, so add that group to the list
of supplemental groups that the user_collector joins.

Bug: 25598241
Change-Id: I26c77b052229346a3ac7150f38e03294f3641f96
2015-11-11 17:50:37 -08:00
Will Drewry e680f358ec Populate BRILLO_CRASH_SERVER from the product config
Using cfgtree.mk, this change adds support to load the
crash server URL directly from a file in the product tree
during the build.

BUG=25343470
TEST=build image, check in etc for the populated osrelease.d file

Change-Id: I6342a829936809b9553a32be7bc58285c86dd732
2015-11-04 18:48:30 -08:00
Alex Vakulenko 6ac83e416f Merge "core: Rename libchromeos into libbrillo" 2015-10-27 22:46:51 +00:00
Steve Fung f7416174ca Merge "crash_reporter: Make report log more useful" 2015-10-27 22:18:59 +00:00
Steve Fung 270f508b50 crash_reporter: Make report log more useful
Convert the crash reporter upload log to be json objects.
Report the product_id in the crash report upload log.  Also add
the exec name to the log to make it easier finding specific
crash reports if multiple binaries are crashing.

Bug: 25121166
Change-Id: I48ad88fcb0bb00b4a21dc6f2aa54f94cead971ea
2015-10-27 14:45:27 -07:00
Steve Fung 918b936f58 crash_sender: Properly handle curl errors
When the crash server returns an error code, correctly handle
it as a curl error.

Bug: 25295034
Change-Id: I75986a099cfcf90e5d7f2e9acf5616a164b5fc36
2015-10-27 14:28:01 -07:00
Alex Vakulenko 26aef373a6 core: Rename libchromeos into libbrillo
BUG: 24872993
Change-Id: Ia47ad51140f7e384822eea9d5de46c9f51ceda11
2015-10-27 11:46:37 -07:00
Mike Frysinger cb31b1db9c crash_reporter: add missing mkdir for crash_server rule
When doing a clean build, creating this file fails because the dir does
not yet exist:
echo "" > out/target/product/brilloemulator_arm/obj/ETC/crash_server_intermediates/crash_server
/bin/bash: out/target/product/brilloemulator_arm/obj/ETC/crash_server_intermediates/crash_server: No such file or directory

Bug: 24989289
Change-Id: If204dc0eb32e95ee66f97b568b4b9ae4050d3591
2015-10-20 14:28:08 -04:00
Steve Fung 568336613f crash_reporter: Use os-release.d to store the crash server url
Since all of the other configs use os-release.d rather than
system properties, switch the crash server url as well.  This also
makes the product configuration more straightforward.

Bug: 24989289
Change-Id: Ia4b423e59937a917c882e74b110b5ea520ca6016
2015-10-16 02:25:56 -07:00
Steve Fung 0d6cdfb7f0 Update crash_reporter and metrics rc files to trigger on post-fs-data
The /data directory isn't guaranteed to be mounted during the
"on boot" trigger, so switch them to using "on post-fs-data".

Bug: 24941965
Change-Id: Iee84ca0e934967cff7bc4d968d9939d398c73980
2015-10-14 18:22:32 -07:00
Steve Fung 72e3c828dc crash_reporter: Update to use the os-release.d configs
The product_id and product_version has been moved into the
/etc/os-release.d key-value store, update crash_reporter to
use these values.

Bug: 22874192
Change-Id: I71886574d1aa4e0a3ac18e1c361ec65684af9b49
2015-10-13 16:34:01 -07:00
Alex Vakulenko 74dc62460b system/core: Rename "chromeos" -> "brillo" in include paths and namespaces
libchromeos is transitioning to libbrillo and chromeos namespaces
and include directory is changing to brillo.

Bug: 24872993
Change-Id: I797613a38c7444a113f12e38366a424388477276
2015-10-13 15:29:24 -07:00
Steve Fung aa265b633b crash_reporter: Report the bdk_version
Add the bdk_version to the crash report.

Bug: 24579018
Change-Id: I00ad1079ee3aacc5d0456f80d83f42c4d28045df
2015-10-12 00:42:05 -07:00
Steve Fung 773fd3c428 crash_reporter: Use the actual GID of the crashing process
Rather than assuming the UID and GID of crashing processes is
the same, report and use the actual GID that the process was
running as.

Bug: 24678424
Change-Id: I3cfc415be2feb2863a4f4b850bfd4a3267217a44
2015-10-09 17:16:48 -07:00
Steve Fung 6db7cd7836 crash_reporter: Support crashes from arbitrary users
In order to read the /proc/<pid> files from non-root users without
using CAP_SYS_PTRACE and CAP_DAC_OVERRIDE, use setresuid(..) and
setresgid(..) to switch to the process's user to copy off necessary
files for generating the breakpad minidump.

Bug: 24678424
Change-Id: I4a43583033587441394483ce678c40c4161808b9
2015-10-07 18:16:53 -07:00
Steve Fung 4818011085 crash_reporter: Set Version and Product ID
Read in the ro.build.id property for version, and
ro.product.product_id for the Product ID.

Bug: 22874192
Change-Id: I9a3fbf375d49d04fc7bf6700c5987cb9e435c318
2015-09-30 16:49:15 -07:00
Steve Fung 7f16425d43 Merge "crash_reporter: Use ro.debuggable for determining developer mode" 2015-09-29 17:17:53 +00:00
Steve Fung 1619214b2c crash_reporter: determine official image using ro.secure
Instead of grepping the build description for "Official", use
the property ro.secure.

Bug: 24404853
Change-Id: Ia0423b3524ac9472db6a782509b56c9834c8d26e
2015-09-29 01:03:35 -07:00
Steve Fung 57c7486bf3 crash_reporter: Use ro.debuggable for determining developer mode
Bug: 24408721
Change-Id: I01215e3794eb787c37cee0c138395f49d2f1d6f8
2015-09-28 18:06:38 -07:00
Scott James Remnant 480a07db27 crash_reporter: build on non-Linux hosts
BUG=24073089

Change-Id: Ica4593074b8860e77e799e5d5347a21e49893919
2015-09-28 15:12:33 -07:00
Jorge Lucangeli Obes 96408df204 Simplify Makefile for crash_reporter.
We can use the LOCAL_INIT_RC variable for init.rc files.

Also, switch to use <service>.rc for the filename, since this is what
Android does now.

Bug: 24465893
Change-Id: I924acbe758ba9994020093005e27c8c06d0686ff
2015-09-28 12:51:54 -07:00
Steve Fung 12e61caae7 crash_reporter: Generate and use own guid
Rather than share the guid with metrics, crash_reporter should
use its own guid that is persistent across reboots but not
across factory resets.

Bug: 24102242
Change-Id: I1bcc1a10aa8e1c09372386fe8e1661a8894b8d70
2015-09-15 19:40:48 -07:00
Steve Fung f597475599 Merge "crash_reporter: Add model_manifest_id field to report" 2015-09-15 04:47:35 +00:00
Steve Fung 33046dcbfa Merge "crash_reporter: Ensure crash_sender spread time is not negative" 2015-09-15 01:06:09 +00:00
Steve Fung ed78930923 crash_reporter: Add model_manifest_id field to report
Add the model_manifest_id from weave's configuration to the
crash report.

Bug: 22874192
Change-Id: I26d5334a6eb3b82fd07338e98ce0f3efbb2ff16d
2015-09-14 16:16:27 -07:00
Steve Fung 18ca9b364b crash_reporter: Ensure crash_sender spread time is not negative
When calculating the crash_sender spread time, make sure that the
random number is not negative when converted to a shell int variable.

Bug: 24004011
Change-Id: I3b95dc244a26270ef2b93d5af4b0593a93eedcad
2015-09-14 22:18:24 +00:00
Steve Fung 758db4dbe7 Merge "crash_reporter: Read crash server from property" 2015-09-14 22:06:19 +00:00
Steve Fung 44aec5f4af crash_reporter: Read crash server from property
Read the crash server URL from the crash_reporter.server
property.  If it is not set, return a configuration error.

Bug: 22874192
Change-Id: Iac341b6352fe9c1b54cd2e8561ed4a5bbe8ddddc
2015-09-14 20:50:33 +00:00
Steve Fung 4a1bc3824e crash_reporter: Fix a couple crash_sender issues
- Added grep to the list of required modules.
- Run crash_sender with the 'system' group to allow calls to
  metrics_client to read both metrics files owned by system and
  crash_reporter files owned by root.
- Fix periodic_scheduler's check delay to actually be 5 minutes.

Bug: 23122375
Change-Id: Iff214c4e591a676a516162a92ea5aedcf0824f46
2015-09-14 03:08:27 -07:00
Steve Fung 0e8746d895 crash_reporter: Fix crash_sender
- Remove all the ChromeOS specific logic.
- Fix paths to correct Android paths.
- Add periodic_scheduler, and add crash_sender to init.

Bug: 23231196
Bug: 23233267

Change-Id: I12de28bfbe5d5b08831eda9b28c6d7a669c22290
2015-09-09 17:06:33 -07:00
Steve Fung 6e68dd72c7 crash_reporter: Call dbus-send using chromeos::ProcessImpl
Convert the call to dbus-send from system() to chromeos::ProcessImpl
so that the shell_exec selinux policy can be removed.

Bug: 23280203
Change-Id: I692ebecf5b7f0611de252225cedabcdefd56dff8
2015-09-02 12:29:22 -07:00
Steve Fung b440e50b6f crash_reporter: Run with supplemental groups
In order to use metrics_lib, crash_reporter needs to be run with
system group permissions.  To use dbus, it needs dbus group
permissions.

Bug: 23406290
Change-Id: Ic679a057afa46aaadd59429aab0aea072c1973c5
2015-08-24 23:56:07 -07:00
Steve Fung f87f5f90c5 Merge "crash_reporter: Fix tmp directory location" 2015-08-24 03:26:21 +00:00
Steve Fung ea1e07e940 Merge "crash_reporter: Relicense as Apache 2." 2015-08-24 01:03:14 +00:00
Steve Fung da98133cc0 crash_reporter: Fix tmp directory location
It is unsafe to use /data/local/tmp.  Use our own temporary
directory under /data/misc/crash_reporter.

Bug: 23430484
Change-Id: I186ba6b146bd884064177a3bb29b18b8edcc0b62
2015-08-23 17:57:19 -07:00
Steve Fung 2e2dc00399 Merge "crash_reporter: Fix path to dbus-send" 2015-08-21 23:23:34 +00:00
Steve Fung 8b8878a7d1 crash_reporter: Fix path to dbus-send
Bug: 22486906
Change-Id: If70b387bf95709719bb781719e7d0c195385be78
2015-08-21 02:17:01 -07:00