Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 07572a92 authored by Bill Yi's avatar Bill Yi Committed by Gerrit Code Review
Browse files

Merge "Remove crash_reporter and metricsd"

parents 2713c88a 2728ff24
Loading
Loading
Loading
Loading

crash_reporter/.project_alias

deleted100644 → 0
+0 −1
Original line number Diff line number Diff line
crash
+0 −6
Original line number Diff line number Diff line
ACTION=="change", SUBSYSTEM=="drm", KERNEL=="card0", ENV{ERROR}=="1", RUN+="/sbin/crash_reporter --udev=KERNEL=card0:SUBSYSTEM=drm:ACTION=change"
# For detecting cypress trackpad issue. Passing into crash_reporter SUBSYSTEM=i2c-cyapa since crash_reporter does not handle DRIVER string.
ACTION=="change", SUBSYSTEM=="i2c", DRIVER=="cyapa", ENV{ERROR}=="1", RUN+="/sbin/crash_reporter --udev=SUBSYSTEM=i2c-cyapa:ACTION=change"
# For detecting Atmel trackpad/touchscreen issue. Passing into crash_reporter SUBSYSTEM=i2c-atmel_mxt_ts since crash_reporter does not handle DRIVER string.
ACTION=="change", SUBSYSTEM=="i2c", DRIVER=="atmel_mxt_ts", ENV{ERROR}=="1", RUN+="/sbin/crash_reporter --udev=SUBSYSTEM=i2c-atmel_mxt_ts:ACTION=change"
ACTION=="add", SUBSYSTEM=="devcoredump", RUN+="/sbin/crash_reporter --udev=SUBSYSTEM=devcoredump:ACTION=add:KERNEL_NUMBER=%n"

crash_reporter/Android.mk

deleted100644 → 0
+0 −144
Original line number Diff line number Diff line
# Copyright (C) 2015 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

LOCAL_PATH := $(call my-dir)

crash_reporter_cpp_extension := .cc

crash_reporter_src := crash_collector.cc \
    kernel_collector.cc \
    kernel_warning_collector.cc \
    unclean_shutdown_collector.cc \
    user_collector.cc

crash_reporter_includes := external/gtest/include

crash_reporter_test_src := crash_collector_test.cc \
    crash_reporter_logs_test.cc \
    kernel_collector_test.cc \
    testrunner.cc \
    unclean_shutdown_collector_test.cc \
    user_collector_test.cc

warn_collector_src := warn_collector.l

# Crash reporter static library.
# ========================================================
include $(CLEAR_VARS)
LOCAL_MODULE := libcrash
LOCAL_CPP_EXTENSION := $(crash_reporter_cpp_extension)
LOCAL_C_INCLUDES := $(crash_reporter_includes)
LOCAL_SHARED_LIBRARIES := libchrome \
    libbinder \
    libbrillo \
    libcutils \
    libmetrics \
    libpcrecpp
LOCAL_STATIC_LIBRARIES := libmetricscollectorservice
LOCAL_SRC_FILES := $(crash_reporter_src)
include $(BUILD_STATIC_LIBRARY)

# Crash reporter client.
# ========================================================
include $(CLEAR_VARS)
LOCAL_MODULE := crash_reporter
LOCAL_CPP_EXTENSION := $(crash_reporter_cpp_extension)
LOCAL_C_INCLUDES := $(crash_reporter_includes)
LOCAL_REQUIRED_MODULES := core2md \
    crash_reporter_logs.conf \
    crash_sender \
    crash_server
LOCAL_INIT_RC := crash_reporter.rc
LOCAL_SHARED_LIBRARIES := libchrome \
    libbinder \
    libbrillo \
    libcutils \
    libmetrics \
    libpcrecpp \
    libutils
LOCAL_SRC_FILES := crash_reporter.cc
LOCAL_STATIC_LIBRARIES := libcrash \
    libmetricscollectorservice
include $(BUILD_EXECUTABLE)

# Crash sender script.
# ========================================================
include $(CLEAR_VARS)
LOCAL_MODULE := crash_sender
LOCAL_MODULE_CLASS := EXECUTABLES
LOCAL_MODULE_PATH := $(TARGET_OUT_EXECUTABLES)
LOCAL_REQUIRED_MODULES := curl grep periodic_scheduler
LOCAL_SRC_FILES := crash_sender
include $(BUILD_PREBUILT)

# Warn collector client.
# ========================================================
include $(CLEAR_VARS)
LOCAL_MODULE := warn_collector
LOCAL_CPP_EXTENSION := $(crash_reporter_cpp_extension)
LOCAL_SHARED_LIBRARIES := libmetrics
LOCAL_SRC_FILES := $(warn_collector_src)
include $(BUILD_EXECUTABLE)

# /etc/os-release.d/crash_server configuration file.
# ========================================================
ifdef OSRELEASED_DIRECTORY
include $(CLEAR_VARS)
LOCAL_MODULE := crash_server
LOCAL_MODULE_CLASS := ETC
LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/$(OSRELEASED_DIRECTORY)
include $(BUILD_SYSTEM)/base_rules.mk

# Optionally populate the BRILLO_CRASH_SERVER variable from a product
# configuration file: brillo/crash_server.
LOADED_BRILLO_CRASH_SERVER := $(call cfgtree-get-if-exists,brillo/crash_server)

# If the crash server isn't set, use a blank value.  crash_sender
# will log it as a configuration error.
$(LOCAL_BUILT_MODULE): BRILLO_CRASH_SERVER ?= "$(LOADED_BRILLO_CRASH_SERVER)"
$(LOCAL_BUILT_MODULE):
	$(hide)mkdir -p $(dir $@)
	echo $(BRILLO_CRASH_SERVER) > $@
endif

# Crash reporter logs conf file.
# ========================================================
include $(CLEAR_VARS)
LOCAL_MODULE := crash_reporter_logs.conf
LOCAL_MODULE_CLASS := ETC
LOCAL_MODULE_PATH := $(PRODUCT_OUT)/system/etc
LOCAL_SRC_FILES := crash_reporter_logs.conf
include $(BUILD_PREBUILT)

# Periodic Scheduler.
# ========================================================
include $(CLEAR_VARS)
LOCAL_MODULE := periodic_scheduler
LOCAL_MODULE_CLASS := EXECUTABLES
LOCAL_MODULE_PATH := $(TARGET_OUT_EXECUTABLES)
LOCAL_SRC_FILES := periodic_scheduler
include $(BUILD_PREBUILT)

# Crash reporter tests.
# ========================================================
include $(CLEAR_VARS)
LOCAL_MODULE := crash_reporter_tests
LOCAL_CPP_EXTENSION := $(crash_reporter_cpp_extension)
LOCAL_SHARED_LIBRARIES := libchrome \
    libbrillo \
    libcutils \
    libpcrecpp
LOCAL_SRC_FILES := $(crash_reporter_test_src)
LOCAL_STATIC_LIBRARIES := libcrash libgmock
include $(BUILD_NATIVE_TEST)

crash_reporter/OWNERS

deleted100644 → 0
+0 −2
Original line number Diff line number Diff line
set noparent
vapier@chromium.org

crash_reporter/README.md

deleted100644 → 0
+0 −61
Original line number Diff line number Diff line
# 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](https://chromium.googlesource.com/breakpad/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](https://android.googlesource.com/device/generic/brillo/+/master/sepolicy/te_macros):

    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.
Loading