summaryrefslogtreecommitdiff
path: root/VoldNativeService.cpp
Commit message (Collapse)AuthorAgeFilesLines
* vold: Wrapped key support for FBEShivaprasad Hongal2020-01-031-0/+8
| | | | | | | | | | Changes to key management in vold such that no keys are present in the clear in HLOS. Using keymaster to generate and manage keys. CRs-Fixed: 2288316 Change-Id: Iaf5bf2eb60c60364f495e6d176e19b4848850028
* vold: Add Hardware FDE featureAnilKumar Chimata2019-12-141-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Add HW FDE changes to new tip along with soong rules for conditional compilation. Following changes for HW FDE as well ported: - Restart Android framework after HW FDE key has been created - Add support of Inline Cryto Engine - Use new HW FDE apis to update password - vold: Tie HW FDE keys with Root of Trust(ROT) - vold: Fix HW FDE OTA support on SW FDE encrypted device - vold: Fix return value from get_keymaster_hw_fde_passwd() - vold: Remove creation of new keymaster key for password update - vold: Fix password update issue with HW FDE - vold: hw_fde: fix OTA issues from L to M - vold: Branch out SW and HW FDE paths to improve boot up time - cryptfs: Use lower case alphabets for hex key during OTA upgrades - vold: Improve device boot up time (Tune sleep calls) - Retry mount if mount fails after setting HW FDE key - cryptfs: Fix compilation error - cryptfs: Fix mount failure when encryption triggered from settings - cryptfs: fix issue that caused problems with forced HW encryption - cryptfs: fix wrong password set by user during bootup. CRs-Fixed: 2210986 Change-Id: I77279fc7e309ac94535123a2b2dbcb228bb47251
* Create a per-boot key on each bootPaul Crowley2019-09-171-1/+1
| | | | | | | | | Bug: 140882488 Test: Booted twice, checked logs to ensure encryption is different each time, adb created files in directory. Cherry-Picked-From: c8a3ef3f3c501c7bc14a2078dde513765cdb56d7 Merged-In: I74077bf8f727dab726c25f512ed7406a74cbe0bf Change-Id: I74077bf8f727dab726c25f512ed7406a74cbe0bf
* Make ext4 userdata checkpoints work with metadata encryptionPaul Lawrence2019-06-271-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When both ext4 user data checkpoints and metadata encryption are enabled, we are creating two stacked dm devices. This had not been properly thought through or debugged. Test: Enable metadata encryption on taimen (add keydirectory=/metadata/vold/metadata_encryption to flags for userdata in fstab.hardware) Unfortunately metadata is not wiped by fastboot -w, so it is necessary to rm metadata/vold -rf whenever you wipe data. fastboot flashall -w works fastboot reboot -w works A normal boot works Disable checkpoint commits with setprop persist.vold.dont_commit_checkpoint 1 vdc checkpoint startCheckpoint 10 adb reboot wait for device to fully boot then adb reboot Wait for device to fully boot then adb logcat -d | grep Checkpoint shows the rollback in the logs This tests encryption on top of checkpoints with commit, encryption without checkpoints, and rollback, which seems to be the key cases. Also ran same tests on unmodified Taimen and Blueline Bug: 135905679 Merged-In: I8365a40298b752af4bb10d00d9ff58ce04beab1f Change-Id: I8365a40298b752af4bb10d00d9ff58ce04beab1f
* Remove storage sandboxes related code.Sudheer Shanka2019-05-091-127/+6
| | | | | | | | | | | | | 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
* Merge changes I977cc03b,I7b621476,Ib57f4461 am: 58551c0568 am: 5da6d2a0f9Daniel Rosenberg2019-03-211-2/+3
|\ | | | | | | | | | | am: 6647c75d3c Change-Id: Iecf990d139b98ba2788cb6ba82e6673c28bb08c2
| * Change abortChanges to take a message and boolDaniel Rosenberg2019-03-211-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | abortChanges will attempt to pass a reboot message, and will only reboot if the device is currently checkpointing. Additionally, it can opt to attempt to prevent future attempts. This only works for non-bootloader controlled updates. Failures are ignored, as it will always reboot the device. In the unlikely event of such a failure, the device will continue to retry as though you did not ask to prevent future attempts. Test: vdc checkpoint abortChanges abort_retry_test 1 vdc checkpoint abortChanges abort_noretry_test 0 Change-Id: I7b6214765a1faaf4fd193c73331696b53ae572d2
* | Merge "Add vdc checkpoint supportsBlockCheckpoint" am: 860c731158 am: 4c5ce24e80Paul Lawrence2019-03-181-0/+14
|\| | | | | | | | | | | am: ca54294cf8 Change-Id: Ibee238347b863404670e972f41cebcb4986c8435
| * Add vdc checkpoint supportsBlockCheckpointPaul Lawrence2019-03-181-0/+14
| | | | | | | | | | | | | | | | | | | | Also add vdc checkpoint supportsFileCheckpoint This is to allow tests to be specific to supported checkpoint mode. Test: Built on Taimen and Crosshatch, made sure both new functions work as expected Change-Id: I0eab7453b13c0a2e31840ef9ad24a692cec55b00
* | Merge changes I91cf0def,I47570e8e am: 5f01cf3cac am: 84ceaedb59Daniel Rosenberg2019-03-071-0/+8
|\| | | | | | | | | | | am: 738694469d Change-Id: I3df9cd0523d2bfcdc716c855c8dca86aba09be9d
| * Add vdc checkpoint restoreCheckpointPartDaniel Rosenberg2019-03-071-0/+8
| | | | | | | | | | | | | | | | Restores the first n entries of a checkpoint. Allows automated testing of interrupted restores. Test: vdc checkpoint restoreCheckpoint [device] [n] Change-Id: I47570e8eba0bc3c6549a04a33600df05d393990b
* | Merge "Add supportsCheckpoint" am: 9b2b8fd459 am: 908a4569e9Daniel Rosenberg2019-01-231-0/+7
|\| | | | | | | | | | | am: 4cd2102637 Change-Id: I73fea54d60f27468a46bca872ae2f21bdfcb67a1
| * Add supportsCheckpointDaniel Rosenberg2019-01-221-0/+7
| | | | | | | | | | | | | | | | | | | | | | This returns true if any entries in the fstab have checkpoint= set. Test: Call vdc checkpoint supportsCheckpoint. Should return 1 iff an fstab entry has checkpoint=fs or checkpoint=block set Bug: 111020314 Change-Id: Ic79bc96ded4da6605f73992dcff542e7cb50d705
| * Change AppFuse mount location to vold namespaceRisan2018-11-131-4/+21
| | | | | | | | | | | | | | | | | | 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
* | Update process mount points when appop gets updated.Sudheer Shanka2018-12-161-18/+1
| | | | | | | | | | | | | | | | | | | | 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
* | Change AppFuse mount location to vold namespaceRisan2018-11-261-4/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | 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 "Update shared sandbox prefix to "shared-"."Sudheer Shanka2018-11-141-3/+3
|\ \
| * | Update shared sandbox prefix to "shared-".Sudheer Shanka2018-11-131-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | ":" is not allowed in filenames by vfat. Bug: 119525489 Test: sm set-virtual-disk true Change-Id: I22945f2b359b6523ed0a058ca4015dcfef7f7d0e
* | | Merge "StubVolume as first class Volume in Vold" am: dcbce84fed am: 14955896e5Risan2018-11-131-0/+23
|\ \ \ | |/ / |/| / | |/ | | | | am: a294e197b4 Change-Id: Iaec41c8ffe6feaa59163987c914fa21edc7ae2cd
| * StubVolume as first class Volume in VoldRisan2018-11-081-0/+23
| | | | | | | | | | | | | | | | | | | | 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
* | vold: rename from "ext4 encryption" to fscrypt am: a701c458ca am: 10b70834a4Eric Biggers2018-10-291-19/+19
|\| | | | | | | | | | | am: a51283d281 Change-Id: I346bca3f23cfe84d77e5de1e8ef601fb7debf620
| * vold: rename from "ext4 encryption" to fscryptEric Biggers2018-10-251-19/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We support file-based encryption on both ext4 and f2fs now, and the kernel API is the same. So rename things appropriately in vold: e4crypt => fscrypt ext4enc => fscrypt Ext4Crypt => FsCrypt EXT4_* => FS_* ext4_encryption_key => fscrypt_key Additionally, the common functions shared by 'vold' and 'init' are now in libfscrypt rather than ext4_utils. So update vold to link to libfscrypt and include the renamed headers. Note: there's a chance of 'fscrypt' being confused with the dm-crypt based encryption code in vold which is called 'cryptfs'. However, fscrypt is the name used in the kernel for ext4/f2fs/ubifs encryption, and it's preferable to use the same name in userspace. Test: built, booted device with f2fs encryption Change-Id: I2a46a49f30d9c0b73d6f6fe09e4a4904d4138ff6
| * Switch to exceptions for most cp callsDaniel Rosenberg2018-10-161-18/+11
| | | | | | | | | | | | | | | | | | | | | | | | This switches the checkpoint calls that don't need to return a value to return 0 on success, and an error on failure. This will be transalted to exceptions for java binder users. needsCheckpoint and needsRollback still return a boolean value. Test: vdc setCheckpoint 2 then reboot 3 times checking state Bug: 112901762 Change-Id: Idd3b5e6036631562a86d5123f533b86cf3bd6032 Merged-In: Idd3b5e6036631562a86d5123f533b86cf3bd6032
* | Update StorageManagerService handling of packages info.Sudheer Shanka2018-10-251-4/+8
| | | | | | | | | | | | | | | | | | | | | | 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
* | Switch to exceptions for most cp callsDaniel Rosenberg2018-10-161-18/+11
| | | | | | | | | | | | | | | | | | | | | | This switches the checkpoint calls that don't need to return a value to return 0 on success, and an error on failure. This will be transalted to exceptions for java binder users. needsCheckpoint and needsRollback still return a boolean value. Test: vdc setCheckpoint 2 then reboot 3 times checking state Bug: 112901762 Change-Id: Idd3b5e6036631562a86d5123f533b86cf3bd6032
* | Merge "Handle retry count" am: e74587af4d am: e1e3dc3698Daniel Rosenberg2018-10-151-4/+2
|\| | | | | | | | | | | am: c879ec2005 Change-Id: Ib1a614d3e3a964afc36585c9ca323e7a4cf97a39
| * Handle retry countDaniel Rosenberg2018-10-151-4/+2
| | | | | | | | | | | | Test: vdc setCheckpoint 2 then reboot 3 times checking state Bug: 112901762 Change-Id: I85a71d059bca27b76175b9bd8465cc453f0ddb8d
* | Merge "Delete package sandbox data when it is uninstalled."Sudheer Shanka2018-10-101-6/+17
|\ \
| * | Delete package sandbox data when it is uninstalled.Sudheer Shanka2018-10-091-6/+17
| | | | | | | | | | | | | | | | | | Bug: 111890351 Test: manual Change-Id: I989d507f3352959e824b161a94c0eaad6eed9bba
* | | Merge "Add checkpointing support for A/B updates" am: ba1752008d am: 0b875d7630Daniel Rosenberg2018-10-041-0/+8
|\ \ \ | |/ / |/| / | |/ | | | | am: 9e9f7cb820 Change-Id: I76999218377271621d14502f9315739dd1b894a5
| * Add checkpointing support for A/B updatesDaniel Rosenberg2018-10-031-0/+8
| | | | | | | | | | | | | | | | | | | | | | This adds implicit rollback support during A/B style updates. If you explicitly start a checkpoint with -1, needsRollback will trigger if the update fails, and should be used if any additional cleanup is needed that is not covered by A/B itself. Test: All Checkpoint tests pass Bug: 111020314 Change-Id: I88b4a1098c6bac4dc1438a54c8a8f59577a6c17b
* | Merge "Make checkpointing work on ext4" am: ac244261c8 am: 61c3eaf068Paul Lawrence2018-10-031-0/+10
|\| | | | | | | | | | | am: f6c099af3a Change-Id: Ic3703ad2d1d8c1b5b63be338d6725b582374dba6
| * Make checkpointing work on ext4Paul Lawrence2018-10-031-0/+10
| | | | | | | | | | Test: All tests pass Change-Id: I2a6cdf1edfe752f4633e1931e75d18659653938c
| * Add support for checkpointingDaniel Rosenberg2018-09-211-0/+51
| | | | | | | | | | | | | | | | | | | | | | Checkpointing uses a combination of files on the meta partition and the checkpoint= fs_mgr flag. Checkpointed partitions will revert to their starting state on reboot unless checkpoint commit is called. Test: Run vdc commands, check file on metadata Merged-In: Icba16578608a6cbf922472e9d4ae5b8cf5f016c6 Change-Id: Icba16578608a6cbf922472e9d4ae5b8cf5f016c6
| * clang-format the rest of the filesPaul Crowley2018-09-201-93/+98
| | | | | | | | | | | | | | | | | | 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
* | Bind mount pkg specific dirs in the zygote child namespaces.Sudheer Shanka2018-09-271-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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
* | Add support for checkpointingDaniel Rosenberg2018-09-211-0/+51
| | | | | | | | | | | | | | | | | | | | Checkpointing uses a combination of files on the meta partition and the checkpoint= fs_mgr flag. Checkpointed partitions will revert to their starting state on reboot unless checkpoint commit is called. Test: Run vdc commands, check file on metadata Change-Id: Icba16578608a6cbf922472e9d4ae5b8cf5f016c6
* | clang-format the rest of the filesPaul Crowley2018-09-191-125/+136
| | | | | | | | | | | | | | | | 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-0/+25
| | | | | | | | | | | | Bug: 111890351 Test: manual Change-Id: I1b7f5bd25e04f9f4a61d0d4f64bbbb0ca6157fa5
* | VoldNativeService: Minor performance improvementGreg Kaiser2018-08-061-2/+2
| | | | | | | | | | | | | | | | | | string::find() looks in every position of the string for a match. We switch to android::base::StartsWith() so we only look for a match in the first position. Test: TreeHugger Change-Id: Idda1a6b60cab8b4eb4b335921fe0fa38eab724dc
* | Add sanity checks for packageName and sandboxId args in vold.Sudheer Shanka2018-08-031-3/+80
| | | | | | | | | | | | Bug: 111890351 Test: device boots Change-Id: Ic5856bc45963ee1264205db874758396f5425093
* | Update IVold interface to take packageNames when a user starts.Sudheer Shanka2018-08-011-2/+3
| | | | | | | | | | | | | | 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/+19
|/ | | | | | Bug: 111890351 Test: n/a Change-Id: I3194a88a9ce612a2e4f2c7ea9e3392e0f8020fc1
* Remove secdiscard IPC callRubin Xu2018-03-051-8/+0
| | | | | | | | No longer used by the framework, hence removing. Bug: 62140539 Test: builds Change-Id: I17b9818ea6121d84223a502949186cf679a83a90
* Add a mount with metadata encryption servicePaul Crowley2018-02-011-18/+20
| | | | | | | | | Don't use the FDE flow to support metadata encryption; just provide a vold service which directly mounts the volume and use that. Bug: 63927601 Test: Boot Taimen to SUW with and without metadata encryption. Change-Id: Ifc6a012c02c0ea66893020ed1d0da4cba6914aed
* Remove all references to FDE enable wipePaul Lawrence2017-12-221-15/+2
| | | | | | | Bug: 64766105 Test: FBE boots, forceencrypt boots, set pattern, reboots, encryptable boots and can be encrypted Change-Id: I8c6dc0acdc37c3a6f1bea28d5607ed8938a4eb0c
* Delay touching disks when secure keyguard showing.Jeff Sharkey2017-12-151-0/+7
| | | | | | | | | | | | 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
* Add functions to handle idle maintenanceJin Qian2017-11-141-0/+22
| | | | | | | | | | | | | | | | | | runIdleMaint is equivalent with: 1. echo 1 > /sys/fs/f2fs/sdX/gc_urgent 2. wait until /sys/fs/f2fs/sdX/dirty_segments <= threshold or timeout 3. echo 0 > /sys/fs/f2fs/sdX/gc_urgent 4. fstrim abortIdleMaint forces the wait loop above to exit and skips fstrim. However, if fstrim is already running, abortIdleMaint will just leave it run to completion. Test: adb shell sm idle-maint [run|abort] Bug: 67776637 Change-Id: I4adff8d9b6bbd63bce41368cea55dc9e9b117eb6
* Test that plaintext can't be read from disk for encrypted files.Jeff Sharkey2017-10-271-14/+31
| | | | | | Bug: 36029169 Test: tested by hand on Taimen Change-Id: I5717a8630bb2c8d8fe5c343d519c4e59862ecbdf
* Pass both partition GUID and filesystem UUID.Jeff Sharkey2017-10-241-2/+4
| | | | | | | | | | 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