Create misc_ce and misc_de mirror storage

Create a mirror directory for misc_ce and misc_de storage by bind
mounting the respective directories. This is done for the defaul null
volume only, and other volumes are handled at a later staged.

When an SDK sandbox process is spawned and data isolation needs to
occur, the sdksandbox directories present in the misc directories will
be used to bind mount from, after tmpfs is mounted on the original.

Bug: 214241165
Test: atest SdkSandboxStorageHostTest

Change-Id: Icb1dc7d7fbd53a5c3853acf2f9d4d75b278d7295
Merged-In: Icb1dc7d7fbd53a5c3853acf2f9d4d75b278d7295
This commit is contained in:
Sanjana Sunil 2022-03-28 19:05:36 +00:00
parent f6a35e2c5f
commit 5c7ff8841a

View file

@ -940,16 +940,20 @@ on post-fs-data
restorecon /data/media
exec - media_rw media_rw -- /system/bin/chattr +F /data/media
# A tmpfs directory, which will contain all apps CE DE data directory that
# bind mount from the original source.
# A tmpfs directory, which will contain all apps and sdk sandbox CE and DE
# data directory that bind mount from the original source.
mount tmpfs tmpfs /data_mirror nodev noexec nosuid mode=0700,uid=0,gid=1000
restorecon /data_mirror
mkdir /data_mirror/data_ce 0700 root root
mkdir /data_mirror/data_de 0700 root root
mkdir /data_mirror/misc_ce 0700 root root
mkdir /data_mirror/misc_de 0700 root root
# Create CE and DE data directory for default volume
mkdir /data_mirror/data_ce/null 0700 root root
mkdir /data_mirror/data_de/null 0700 root root
mkdir /data_mirror/misc_ce/null 0700 root root
mkdir /data_mirror/misc_de/null 0700 root root
# Bind mount CE and DE data directory to mirror's default volume directory.
# Note that because the /data mount has the "shared" propagation type, the
@ -957,6 +961,8 @@ on post-fs-data
# propagate to /data_mirror/data_ce/null/0 as well.
mount none /data/user /data_mirror/data_ce/null bind rec
mount none /data/user_de /data_mirror/data_de/null bind rec
mount none /data/misc_ce /data_mirror/misc_ce/null bind rec
mount none /data/misc_de /data_mirror/misc_de/null bind rec
# Create mirror directory for jit profiles
mkdir /data_mirror/cur_profiles 0700 root root