summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2020-04-21 16:44:41 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2020-04-21 16:44:41 +0000
commit68a5b66b99cc14745af402151505876dec417512 (patch)
tree67c699787fae4c9d1f713d3f0240b61779ca2208
parent126b010f150f100d23d6f4d3c41b2de0596a05b6 (diff)
parenta4c163d734277ae1538a5349cb077cc2391623bb (diff)
downloadcore-68a5b66b99cc14745af402151505876dec417512.tar.gz
Merge "Add /mnt/androidwritable for MOUNT_EXTERNAL_ANDROID_WRITABLE apps"
-rw-r--r--init/mount_namespace.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/init/mount_namespace.cpp b/init/mount_namespace.cpp
index 0749fe3b8..f3b584c4c 100644
--- a/init/mount_namespace.cpp
+++ b/init/mount_namespace.cpp
@@ -240,14 +240,20 @@ bool SetupMountNamespaces() {
// slave to the /mnt/user mount, and at the same time /mnt/installer in the
// bootstrap namespace shares a peer group with /mnt/installer in the
// default namespace.
+ // /mnt/androidwritable is similar to /mnt/installer but serves for
+ // MOUNT_EXTERNAL_ANDROID_WRITABLE apps.
if (!mkdir_recursive("/mnt/user", 0755)) return false;
if (!mkdir_recursive("/mnt/installer", 0755)) return false;
+ if (!mkdir_recursive("/mnt/androidwritable", 0755)) return false;
if (!(BindMount("/mnt/user", "/mnt/installer", true))) return false;
- // First, make /mnt/installer a slave bind mount
+ if (!(BindMount("/mnt/user", "/mnt/androidwritable", true))) return false;
+ // First, make /mnt/installer and /mnt/androidwritable a slave bind mount
if (!(MakeSlave("/mnt/installer"))) return false;
+ if (!(MakeSlave("/mnt/androidwritable"))) return false;
// Then, make it shared again - effectively creating a new peer group, that
// will be inherited by new mount namespaces.
if (!(MakeShared("/mnt/installer"))) return false;
+ if (!(MakeShared("/mnt/androidwritable"))) return false;
bootstrap_ns_fd.reset(OpenMountNamespace());
bootstrap_ns_id = GetMountNamespaceId();