Loading bootstat/bootstat.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -311,6 +311,7 @@ const std::map<std::string, int32_t> kBootReasonMap = { {"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 Loading init/reboot.cpp +36 −9 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -170,9 +172,23 @@ static void LogShutdownTime(UmountStat stat, Timer* t) { << 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); Loading Loading @@ -295,12 +311,15 @@ void RebootMonitorThread(unsigned int cmd, const std::string& rebootTarget, sem_ LOG(ERROR) << "Reboot thread timed out"; if (android::base::GetBoolProperty("ro.debuggable", false) == true) { 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); Loading Loading @@ -436,6 +455,14 @@ static void DoReboot(unsigned int cmd, const std::string& reason, const std::str 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; Loading rootdir/init.rc +4 −4 Original line number Diff line number Diff line Loading @@ -68,19 +68,19 @@ on property:apexd.status=ready && property:ro.product.cpu.abilist64=* 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 Loading Loading
bootstat/bootstat.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -311,6 +311,7 @@ const std::map<std::string, int32_t> kBootReasonMap = { {"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 Loading
init/reboot.cpp +36 −9 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -170,9 +172,23 @@ static void LogShutdownTime(UmountStat stat, Timer* t) { << 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); Loading Loading @@ -295,12 +311,15 @@ void RebootMonitorThread(unsigned int cmd, const std::string& rebootTarget, sem_ LOG(ERROR) << "Reboot thread timed out"; if (android::base::GetBoolProperty("ro.debuggable", false) == true) { 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); Loading Loading @@ -436,6 +455,14 @@ static void DoReboot(unsigned int cmd, const std::string& reason, const std::str 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; Loading
rootdir/init.rc +4 −4 Original line number Diff line number Diff line Loading @@ -68,19 +68,19 @@ on property:apexd.status=ready && property:ro.product.cpu.abilist64=* 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 Loading