From 5949745534e11a877ec839931af76c569f78e058 Mon Sep 17 00:00:00 2001 From: Paul Crowley Date: Mon, 1 Feb 2016 16:37:13 +0000 Subject: [PATCH] On FDE devices, initialize user 0 Fix ugly special cases for user 0: initialize them explicitly. Bug: 26704408 Change-Id: I1b8536b9e5e87ea98b4009a309f2e22c56006651 --- init/builtins.cpp | 8 ++++++++ rootdir/init.rc | 2 ++ 2 files changed, 10 insertions(+) diff --git a/init/builtins.cpp b/init/builtins.cpp index 5918609ed..e5e64b4e5 100644 --- a/init/builtins.cpp +++ b/init/builtins.cpp @@ -884,6 +884,13 @@ static int do_installkey(const std::vector& args) { do_installkeys_ensure_dir_exists); } +static int do_init_user0(const std::vector& args) { + if (!is_file_crypto()) { + return 0; + } + return e4crypt_do_init_user0(); +} + BuiltinFunctionMap::Map& BuiltinFunctionMap::map() const { constexpr std::size_t kMax = std::numeric_limits::max(); static const Map builtin_functions = { @@ -900,6 +907,7 @@ BuiltinFunctionMap::Map& BuiltinFunctionMap::map() const { {"export", {2, 2, do_export}}, {"hostname", {1, 1, do_hostname}}, {"ifup", {1, 1, do_ifup}}, + {"init_user0", {0, 0, do_init_user0}}, {"insmod", {1, kMax, do_insmod}}, {"installkey", {1, 1, do_installkey}}, {"load_persist_props", {0, 0, do_load_persist_props}}, diff --git a/rootdir/init.rc b/rootdir/init.rc index 289bdec7f..343d316e7 100644 --- a/rootdir/init.rc +++ b/rootdir/init.rc @@ -420,6 +420,8 @@ on post-fs-data symlink /data/data /data/user/0 + init_user0 + # Reload policy from /data/security if present. setprop selinux.reload_policy 1