Commit graph

267 commits

Author SHA1 Message Date
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
Steve Fung
6c34c2576e crash_reporter: Relicense as Apache 2.
MODULE_LICENSE_BSD and NOTICE were removed as the license is no longer
different from the rest of system/core.

Bug: 23368756
Change-Id: I31e48eb7c3d153c7c5ec4f694c61474dedac2eeb
2015-08-20 18:54:43 +00:00
Steve Fung
f085a1f6b3 crash_reporter: Add Android.mk
This builds:
* crash_reporter: Client for collecting crash data.
* crash_sender: Installs the script for sending crash reports to the server.
* warn_collector: Flex client for monitoring /var/log/messages for kernel
  warnings.
* init.crash_reporter.rc: Init script for setting up crash reporting.
* crash_reporter_logs.conf: Conf file for handling core dumps.
* Unit tests for the different crash collectors.  These currently build, but
  not all of them pass as the crash reporter client isn't properly configured
  yet.

Bug: 22486906
Change-Id: I9337a566f35955d1d41ae94d535eb9e9730bbeb1
2015-08-19 18:34:57 -07:00
Steve Fung
ab2ac7d114 crash_reporter: Enable core dumps
Fix various path/directory locations to their Android equivalents
to enable collection of core dumps and generation of mini dumps
to work correctly.  Also add the init script to initialize
crash_reporter.

Bug: 22874832
Change-Id: Iffb1529e5259c5da5ba7f6977b2787e738f68a78
2015-08-18 23:38:27 -07:00
Steve Fung
8bafb3da8f crash_reporter: Fix initial compile issues with Android toolchain
Fix some issues to get crash_reporter to compile on Android.

C++ source:
* bits/wordsize.h is used for __WORDSIZE, but is unavailable for most
  Android toolchain architectures.  It instead is available in sys/cdefs.h

Flex source:
* The Flex compiler toolchain doesn't link against the default fl library
  using -lfl.  Thus there is no yywrap() function defined.  Since the
  default fl library implementation just returns 1 (true), instead add a
  directive to disable yywrap.
* The index(..) function has been deprecated in favor of strchr(..)
* Add a directive to disable the "deprecated conversion from string constant
  to 'char*'" warning in the generated code.
* Remove warning suppression for the input() function which doesn't get
  generated with Flex v2.5.39 and the arguments passed in the build command.

Bug: 22874187
Change-Id: I6d7dcf5f801010aeae06db9f0628a6652ee269ee
2015-08-10 15:10:32 -07:00
Steve Fung
c8b741428c crash_reporter: Remove Chrome collector, CrOS build files, DBus
Removed the ChromeOS specific code so that the code compiles.  The code
removed is not needed when running on Android, and includes:
* Chrome collector
* ChromeOS build's gyp file
* ChromeOS-specific DBus calls
* ChromeOS-specific collector path logic
* Chrome bypass logic in user collector

Bug: 22672752
Change-Id: I3c7d87c971a181d8f73293519318e3602d142927
2015-08-10 15:10:22 -07:00
Steve Fung
129bea543b crash_reporter: Fix header include paths
Fix the header include paths to be relative to the crash_reporter
base folder.

Bug: 22873331
Change-Id: Icdd0495a79cd7679f38c54a84e189bfb3c9d7f1c
2015-08-10 01:38:56 -07:00
Bertrand SIMONNET
45f59d634d crash_reporter: Add license information.
The license file was taken from the original repository at:
https://chromium.googlesource.com/chromiumos/platform2/+/master/LICENSE

Change-Id: I05a8284346ceb326fb80c692e24653bc446cc33d
2015-07-28 17:31:05 -07:00
Christopher Wiley
c686fd3cbd Remove superfluous legacy DBus includes
This header pulls in glib dependencies which aren't used in these
codebases.

BUG=chromium:508218
TEST=trybots

Change-Id: Iecf8dfcdd8064b1feb694382eea55c3f0df572d3
Reviewed-on: https://chromium-review.googlesource.com/284053
Tested-by: Christopher Wiley <wiley@chromium.org>
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Commit-Queue: Christopher Wiley <wiley@chromium.org>
Trybot-Ready: Christopher Wiley <wiley@chromium.org>
2015-07-14 18:19:44 +00:00
Dan Colish
8a59e11e33 crash: do not call list-proxies if it does not exist.
Additionally, this adds logging for list-proxies call failures.

BUG=chromium:396033
TEST=unittests, test_that logging_UserCrash

CQ-DEPEND=CL:275076

