History log of /system/vold/EmulatedVolume.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
75ae529bf86c33106e6a716ad054c6eea6deabc5 15-Sep-2017 Rom Lemarchand <romlem@google.com> Revert "Revert "Add support for gid derivation on private volumes""

This reverts commit a3a60b372efb48a672848c7797efd57a4ec92303.

Reason for revert: All kernel prebuilts merged

Bug: 65600849
Bug: 65573871
Change-Id: I75b0cb1d82213b875cbef8d39f4f1a8fb34b9795
/system/vold/EmulatedVolume.cpp
a3a60b372efb48a672848c7797efd57a4ec92303 14-Sep-2017 Richard Uhler <ruhler@google.com> Revert "Add support for gid derivation on private volumes"

This reverts commit 1b38e330035833971663eeb5bccfa16e4ffc1e72.

Causes a boot loop on bullhead.

Bug: 63245673
Bug: 65660058
Change-Id: I9c8afd3ba22547aff5aff06b71cb8ff3b8a07350
/system/vold/EmulatedVolume.cpp
1b38e330035833971663eeb5bccfa16e4ffc1e72 07-Sep-2017 Daniel Rosenberg <drosen@google.com> Add support for gid derivation on private volumes

This sdcardfs feature was moved under a mount option
and is only needed on private volumes

Test: Private emulated volume should attempt to mount with
derive_gid option.
Bug: 63245673
Change-Id: I40a8b15c298c815a4643007b9eca8269379fd2ac
/system/vold/EmulatedVolume.cpp
1d79d1014e481c92c3f802bbaf174409d191571f 12-Jul-2017 Daniel Rosenberg <drosen@google.com> Check if sdcard daemon exited.

If the system is using sdcardfs, the sdcard daemon exits after mounting.
If it's using FUSE, the sdcard daemon runs until we go to unmount.

Bug: 37638548
Test: Run "adb shell ps | grep -w Z" with sdcardfs enabled.
The sdcard daemon should not be listed.
Run again with sdcardfs disabled. The daemon should be
running, and vold should not be stuck waiting on it.
Change-Id: I930d22b35194ec99e7a6a4a022a04d36f4f39a34
/system/vold/EmulatedVolume.cpp
0e08e84df0d0b555cf20e3bbe68bb4da7c287012 18-May-2017 Elliott Hughes <enh@google.com> vold should #include <sys/sysmacros.h>

Bug: https://github.com/android-ndk/ndk/issues/398
Test: builds
Change-Id: I7a1ca1701099886fb493cc5288d6ee867d5f520a
/system/vold/EmulatedVolume.cpp
ea243a3015edc86428167e97a1ab50c85cf409f2 21-Jan-2016 Narayan Kamath <narayan@google.com> Unmount emulated filesystems before killing the fuse process.

Avoid ENOTCONN for file system operations.

bug: 26645585
bug: 26070583
Change-Id: I19b00db37ef7ba85a2cae16c7c4204826653f559
/system/vold/EmulatedVolume.cpp
a9d5080109623884c8f8e7c3515eaa9ed3f85c58 05-Dec-2015 Elliott Hughes <enh@google.com> Merge "Track rename from base/ to android-base/."
am: 20a8fa98f6

* commit '20a8fa98f6b858999b623272a182843259e1044c':
Track rename from base/ to android-base/.
7e128fbe212c64492afa98bfd6d7fab6f1956831 05-Dec-2015 Elliott Hughes <enh@google.com> Track rename from base/ to android-base/.

Change-Id: I3096cfa50afa395d8e9a8043ab69c1e390f86ccb
/system/vold/EmulatedVolume.cpp
89f74fbf2529d708534c041d2b711af0f1feff9f 21-Oct-2015 Jeff Sharkey <jsharkey@android.com> Kill apps using storage through bind mounts.

When unmounting an emulated volume, look for apps with open files
using the final published volume path.

Without this change, we were only looking at the internal paths
used for runtime permissions, which apps never use directly. This
meant we'd always fail to unmount the volume if apps didn't respect
the EJECTING broadcast, and volume migration would end up wedged
until the device rebooted.

Bug: 24863778
Change-Id: Ibda484e66ab95744c304c344b226caa5b10b7e2e
/system/vold/EmulatedVolume.cpp
1bd078fa7b5ca613cb3e793d67ccd86d2602787d 06-Aug-2015 Jeff Sharkey <jsharkey@android.com> Protect runtime storage mount points.

