diff options
author | Paul Crowley <paulcrowley@google.com> | 2018-03-01 23:24:20 +0000 |
---|---|---|
committer | Paul Crowley <paulcrowley@google.com> | 2018-03-01 23:24:20 +0000 |
commit | e242a97db547dc73efea1b5287536be66637dc33 (patch) | |
tree | 4abc4e3afeb7c3cd88e3fe75357377aca6669072 /init/builtins.cpp | |
parent | 959b05553576ffc15da4334a5917ce763611ab82 (diff) | |
download | system_core-e242a97db547dc73efea1b5287536be66637dc33.tar.gz system_core-e242a97db547dc73efea1b5287536be66637dc33.tar.bz2 system_core-e242a97db547dc73efea1b5287536be66637dc33.zip |
Revert "If enablefilecrypto or init_user0 fails, reboot into recovery."
This reverts commit 959b05553576ffc15da4334a5917ce763611ab82.
Reason for revert: b/73968735
Bug: 73968735
Test: b/73968735#comment5
Change-Id: Ifce4c029bab7380c60e20cc2b2885beb4a097456
Diffstat (limited to 'init/builtins.cpp')
-rw-r--r-- | init/builtins.cpp | 35 |
1 files changed, 11 insertions, 24 deletions
diff --git a/init/builtins.cpp b/init/builtins.cpp index 0d7762229..413d11eb0 100644 --- a/init/builtins.cpp +++ b/init/builtins.cpp @@ -285,8 +285,11 @@ static Result<Success> do_mkdir(const BuiltinArguments& args) { if (e4crypt_is_native()) { if (e4crypt_set_directory_policy(args[1].c_str())) { - reboot_into_recovery( - {"--prompt_and_wipe_data", "--reason=set_policy_failed:"s + args[1]}); + const std::vector<std::string> options = { + "--prompt_and_wipe_data", + "--reason=set_policy_failed:"s + args[1]}; + reboot_into_recovery(options); + return Success(); } } return Success(); @@ -982,24 +985,6 @@ static bool is_file_crypto() { return android::base::GetProperty("ro.crypto.type", "") == "file"; } -static Result<Success> ExecWithRebootOnFailure(const std::string& reboot_reason, - const std::vector<std::string>& args) { - auto service = Service::MakeTemporaryOneshotService(args); - if (!service) { - return Error() << "Could not create exec service"; - } - service->AddReapCallback([reboot_reason](const siginfo_t& siginfo) { - if (siginfo.si_code != CLD_EXITED || siginfo.si_status != 0) { - reboot_into_recovery({"--prompt_and_wipe_data", "--reason="s + reboot_reason}); - } - }); - if (auto result = service->ExecStart(); !result) { - return Error() << "Could not start exec service: " << result.error(); - } - ServiceList::GetInstance().AddService(std::move(service)); - return Success(); -} - static Result<Success> do_installkey(const BuiltinArguments& args) { if (!is_file_crypto()) return Success(); @@ -1007,13 +992,15 @@ static Result<Success> do_installkey(const BuiltinArguments& args) { if (!make_dir(unencrypted_dir, 0700) && errno != EEXIST) { return ErrnoError() << "Failed to create " << unencrypted_dir; } - return ExecWithRebootOnFailure("enablefilecrypto_failed", {"exec", "/system/bin/vdc", "--wait", - "cryptfs", "enablefilecrypto"}); + std::vector<std::string> exec_args = {"exec", "/system/bin/vdc", "--wait", "cryptfs", + "enablefilecrypto"}; + return do_exec({std::move(exec_args), args.context}); } static Result<Success> do_init_user0(const BuiltinArguments& args) { - return ExecWithRebootOnFailure("init_user0_failed", - {"exec", "/system/bin/vdc", "--wait", "cryptfs", "init_user0"}); + std::vector<std::string> exec_args = {"exec", "/system/bin/vdc", "--wait", "cryptfs", + "init_user0"}; + return do_exec({std::move(exec_args), args.context}); } const BuiltinFunctionMap::Map& BuiltinFunctionMap::map() const { |