Merge changes Iff879def,I79c72346
am: 89562f11c8
Change-Id: Ibaee972370d7be10bd6ef973941365282880fb2e
diff --git a/bootstat/bootstat.cpp b/bootstat/bootstat.cpp
index dd24aac..d08a59f 100644
--- a/bootstat/bootstat.cpp
+++ b/bootstat/bootstat.cpp
@@ -311,6 +311,7 @@
{"shutdown,userrequested,recovery", 182},
{"reboot,unknown[0-9]*", 183},
{"reboot,longkey,.*", 184},
+ {"reboot,boringssl-self-check-failed", 185},
};
// Converts a string value representing the reason the system booted to an
diff --git a/init/reboot.cpp b/init/reboot.cpp
index 786a084..2cf0f5c 100644
--- a/init/reboot.cpp
+++ b/init/reboot.cpp
@@ -60,6 +60,8 @@
#define PROC_SYSRQ "/proc/sysrq-trigger"
+using namespace std::literals;
+
using android::base::GetBoolProperty;
using android::base::Split;
using android::base::Timer;
@@ -170,9 +172,23 @@
<< stat;
}
-/* Find all read+write block devices and emulated devices in /proc/mounts
- * and add them to correpsponding list.
- */
+static bool IsDataMounted() {
+ std::unique_ptr<std::FILE, int (*)(std::FILE*)> fp(setmntent("/proc/mounts", "re"), endmntent);
+ if (fp == nullptr) {
+ PLOG(ERROR) << "Failed to open /proc/mounts";
+ return false;
+ }
+ mntent* mentry;
+ while ((mentry = getmntent(fp.get())) != nullptr) {
+ if (mentry->mnt_dir == "/data"s) {
+ return true;
+ }
+ }
+ return false;
+}
+
+// Find all read+write block devices and emulated devices in /proc/mounts and add them to
+// the correpsponding list.
static bool FindPartitionsToUmount(std::vector<MountEntry>* blockDevPartitions,
std::vector<MountEntry>* emulatedPartitions, bool dump) {
std::unique_ptr<std::FILE, int (*)(std::FILE*)> fp(setmntent("/proc/mounts", "re"), endmntent);
@@ -295,12 +311,15 @@
LOG(ERROR) << "Reboot thread timed out";
if (android::base::GetBoolProperty("ro.debuggable", false) == true) {
- LOG(INFO) << "Try to dump init process call trace:";
- const char* vdc_argv[] = {"/system/bin/debuggerd", "-b", "1"};
- int status;
- android_fork_execvp_ext(arraysize(vdc_argv), (char**)vdc_argv, &status, true,
- LOG_KLOG, true, nullptr, nullptr, 0);
-
+ if (false) {
+ // SEPolicy will block debuggerd from running and this is intentional.
+ // But these lines are left to be enabled during debugging.
+ LOG(INFO) << "Try to dump init process call trace:";
+ const char* vdc_argv[] = {"/system/bin/debuggerd", "-b", "1"};
+ int status;
+ android_fork_execvp_ext(arraysize(vdc_argv), (char**)vdc_argv, &status, true,
+ LOG_KLOG, true, nullptr, nullptr, 0);
+ }
LOG(INFO) << "Show stack for all active CPU:";
WriteStringToFile("l", PROC_SYSRQ);
@@ -436,6 +455,14 @@
Timer t;
LOG(INFO) << "Reboot start, reason: " << reason << ", rebootTarget: " << rebootTarget;
+ // If /data isn't mounted then we can skip the extra reboot steps below, since we don't need to
+ // worry about unmounting it.
+ if (!IsDataMounted()) {
+ sync();
+ RebootSystem(cmd, rebootTarget);
+ abort();
+ }
+
// Ensure last reboot reason is reduced to canonical
// alias reported in bootloader or system boot reason.
size_t skip = 0;
diff --git a/rootdir/init.rc b/rootdir/init.rc
index de72794..5de8622 100644
--- a/rootdir/init.rc
+++ b/rootdir/init.rc
@@ -68,19 +68,19 @@
service boringssl_self_test32 /system/bin/boringssl_self_test32
setenv BORINGSSL_SELF_TEST_CREATE_FLAG true # Any nonempty value counts as true
- reboot_on_failure reboot,bootloader,boringssl-self-check-failed
+ reboot_on_failure reboot,boringssl-self-check-failed
service boringssl_self_test64 /system/bin/boringssl_self_test64
setenv BORINGSSL_SELF_TEST_CREATE_FLAG true # Any nonempty value counts as true
- reboot_on_failure reboot,bootloader,boringssl-self-check-failed
+ reboot_on_failure reboot,boringssl-self-check-failed
service boringssl_self_test_apex32 /apex/com.android.conscrypt/bin/boringssl_self_test32
setenv BORINGSSL_SELF_TEST_CREATE_FLAG true # Any nonempty value counts as true
- reboot_on_failure reboot,bootloader,boringssl-self-check-failed
+ reboot_on_failure reboot,boringssl-self-check-failed
service boringssl_self_test_apex64 /apex/com.android.conscrypt/bin/boringssl_self_test64
setenv BORINGSSL_SELF_TEST_CREATE_FLAG true # Any nonempty value counts as true
- reboot_on_failure reboot,bootloader,boringssl-self-check-failed
+ reboot_on_failure reboot,boringssl-self-check-failed
on init
sysclktz 0