Change-Id: I0515e75476bdc7a0ace8ebc8318e82c337a87374
Reviewed-on: https://chromium-review.googlesource.com/275077
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Daniel Colish <colish@chromium.org>
Tested-by: Daniel Colish <colish@chromium.org>
2015-06-04 19:33:14 +00:00
Chris Masone
f3caa5a236 crash: Point to canonical org.chromium.SessionManagerInterface.xml
The session_manager already had a fully-specified .xml file
describing its DBus API, so toss the one created for use
by crash-reporter.gyp, and point the build to the canonical one.

BUG=None
TEST=build crash-reporter and run unit tests

Change-Id: Id14e1a5a3a2aa7be3caee309c04d85078e43a315
Reviewed-on: https://chromium-review.googlesource.com/267726
Trybot-Ready: Chris Masone <cmasone@chromium.org>
Tested-by: Chris Masone <cmasone@chromium.org>
Reviewed-by: Steve Fung <stevefung@chromium.org>
Commit-Queue: Chris Masone <cmasone@chromium.org>
2015-04-29 00:21:31 +00:00
Ben Chan
f17a8387d4 crash: update OWNERS file
BUG=None
TEST=None

Change-Id: I5a43ab1aa1eda040ed58aea4f593ccca9bba128d
Reviewed-on: https://chromium-review.googlesource.com/267127
Commit-Queue: Ben Chan <benchan@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2015-04-27 23:29:42 +00:00
Alex Vakulenko
92c0eefe42 platform2: Explicitly use base:: namespace with CommandLine
The current revision of libchrome is removing CommandLine class
from global namespace and only retain the one in base::.

Sweep the code to use the correct namespace in anticpation of
libchrome revision roll.

BUG=None
TEST=./build_packages

Change-Id: Ib7ca448dac1204c1e36ab053e775a5a5214997ac
Reviewed-on: https://chromium-review.googlesource.com/263785
Trybot-Ready: Alex Vakulenko <avakulenko@chromium.org>
Tested-by: Alex Vakulenko <avakulenko@chromium.org>
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
2015-04-03 18:33:17 +00:00
Peter Qiu
6aa551ec41 crash-reporter: add support for device coredump
Copy the device coredump file to /var/spool/crash directory when
udev event "devcoredump" is detected. Also include the last 50 lines
of /var/log/messages and /var/log/net.log in the coredump file for
debugging purpose. Only perform the collection if feedback is allowed
(metrics are enabled) or the device is running a developer image.

By default, crash-reporter will not upload device coredumps to the crash
server. The user can enable device coredumps upload via a to-be-added
crosh command, which should only be done at the direction of CrOS engineers.

BUG=chromium:464872
TEST=USE="asan clang" FEATURES=test emerge-$BOARD crash-reporter
Manual Test:
1. Trigger wifi firmware error on a Clapper running developer image by
   running following command:
   "echo 1 > /sys/kernel/debug/iwlwifi/0000\:01\:00.0/iwlmvm/fw_restart"
2. Verify there is a device coredump file in "/var/spool/crash/"
   "devcoredump_iwlwifi*.devcore", as well as the additional log file
   ".log" and the meta file ".meta".

Change-Id: Ic4cf67d4b5715a6f422505f409276d1261b7d51f
Reviewed-on: https://chromium-review.googlesource.com/257091
Reviewed-by: Zeping Qiu <zqiu@chromium.org>
Commit-Queue: Zeping Qiu <zqiu@chromium.org>
Tested-by: Zeping Qiu <zqiu@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2015-04-01 19:37:06 +00:00
Mike Frysinger
7458089196 delete __STDC_{FORMAT,LIMIT}_MACROS
With newer glibc versions (2.18+), these macros no longer exist (and the
functionality they protected are always enabled).  Delete them.

BUG=chromium:401360
TEST=precq passes

Change-Id: I21b0607a874b9f9e39dff050054a2928a6c55023
Reviewed-on: https://chromium-review.googlesource.com/262903
Trybot-Ready: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
2015-03-29 10:02:23 +00:00
Steve Fung
040dffdb3e crash: Convert list_proxies to chromeos-dbus-bindings generator
Switch list_proxies to using chromeos-dbus-bindings generator
in order to remove the glib dependency.

BUG=brillo:89
TEST=`FEATURES=test emerge-panther crash-reporter`
TEST=manually tested `list_proxies --quiet      \
       https://clieents2.google.com/cr/report`

Change-Id: Ic52277b2e14514376f4d55e627e1651d9ef566c5
Reviewed-on: https://chromium-review.googlesource.com/248781
Reviewed-by: Dan Erat <derat@chromium.org>
Trybot-Ready: Dan Erat <derat@chromium.org>
Commit-Queue: Steve Fung <stevefung@chromium.org>
Tested-by: Steve Fung <stevefung@chromium.org>
2015-02-18 23:53:21 +00:00