summaryrefslogtreecommitdiff
path: root/VolumeManager.h
Commit message (Collapse)AuthorAgeFilesLines
* vold: Honor mount options for ext4/f2fs partitionsTom Marshall2020-04-111-2/+10
| | | | | | | | | | | | | * Save mount options and fstype for DiskPartition objects * Pass mount options and fstype to PublicVolume ctor * Pass mount options to ext4::Mount/f2fs:Mount * Use specified/default fstype if blkid fails This is trivially extensible for other fs types. [mikeioannina] Adapt for Pie and Q Change-Id: Ie5dd27f26a4a7129dd9efe6a7ad0a589928282a0
* vold: Support internal storage partitionsTom Marshall2020-04-111-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | * Support nonremovable disks and expose a nonremovable flag in the DiskCreated message. * New DiskPartition class to hold single partitions. DiskPartition is used when the fs_mgr entry has a partnum (eg. when fs_mgr_flags contains voldmanaged=label:#). Override disk partitioning methods to prevent destroying the emmc. Change-Id: Id7ec3ea409b5c96e691730604e4b1e9cc3aa9d33 vold: Correct base header paths These headers were moved to android-base Change-Id: I3eaa8316006b9017c5f5e31cd1e91efc2862106d DiskPartition.cpp: Add sysmacros.h dependency for major/minor Change-Id: I22c267c8f12b40fb3e2295becd88f12b75907b69 Signed-off-by: Adrian DC <radian.dc@gmail.com> [mikeioannina] Adapt for Pie and Q Change-Id: Id7ec3ea409b5c96e691730604e4b1e9cc3aa9d33
* Remove storage sandboxes related code.Sudheer Shanka2019-05-091-39/+1
| | | | | | | | | | | | | Bug: 131115422 Test: manual Test: atest --test-mapping packages/providers/MediaProvider Test: atest cts/hostsidetests/appsecurity/src/android/appsecurity/cts/ExternalStorageHostTest.java Test: atest DownloadProviderTests Test: atest cts/tests/app/src/android/app/cts/DownloadManagerTest.java Test: atest cts/tests/app/DownloadManagerLegacyTest/src/android/app/cts/DownloadManagerLegacyTest.java Test: atest cts/tests/app/DownloadManagerApi28Test/src/android/app/cts/DownloadManagerApi28Test.java Change-Id: Ib3272a47a901ed106474039e72f123b11f5443ff Merged-In: Ib3272a47a901ed106474039e72f123b11f5443ff
* Avoid creating /mnt/user/<userId>/package/<packageName> for all pkgs.Sudheer Shanka2019-02-211-2/+3
| | | | | | | | | Bug: 124466384 Test: manual Test: atest cts/hostsidetests/appsecurity/src/android/appsecurity/cts/ExternalStorageHostTest.java Test: atest cts/tests/app/src/android/app/cts/DownloadManagerTest.java Test: atest cts/tests/tests/provider/src/android/provider/cts/MediaStore* Change-Id: I678e199ef03805bb85a8a7ad9f1f7bae0a9fc56a
* Revert "Revert "Ensure necessary external storage dirs while creating ↵Sudheer Shanka2019-02-141-9/+2
| | | | | | | | | | sandboxes."" This reverts commit 88114b2a563d5bbbc68a16566e223797f4136227. Reason for revert: blocking issue in b/124345887 is resolved Change-Id: Ie34843c12b7a471d2384b64ad049ede63aed09e8
* Revert "Ensure necessary external storage dirs while creating sandboxes."Jeff Sharkey2019-02-141-2/+9
| | | | | | | | This reverts commit 083377e593429a6db7d64de69dcc9d7209f0f66d. Reason for revert: b/124345887 Change-Id: I388d45fab68b611917464a204269a48bf771ac57
* Ensure necessary external storage dirs while creating sandboxes.Sudheer Shanka2019-02-131-9/+2
| | | | | | | | | | Bug: 124058579 Test: manual Test: atest cts/hostsidetests/appsecurity/src/android/appsecurity/cts/ExternalStorageHostTest.java Test: atest cts/tests/app/src/android/app/cts/DownloadManagerTest.java Test: atest cts/tests/tests/provider/src/android/provider/cts/MediaStore* Change-Id: I0e62de38e9ceff80df75e253443af69d4391a49e
* Create a new MOUNT_EXTERNAL_LEGACY storage mode.Sudheer Shanka2019-01-181-1/+1
| | | | | | | | | | | | | | | | | | Apps that are already installed on the device before isolated_storage feature is enabled will be granted MOUNT_EXTERNAL_LEGACY mode. In this mode, /mnt/runtime/write will be mounted at /storage giving them same level of access as in P. A new mount directory /mnt/runtime/full is also created which will be used for mounting at /storage for apps started with MOUNT_EXTERNAL_FULL mode. This will allow apps with WRITE_MEDIA_STORAGE permission to read/write anywhere on the secondary devices without needing to bypass sdcardfs. Bug: 121277410 Test: manual Test: atest android.appsecurity.cts.ExternalStorageHostTest Change-Id: Icc1ff9da35545692daedef7173d7c89290dd2766
* Merge "vold: const-ify some of the API"TreeHugger Robot2018-12-201-4/+4
|\
| * vold: const-ify some of the APIGreg Kaiser2018-12-201-4/+4
| | | | | | | | | | | | | | | | We make some of the C++ member functions 'const', to reflect how they (don't) affect the state of the class. Test: TreeHugger Change-Id: Iec1c2801bfe721e2741406ed1ac0ef95662840a6
* | Update process mount points when appop gets updated.Sudheer Shanka2018-12-161-2/+4
|/ | | | | | | | | | When an app is started, it's mountmode is dependent on OP_REQUEST_INSTALL_PACKAGES. If user changes the appop grant of an app, we need to update the mounts of any processes running in that app. Bug: 121099965 Test: atest android.appsecurity.cts.ExternalStorageHostTest#testExternalStorageObbGifts Change-Id: I87fee492891d33ccc9fc9e2548114f67d90cc759
* Create a new mount mode for installer packages.Sudheer Shanka2018-12-121-0/+2
| | | | | | | | | New external storage mount mode for installers so that they can access obb dirs of all apps. Bug: 111789719 Test: atest android.appsecurity.cts#testExternalStorageObbGifts Change-Id: Iab112f0273806f8f812f14d6691bbe71dff42d83
* Merge "Extract AppFuse as a util" am: 7be8a7ee1d am: d04a16cbd5Risan2018-11-301-2/+0
|\ | | | | | | | | | | am: 9f7af4b6e3 Change-Id: I92a3fa8828e983df876d42637913737e2b31fd4f
| * Extract AppFuse as a utilRisan2018-11-141-2/+0
| | | | | | | | | | | | Bug: 110379912 Test: testOpenProxyFileDescriptor Change-Id: I0429a498d7b54682efe9b05815f3470e8745609e
| * Change AppFuse mount location to vold namespaceRisan2018-11-131-2/+3
| | | | | | | | | | | | | | | | | | Previously, AppFuse is mounted in system_server's mount namespace. This CL moves the mount location to vold namespace. Bug: 110379912 Test: testOpenProxyFileDescriptor passes Change-Id: Id93c26d5a98842c78f27850c83e15df619cec1ab
* | Change AppFuse mount location to vold namespaceRisan2018-11-261-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | Previously, AppFuse is mounted in system_server's mount namespace. This CL moves the mount location to vold namespace. Relanding this since it fails to be merged on ag/5521004 (blocked by Presubmit, seems to be caused by temporary state) - this one now passes presubmit without any changes. Bug: 110379912 Test: testOpenProxyFileDescriptor passes Change-Id: Id93c26d5a98842c78f27850c83e15df619cec1ab
* | Merge "StubVolume as first class Volume in Vold" am: dcbce84fed am: 14955896e5Risan2018-11-131-0/+7
|\| | | | | | | | | | | am: a294e197b4 Change-Id: Iaec41c8ffe6feaa59163987c914fa21edc7ae2cd
| * StubVolume as first class Volume in VoldRisan2018-11-081-0/+7
| | | | | | | | | | | | | | | | | | | | StubVolume is a Volume that is maintained by external party such as the ChromeOS processes in ARC++. Bug: 110380403 Test: Tested on ARC++ Change-Id: I3198bd7283d5f60a524da3707dea7385ffec599d
| * clang-format the rest of the filesPaul Crowley2018-09-201-15/+14
| | | | | | | | | | | | | | | | | | Apply clang-format to fix the remaining files not fixed by change I23cde3f0bbcac13bef555d13514e922c79d5ad48 Test: Format-only changes; treehugger suffices. Change-Id: I1bfd5c8d68d298596875d5edae26cdfe27c03489 Merged-In: I1bfd5c8d68d298596875d5edae26cdfe27c03489
* | Update StorageManagerService handling of packages info.Sudheer Shanka2018-10-251-3/+4
| | | | | | | | | | | | | | | | | | | | | | Instead of maintaining local copy of all appIds and sandboxIds, StorageManagerService will just get required packages info from PackageManagerService when an user starts and passes it to vold. Bug: 117988901 Test: manual Change-Id: Idab274529e843784c8804929e920c3af63032690
* | Delete package sandbox data when it is uninstalled.Sudheer Shanka2018-10-091-2/+6
| | | | | | | | | | | | Bug: 111890351 Test: manual Change-Id: I989d507f3352959e824b161a94c0eaad6eed9bba
* | Bind mount pkg specific dirs in the zygote child namespaces.Sudheer Shanka2018-09-271-5/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Also update vold to create sandboxes for secondary storage devices. - Since bind mounts are created in the process specific namespaces, we don't need /mnt/storage anymore which we were using it to prevent some bind mounts from propagating onto /mnt/runtime/write. - Create bind mounts for {media,obb} dirs similar to data dir in per process namespace. - Also fix a bug where we are not passing correct packages to vold when a new user starts. Bug: 111890351 Test: manual Change-Id: I7849efc4fbf3c654606fa30de7ab2de0236d766f
* | clang-format the rest of the filesPaul Crowley2018-09-191-24/+23
| | | | | | | | | | | | | | | | Apply clang-format to fix the remaining files not fixed by change I23cde3f0bbcac13bef555d13514e922c79d5ad48 Test: Format-only changes; treehugger suffices. Change-Id: I1bfd5c8d68d298596875d5edae26cdfe27c03489
* | Create sandboxes for newly installed apps.Sudheer Shanka2018-08-241-2/+4
| | | | | | | | | | | | Bug: 111890351 Test: manual Change-Id: I1b7f5bd25e04f9f4a61d0d4f64bbbb0ca6157fa5
* | Use /mnt/storage for bind mounting package sandboxes.Sudheer Shanka2018-08-231-0/+1
| | | | | | | | | | | | | | | | | | | | | | Create a new slave bind mount at /mnt/storage and use this for creating package sandboxes. This will help prevent package specific data directories from getting duplicated and also make handling bind mounts for packages with sharedUserIds easier. Bug: 111890351 Test: manual Change-Id: I0f590cc99a379d93f6db85bf56e8d274e3ea7488
* | Update vold to prepare package sandboxes for primary volume.Sudheer Shanka2018-08-011-1/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Vold is updated to create package specific sandboxes for primary volume and mount them at "/mnt/user/<user-id>/package/<package-name>/<primary-label>". This will later be mounted at /storage when a new process starts. Bug: 111890351 Test: Manually verified that a package has access to "/sdcard" and "/storage/emulated/0", both of which are just the package specific sandboxes and the package doesn't have access to other sandboxes and can't see other package names. Change-Id: I72dc8ae9eb2260a298159c5de18387dad2f9de48
* | Update vold to handle package info from StorageManagerService.Sudheer Shanka2018-08-011-0/+4
| | | | | | | | | | | | Bug: 111890351 Test: n/a Change-Id: I098ad4bc15fae843909d97dad5d301a4e53d51bc
* | Update IVold interface to take packageNames when a user starts.Sudheer Shanka2018-08-011-1/+1
| | | | | | | | | | | | | | Bug: 111890351 Test: n/a Change-Id: Ia24f15112f9a4ee4994688ff8fedf786cbf479b7 Exempt-From-Owner-Approval: This was approved as part of http://ag/4494673
* | Add APIs for pushing package info to vold.Sudheer Shanka2018-07-311-0/+4
|/ | | | | | Bug: 111890351 Test: n/a Change-Id: I3194a88a9ce612a2e4f2c7ea9e3392e0f8020fc1
* Delay touching disks when secure keyguard showing.Jeff Sharkey2017-12-151-0/+8
| | | | | | | | | | | | We've tried our best to protect against malicious storage devices with limited SELinux domains, but let's be even more paranoid and refuse to look at disks inserted while a secure keyguard is showing. We'll gladly scan them right away once the user confirms their credentials. Test: builds, boots, manual testing Bug: 68054513 Change-Id: I37fd6c25bbd6631fa4ba3f84e19384d746a22498
* Be even more C++. Switch on a warning.Paul Crowley2017-10-311-10/+0
| | | | | | | | | | Remove lots of "extern C" and "ifdef __cplusplus" which are no longer needed now all of vold is C++. Also turn on the cert-err58-cpp warning we once had to disable. Bug: 67041047 Test: compiles, boots Change-Id: I8c6f9dd486f2409e0deed7bb648d959677465b21
* Pass both partition GUID and filesystem UUID.Jeff Sharkey2017-10-241-1/+1
| | | | | | | | | | FDE keys are indexed using the partition GUID, while FBE keys will be indexed using the filesystem UUID, so pass both of those identifiers along when forgetting a volume. Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.AdoptableHostTest Bug: 25861755 Change-Id: I6e239d5ba67a01c9a848d705f6167da00f975924
* Undo Utils dependency on VolumeManagerPaul Crowley2017-10-201-4/+0
| | | | | | | | I want to use Utils in another executable, so breaking this link. Bug: 25861755 Test: compiles (and boots, though that doesn't exercise changed code) Change-Id: I6bb447453bb370fefb7f2f3aceb459428bdee6a7
* Move to modern utility methods from android::base.Jeff Sharkey2017-10-171-1/+1
| | | | | | | | | | | | | | | | | | Moves away from crufty char* operations to std::string utility methods, including android::base methods for splitting/parsing. Rewrite of how Process handles scanning procfs for filesystem references; now uses fts(3) for more sane traversal. Replace sscanf() with new FindValue() method, also has unit tests. Remove some unused methods. Switch almost everyone over to using modern logging library. Test: cts-tradefed run commandAndExit cts-dev -m CtsOsTestCases -t android.os.storage.cts.StorageManagerTest Test: cts-tradefed run commandAndExit cts-dev --abi armeabi-v7a -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.AdoptableHostTest Bug: 67041047 Change-Id: I70dc512f21459d1e25b187f24289002b2c7bc7af
* Destroy vold socket interface completely.Jeff Sharkey2017-09-181-83/+0
| | | | | | | | Long live Binder. Test: yes Bug: 13758960 Change-Id: If6be379b5a873f1b0c66dd1522b87413ad10fc46
* Move long-running calls to async with listeners.Jeff Sharkey2017-09-151-2/+0
| | | | | | | | | | | | | | | | Now that we're using Binder, we can have callers provide explicit listeners for every request instead of trying to squeeze them all into unsolicited socket events. Move benchmarking to be async to avoid blocking other commands for up to several minutes. Remove post-trim benchmarking flag, since benchmarking now requires a separate callback. Will bring back in a future CL. Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.AdoptableHostTest Test: adb shell sm fstrim Bug: 62201209, 13758960 Change-Id: I0f2ebf1ac3b4252ecd6b44303f2887adfdb58e86
* Move unsolicited vold events to Binder.Jeff Sharkey2017-09-131-0/+7
| | | | | | | | | | | | | | Create IVoldListener and move most unsolicited vold events over to this new interface. The remaining events will be routed through method-specific listeners instead of a global one. Move to upstream DISALLOW_COPY_AND_ASSIGN macro. Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.DirectBootHostTest Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.AdoptableHostTest Test: cts-tradefed run commandAndExit cts-dev -m CtsOsTestCases -t android.os.storage.cts.StorageManagerTest Bug: 13758960 Change-Id: Ib9293487db2d525a76b9b9c2e9ac18d98601c6cf
* Move all crypto commands over to Binder.Jeff Sharkey2017-09-121-0/+2
| | | | | | | | | | | | | | | | | Prefix FDE related commands with "fde" to make it clear which devices they apply to. This will also make it easier to remove once FDE is fully deprecated in a future release. To emulate the single-threaded nature of the old socket, introduce a lock that is acquired for all encryption related methods. Sprinkle some "const" around older files to make C++ happy. Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.DirectBootHostTest Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.AdoptableHostTest Test: cts-tradefed run commandAndExit cts-dev -m CtsOsTestCases -t android.os.storage.cts.StorageManagerTest Bug: 13758960 Change-Id: I0a6ec6e3660bbddc61424c344ff6ac6da953ccf0
* Move even more vold commands over to Binder.Jeff Sharkey2017-09-111-2/+15
| | | | | | | | | | | | | | | | | | | | | | This moves fstrim, obb and appfuse commands over to the new Binder interface. This change also separates creating/destroying and mounting/unmounting of OBB volumes, which means they finally flow nicely into the modern VolumeInfo/VolumeBase design. We now generate unique identifiers for all OBB volumes, instead of using a shady MD5 hash. Change all "loop" and "dm" devices to tag the kernel resources with a vold-specific prefix so that we can clean them up if vold crashes; there are new destroyAll() methods that handle this cleanup. Move appfuse mounting/unmounting into VolumeManager so it can be shared. Move various model objects into a separate directory to tidy things up. Test: cts-tradefed run commandAndExit cts-dev -m CtsOsTestCases -t android.os.storage.cts.StorageManagerTest Bug: 13758960 Change-Id: I7294e32b3fb6efe07cb3b77bd20166e70b66958f
* Move "volume" commands over to Binder.Jeff Sharkey2017-09-071-1/+1
| | | | | | | | | | | | Keep the old socket-based commands intact for awhile so we can rapidly disable this change using the ENABLE_BINDER feature flag. Define constants in AIDL to keep Java and C++ in sync. Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.ExternalStorageHostTest Test: cts-tradefed run commandAndExit cts-dev --abi armeabi-v7a -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.AdoptableHostTest Bug: 13758960 Change-Id: I0d6f82cbebe67f671b60949fd727409aeb1fdc0d
* do not sleep if it is shutting downKeun-young Park2017-08-021-0/+3
| | | | | | | | | | - Various sleep(5) for vold shutdown can increase shutdown time a lot. - If it is shutting down, do not sleep at all. init will take care of active partitions if not unmounted. bug: 64143519 Test: reboot and check logs from vold, check if "ShutdownThread: Shutdown wait timed out" happens. Change-Id: I7cb91427ad2205fe23a054d255caf7ffdfd9f6c3
* Add a new "virtual disk" feature.Jeff Sharkey2017-03-251-0/+3
| | | | | | | | | | | | | | | It's extremely difficult to test storage related logic on devices that don't have physical SD card slots. So to support better debugging and testing, add a new "virtual disk" feature which mounts a 512MB file through loop device. It relies on the kernel having the "loop.max_part" value set to something other than 0 via the boot command line, since that allows all the existing partition logic to fall into place. Bug: 34903607 Test: builds, boots, virtual disk works Change-Id: I04c5b33e37319d867542985a56b7999a9b7cf35d
* Fix misc-macro-parentheses warnings in system/vold.Chih-Hung Hsieh2016-06-101-1/+1
| | | | | | | Add parentheses around macro arguments used beside operators. Bug: 28705665 Change-Id: I44e954f15bf6b8279d0f857d5417b7cb457da779
* vold: fix 64 bit ioctl errorMateusz Nowak2015-10-211-2/+2
| | | | | | | | | | | Changing the num_sectors used in ioctl with BLKGETSIZE because the kernel expects an unsigned long type and then changes 64 bits with a 64 bits userspace. This overwrites what's located close to the parameter location if any. Change-Id: I78fd61a1084de2741f39b926aa436462518709a0 Signed-off-by: Mateusz Nowak <mateusz.nowak@intel.com> Signed-off-by: Zhiquan Liu <zhiquan.liu@intel.com>
* Trim both internal and adopted private storage.Jeff Sharkey2015-07-011-1/+3
| | | | | | | | | | | | | Refactor fstrim code to be encapsulated in unique task object, and give it option of benchmarking when finished. Trimming now includes both storage from fstab and adopted private volumes. Cleaner timing stats are logged for each unique volume. Add wakelock during ongoing async move tasks. Push disk sysfs path to framework so it can parse any SD card registers as desired. Bug: 21831325 Change-Id: I76577685f5cae4929c251ad314ffdaeb5eb1c8bf
* Let's reinvent storage, yet again!Jeff Sharkey2015-06-251-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Add method to forget private partition keys.Jeff Sharkey2015-06-221-0/+2
| | | | | | | | | Report both the disk and the partition GUID for private volumes to userspace, and offer to forget the encryption key for a given partition GUID. Bug: 21782268 Change-Id: Ie77a3a58e47bf3563cdb3e4b0edfab1de4d0e6b4
* Start tracking added users with serial numbers.Jeff Sharkey2015-06-101-3/+8
| | | | | | | | vold will eventually use the serial numbers to clean up stale user directories when mounting private storage devices. Bug: 20275572 Change-Id: Ia29cb5da23e969f3087bb5caa5dc8f4e88f07613
* Initial pass at storage benchmarks.Jeff Sharkey2015-05-151-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | Now that we're offering to store private app data on adopted storage devices, the performance of those devices is much more important to overall user experience. To help set user expectations, this change offers to execute a real-world benchmark on a storage device, returning a metric that can be used to compare internal and external storage. The benchmark is generated from the strace-instrumented storage access patterns of typical apps. A typical device completes the benchmark in under two seconds on internal storage, a UHS-3 SD card is even faster (!), but a very slow Class 4 SD card takes about 30 seconds to complete, giving us a clear signal. The measured benchmark numbers are logged along with information about the storage device, such as manufacturer, model, etc. Card serial numbers are scrubbed from output. Bug: 21172095 Change-Id: I9b2713dafdfdfcf5d97bf1bc21841f39409a7e54
* Wider volume mutation lock, move force adoptable.Jeff Sharkey2015-04-211-1/+7
| | | | | | | | | | We eventually should move back to per-disk locks, but use a giant lock to keep development rolling forward. Also move force adoptable flag to framework since, since encrypted devices don't have persisted properties loaded early during boot. Bug: 19993667 Change-Id: Ifa3016ef41b038f8f71fc30bc81596cfd21dcd2a