We have a bunch of magic that mounts the correct view of storage
access based on the runtime permissions of an app, but we forgot to
protect the real underlying data sources; oops.

This series of changes just bumps the directory heirarchy one level
to give us /mnt/runtime which we can mask off as 0700 to prevent
people from jumping to the exposed internals.

Also add CTS tests to verify that we're protecting access to
internal mount points like this.

Bug: 22964288
Change-Id: I83f09f0423f4993e766273c50389dd29b1c50589
/system/vold/EmulatedVolume.cpp
81f55c6dc1a14ed68e404fa3a2c244dd343e4990 07-Jul-2015 Jeff Sharkey <jsharkey@android.com> Mount emulated volumes as consistent location.

We really only support a single emulated volume on the device at a
time, either on internal storage, or moved to a private volume. To
avoid kicking off a giant rescan of all media when moved, keep all
the paths the same when mounted as primary.

Also ensure we have /data/media/0 ready on private volumes.

Bug: 20275423
Change-Id: I0c102f430b865ca7536772b1fae56d8c9660a97a
/system/vold/EmulatedVolume.cpp
c7b5b570bd05ed3bc921b0c2dc346416a52b4e3e 01-Jul-2015 Jeff Sharkey <jsharkey@android.com> Null-terminate readlink() result, full remount.

In order to compare results from readlink() calls, we need to null
terminate the read value, otherwise we can end up doing an infinitely
recursive remount in the root namespace.

When remounting inside a namespace, unmount all existing mounts before
mounting the new storage into place. This also means we need to mount
the user-specific symlinks back into place.

Skip spinning up the FUSE daemon when not visible, otherwise we get
stuck waiting for a daemon that never shows up.

Bug: 22192518, 22204412
Change-Id: Icc7db822354ab7ffc47c39cd0611f65edecc32e5
/system/vold/EmulatedVolume.cpp
66270a21df1058434e4d63691221f11ff5387a0f 24-Jun-2015 Jeff Sharkey <jsharkey@android.com> Let's reinvent storage, yet again!

Now that we're treating storage as a runtime permission, we need to
grant read/write access without killing the app. This is really
tricky, since we had been using GIDs for access control, and they're
set in stone once Zygote drops privileges.

The only thing left that can change dynamically is the filesystem
itself, so let's do that. This means changing the FUSE daemon to
present itself as three different views:

/mnt/runtime_default/foo - view for apps with no access
/mnt/runtime_read/foo - view for apps with read access
/mnt/runtime_write/foo - view for apps with write access

There is still a single location for all the backing files, and
filesystem permissions are derived the same way for each view, but
the file modes are masked off differently for each mountpoint.

During Zygote fork, it wires up the appropriate storage access into
an isolated mount namespace based on the current app permissions. When
the app is granted permissions dynamically at runtime, the system
asks vold to jump into the existing mount namespace and bind mount
the newly granted access model into place.

Bug: 21858077
Change-Id: Iade538e4bc7af979fe20095f74416e8a0f165a4a
/system/vold/EmulatedVolume.cpp
8d15cb9828f89709243b33c610b429694788c05d 13-May-2015 Jeff Sharkey <jsharkey@android.com> Report internal path for public volumes.

Used by framework to bypass FUSE daemon overhead in some cases.

Bug: 21017105
Change-Id: I2f3ae70607417fc4cd2c970cb17cf3afa2f42613
/system/vold/EmulatedVolume.cpp
1d6fbcc389ecb9f418076e8ab5f4c93a5d911de9 25-Apr-2015 Jeff Sharkey <jsharkey@android.com> Migrate primary external storage.

When requested, kick off a thread that will migrate storage contents
between two locations. This is performed in several steps that
also interact with the framework:

1. Take old and new volumes offline during migration
2. Wipe new location clean (10% of progress)
3. Copy files from old to new (60% of progress)
4. Inform framework that move was successful so it can persist
5. Wipe old location clean (15% of progress)

Derives a hacky progress estimate by using a rough proxy of free
disk space changes while a cp/rm is taking place.

Add new internal path for direct access to volumes to bypass any
FUSE emulation overhead, and send it to framework. Remove mutex
around various exec calls since setexeccon() is already per-thread.

Bug: 19993667
Change-Id: Ibcb4f6fe0126d05b2365f316f53e71dc3e79a2b8
/system/vold/EmulatedVolume.cpp
3161fb3702830b586b2e36fa9ca4519f59f951b4 13-Apr-2015 Jeff Sharkey <jsharkey@android.com> Emulated volumes above private volumes.

