summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2017-08-28 07:31:09 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2017-08-28 07:31:09 +0000
commit4d75750d3ae4db090265dcbffdc40f49e4a7bb00 (patch)
treee9f7aaa8b98a9125c1f394e17b4d2db800db6f11
parentbb2a8bb1f9e775d9ef3857f7c98fd3af5470bbae (diff)
parenteb29dced7182d4fc955fd380ba97c67f8285e5b0 (diff)
downloadextras-4d75750d3ae4db090265dcbffdc40f49e4a7bb00.tar.gz
release-request-c924aaac-f0a2-4215-8dc4-e314f22460d9-for-git_oc-mr1-release-4301796 snap-temp-L23200000097143969
Change-Id: I6c879a89736bf27be5d9508ea8dad6d9a346ab90
-rw-r--r--ext4_utils/ext4_crypt_init_extensions.cpp18
-rw-r--r--perfprofd/Android.bp2
2 files changed, 18 insertions, 2 deletions
diff --git a/ext4_utils/ext4_crypt_init_extensions.cpp b/ext4_utils/ext4_crypt_init_extensions.cpp
index 2bf88012..35a1c219 100644
--- a/ext4_utils/ext4_crypt_init_extensions.cpp
+++ b/ext4_utils/ext4_crypt_init_extensions.cpp
@@ -41,6 +41,8 @@
static const std::string arbitrary_sequence_number = "42";
static const int vold_command_timeout_ms = 60 * 1000;
+static int set_system_de_policy_on(char const* dir);
+
int e4crypt_install_keyring()
{
key_serial_t device_keyring = add_key("keyring", "e4crypt", 0, 0,
@@ -58,11 +60,22 @@ int e4crypt_install_keyring()
int e4crypt_set_directory_policy(const char* dir)
{
+ if (!dir || strncmp(dir, "/data/", 6)) {
+ return 0;
+ }
+
+ // Special-case /data/media/obb per b/64566063
+ if (strcmp(dir, "/data/media/obb") == 0) {
+ // Try to set policy on this directory, but if it is non-empty this may fail.
+ set_system_de_policy_on(dir);
+ return 0;
+ }
+
// Only set policy on first level /data directories
// To make this less restrictive, consider using a policy file.
// However this is overkill for as long as the policy is simply
// to apply a global policy to all /data folders created via makedir
- if (!dir || strncmp(dir, "/data/", 6) || strchr(dir + 6, '/')) {
+ if (strchr(dir + 6, '/')) {
return 0;
}
@@ -83,7 +96,10 @@ int e4crypt_set_directory_policy(const char* dir)
return 0;
}
}
+ return set_system_de_policy_on(dir);
+}
+static int set_system_de_policy_on(char const* dir) {
std::string ref_filename = std::string("/data") + e4crypt_key_ref;
std::string policy;
if (!android::base::ReadFileToString(ref_filename, &policy)) {
diff --git a/perfprofd/Android.bp b/perfprofd/Android.bp
index 58926dc2..0842dc98 100644
--- a/perfprofd/Android.bp
+++ b/perfprofd/Android.bp
@@ -66,7 +66,7 @@ cc_binary {
"libcutils"
],
system_shared_libs: [
- "libc",
+ "libc", "libdl",
],
cppflags: perfprofd_cppflags,