summaryrefslogtreecommitdiff
path: root/init/builtins.cpp
diff options
context:
space:
mode:
authorJanis Danisevskis <jdanis@google.com>2017-03-29 14:50:01 -0700
committerTom Cherry <tomcherry@google.com>2017-03-30 00:11:48 +0000
commit9cc51728af87d476de1b90e0f8dba62b3fc8711f (patch)
tree516585f5286069c240d16a992f144846a5d6564b /init/builtins.cpp
parent6fb2ef1d03ffad5b9253647daf0fcc6888b2aac4 (diff)
Make init builtin command installkey respect property updates
init used to block on installkey such that it was unable to process property events. This lead to a deadlock by which the Keymaster HAL would wait indefinitely for the hwservicemanager.ready=true. This fixes the issue by implementing the builtin in terms of do_exec, which allows init to stay responsive to properties while waiting for the child to terminate. Bug: 36278706 Test: Add a 3s delay into hwservicemanager before it sets the property hwservicemanager.ready and the device still boots. Change-Id: Iaefd31156ca01f3a44b4f85a8bf78beee8dfe224
Diffstat (limited to 'init/builtins.cpp')
-rw-r--r--init/builtins.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/init/builtins.cpp b/init/builtins.cpp
index 02e314f64..ccc4fd1a7 100644
--- a/init/builtins.cpp
+++ b/init/builtins.cpp
@@ -879,8 +879,14 @@ static int do_installkey(const std::vector<std::string>& args) {
if (!is_file_crypto()) {
return 0;
}
- return e4crypt_create_device_key(args[1].c_str(),
- do_installkeys_ensure_dir_exists);
+ auto unencrypted_dir = args[1] + e4crypt_unencrypted_folder;
+ if (do_installkeys_ensure_dir_exists(unencrypted_dir.c_str())) {
+ PLOG(ERROR) << "Failed to create " << unencrypted_dir;
+ return -1;
+ }
+ std::vector<std::string> exec_args = {"exec", "/system/bin/vdc", "--wait", "cryptfs",
+ "enablefilecrypto"};
+ return do_exec(exec_args);
}
static int do_init_user0(const std::vector<std::string>& args) {