When a private volume is mounted, create an emulated volume above it
hosted at the /media path on that device. That emulated volume is
automatically torn down when unmounting the private volume.

Add "removed" state for volume, which signals to framework that
media has left the building, send when the volume is destroyed.

Bug: 19993667
Change-Id: I1f82b51de578ac5cfcc5d7b9a6fb44f6f25c775c
/system/vold/EmulatedVolume.cpp
9c48498f4529f623650c56d03e63324c8d813032 31-Mar-2015 Jeff Sharkey <jsharkey@android.com> Support for private (adopted) volumes.

This adds support for private volumes which is just a filesystem
wrapped in a dm-crypt layer. For now we're using the exact same
configuration as internal encryption (aes-cbc-essiv:sha256), but we
don't store any key material on the removable media. Instead, we
store the key on internal storage, and use the GPT partition GUID
to identify which key should be used.

This means that private external storage is effectively as secure as
the internal storage of the device. That is, if the internal storage
is encrypted, then our external storage key is also encrypted.

When partitioning disks, we now support a "private" mode which has
a PrivateVolume partition, and a currently unused 16MB metadata
partition reserved for future use. It also supports a "mixed" mode
which creates both a PublicVolume and PrivateVolume on the same
disk. Mixed mode is currently experimental.

For now, just add ext4 support to PrivateVolume; we'll look at f2fs
in a future change. Add VolumeBase lifecycle for setting up crypto
mappings, and extract blkid logic into shared method. Sprinkle some
more "static" around the cryptfs code to improve invariants.

Bug: 19993667
Change-Id: Ibd1df6250735b706959a1eb9d9f7219ea85912a0
/system/vold/EmulatedVolume.cpp
36801cccf27152c9eca5aab6ba3527221525110f 14-Mar-2015 Jeff Sharkey <jsharkey@android.com> Progress towards dynamic storage support.

Wire up new Disk and VolumeBase objects and events to start replacing
older DirectVolume code. Use filesystem UUID as visible PublicVolume
name to be more deterministic.

When starting, create DiskSource instances based on fstab, and watch
for kernel devices to appear. Turn matching devices into Disk
objects, scan for partitions, and create any relevant VolumeBase
objects. Broadcast all of these events towards userspace so the
framework can decide what to mount.

Keep track of the primary VolumeBase, and update the new per-user
/storage/self/primary symlink for all started users.

Provide a reset command that framework uses to start from a known
state when runtime is restarted. When vold is unexpectedly killed,
try recovering by unmounting everything under /mnt and /storage
before moving forward.

Remove UMS sharing support for now, since no current devices support
it; MTP is the recommended solution going forward because it offers
better multi-user support.

Switch killProcessesWithOpenFiles() to directly take signal. Fix
one SOCK_CLOEXEC bug, but SELinux says there are more lurking.

Bug: 19993667
Change-Id: I2dad1303aa4667ec14c52f774e2a28b3c1c1ff6d
/system/vold/EmulatedVolume.cpp
ae9e8903375e13028b140e86fcc68c6e152b6f43 16-Mar-2015 Dan Albert <danalbert@google.com> Update for libbase.

Change-Id: I23b1281a63031a7481ea7b33c9ddbdbe7d3d6174
/system/vold/EmulatedVolume.cpp
deb240573754daf36fa8ea10a05240f9f31e7b2c 03-Mar-2015 Jeff Sharkey <jsharkey@android.com> Checkpoint of better dynamic device support.

This is the first in a series of changes that are designed to
introduce better support for dynamic block devices.

It starts by defining a new Volume object which represents a storage
endpoint that knows how to mount, unmount, and format itself. This
could be a filesystem directly on a partition, or it could be an
emulated FUSE filesystem, an ASEC, or an OBB.

These new volumes can be "stacked" so that unmounting a volume will
also unmount any volumes stacked above it. Volumes that provide
shared storage can also be asked to present themselves (through bind
mounts) into user-specific mount areas.

This change also adds a Disk class which is created based on block
kernel netlink events. Instead of waiting for partition events from
the kernel, it uses gptfdisk to read partition details and creates
the relevant Volume objects.

Change-Id: I0e8bc1f8f9dcb24405f5e795c0658998e22ae2f7
/system/vold/EmulatedVolume.cpp