From 4decbe0d6c3cb86445eb54ff22fd4e5771203da7 Mon Sep 17 00:00:00 2001 From: Josh Gao Date: Mon, 23 Jan 2017 15:08:34 -0800 Subject: [PATCH 1/3] debuggerd_handler: add SIGSYS to the list of handled signals. Bug: http://b/34586922 Test: kill -SYS $$ Change-Id: I31dadb9c65141d0c5556cc7256439e0a8d1519ab --- debuggerd/include/debuggerd/handler.h | 1 + 1 file changed, 1 insertion(+) diff --git a/debuggerd/include/debuggerd/handler.h b/debuggerd/include/debuggerd/handler.h index 809f67049..7196e0ad4 100644 --- a/debuggerd/include/debuggerd/handler.h +++ b/debuggerd/include/debuggerd/handler.h @@ -48,6 +48,7 @@ static void __attribute__((__unused__)) debuggerd_register_handlers(struct sigac #if defined(SIGSTKFLT) sigaction(SIGSTKFLT, action, nullptr); #endif + sigaction(SIGSYS, action, nullptr); sigaction(SIGTRAP, action, nullptr); sigaction(DEBUGGER_SIGNAL, action, nullptr); } From 0ad5107e51cb71c78a6de02cab2835ba9c1ae61d Mon Sep 17 00:00:00 2001 From: Josh Gao Date: Mon, 23 Jan 2017 15:56:11 -0800 Subject: [PATCH 2/3] Actually don't start tombstoned until /data is mounted. Bug: http://b/34461270 Test: boot is actually faster Test: tombstoned still started by init Change-Id: I4976abef108bbb6fad264f9b68cbc1fba711085b --- debuggerd/tombstoned/tombstoned.rc | 3 +++ rootdir/init.rc | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/debuggerd/tombstoned/tombstoned.rc b/debuggerd/tombstoned/tombstoned.rc index eaae9c475..b8345cacf 100644 --- a/debuggerd/tombstoned/tombstoned.rc +++ b/debuggerd/tombstoned/tombstoned.rc @@ -2,6 +2,9 @@ service tombstoned /system/bin/tombstoned user tombstoned group system + # Don't start tombstoned until after the real /data is mounted. + class late_start + socket tombstoned_crash seqpacket 0666 system system socket tombstoned_intercept seqpacket 0666 system system writepid /dev/cpuset/system-background/tasks diff --git a/rootdir/init.rc b/rootdir/init.rc index 8d974fa12..d6ae6f0d9 100644 --- a/rootdir/init.rc +++ b/rootdir/init.rc @@ -359,9 +359,6 @@ on post-fs-data start vold installkey /data - # start tombstoned to record early-boot crashes. - start tombstoned - # Start bootcharting as soon as possible after the data partition is # mounted to collect more data. mkdir /data/bootchart 0755 shell shell From 8498016b81a393e48ce1e3060872b841298708a3 Mon Sep 17 00:00:00 2001 From: Josh Gao Date: Mon, 23 Jan 2017 15:56:35 -0800 Subject: [PATCH 3/3] tombstoned: silence spurious error messages. Bug: none Test: booted after deleting /data/tombstones/* Test: crasher creates a tombstone Change-Id: I8b3e8a3b521952412ebc955b2437bf8150220c16 --- debuggerd/tombstoned/tombstoned.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/debuggerd/tombstoned/tombstoned.cpp b/debuggerd/tombstoned/tombstoned.cpp index 63e3dbd07..8705ecea5 100644 --- a/debuggerd/tombstoned/tombstoned.cpp +++ b/debuggerd/tombstoned/tombstoned.cpp @@ -85,7 +85,13 @@ static void find_oldest_tombstone() { std::string path = android::base::StringPrintf("%stombstone_%02zu", kTombstoneDirectory, i); struct stat st; if (stat(path.c_str(), &st) != 0) { - PLOG(ERROR) << "failed to stat " << path; + if (errno == ENOENT) { + oldest_tombstone = i; + break; + } else { + PLOG(ERROR) << "failed to stat " << path; + continue; + } } if (st.st_mtime < oldest_time) {