Commit graph

5246 commits

Author SHA1 Message Date
Xin Li
640c6943a8 Merge "DO NOT MERGE - Merge ab/7272582" am: 12e48a85fb am: 35c828e5ae
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1735803

Change-Id: Ia5d30ca70429742ba2f59ced83db5f6ba8d8d75b
2021-06-14 03:32:25 +00:00
Xin Li
a63ab5e7e0 DO NOT MERGE - Merge ab/7272582 am: 1c79e144d5 am: 0bd6aa1328
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1735803

Change-Id: I9501c4abe503d3f6e362949e863f8c619bd85087
2021-06-14 03:32:15 +00:00
Xin Li
35c828e5ae Merge "DO NOT MERGE - Merge ab/7272582" am: 12e48a85fb
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1735803

Change-Id: Iad13ce7ee56cf7d85a896f48d4b5af0c5df29220
2021-06-14 03:14:01 +00:00
Xin Li
0bd6aa1328 DO NOT MERGE - Merge ab/7272582 am: 1c79e144d5
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1735803

Change-Id: I6b77a17874d042c6ec322b7a770149e75340a915
2021-06-14 03:13:51 +00:00
Xin Li
12e48a85fb Merge "DO NOT MERGE - Merge ab/7272582" 2021-06-14 03:02:53 +00:00
Eric Biggers
47525e6f78 cryptfs: log beginning/end of each unmount attempt
Add more log messages to make it easier to understand failures in
wait_and_unmount().

Bug: 189250652
Change-Id: I621f54f30bb01cd52c4f9a74dba2d46b4d1a8a9d
2021-06-11 17:56:27 -07:00
Xin Li
1c79e144d5 DO NOT MERGE - Merge ab/7272582
Bug: 190855093
Change-Id: I6739d9fa0fc483ed6128811f0e03c8178fed821a
2021-06-11 17:34:10 -07:00
Treehugger Robot
dec399d125 Merge changes from topic "rename-key-dir" am: 9891ae7479 am: b84d773488 am: ab5fbb523d
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1730556

Change-Id: I16c64a5b0b64960c86a5479a1575fb2353170e9b
2021-06-09 01:13:37 +00:00
Treehugger Robot
ab5fbb523d Merge changes from topic "rename-key-dir" am: 9891ae7479 am: b84d773488
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1730556

Change-Id: Ifd038592b11c23c74bc21320f2d2963be7711a1d
2021-06-09 00:58:28 +00:00
Treehugger Robot
b84d773488 Merge changes from topic "rename-key-dir" am: 9891ae7479
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1730556

Change-Id: I43149e3979d9b7f1548cd91f50024c9d471096f0
2021-06-09 00:37:10 +00:00
Treehugger Robot
9891ae7479 Merge changes from topic "rename-key-dir"
* changes:
  Don't export storeKey(), and update comments
  Always use RenameKeyDir() when moving/renaming key directories
  Make RenameKeyDir() use IsSameFile()
2021-06-09 00:21:43 +00:00
Satya Tangirala
351a4af716 Don't export storeKey(), and update comments
storeKey() is no longer used outside KeyStorage.cpp, so make it a static
function.  Also fix the documentation for storeKey() (e.g. it's no
longer safe to directly move/rename directories created by storeKey() --
one must use RenameKeyDir() instead).

No functional changes.

[ebiggers@ - cleaned up slightly from satyat@'s original change]

Bug: 190398249
Change-Id: I85918359e77bef414dfddfe5ded30fcde6514013
2021-06-08 15:57:31 -07:00
Satya Tangirala
0f890a93e1 Always use RenameKeyDir() when moving/renaming key directories
Make fixate_user_ce_key() use RenameKeyDir() to rename key directories
so that any deferred commits for these directories are also updated
appropriately.

This fixes a potential lost Keymaster key upgrade if a key were to be
re-wrapped while a user data checkpoint is pending.  This isn't a huge
issue as the key will just get upgraded again, but this should be fixed.

[ebiggers@ - cleaned up slightly from satyat@'s original change]

Bug: 190398249
Change-Id: Ic6c5b4468d07ab335368e3d373916145d096af01
2021-06-08 15:57:31 -07:00
Eric Biggers
107d21d484 Make RenameKeyDir() use IsSameFile()
Comparing paths is error-prone (e.g. "/foo/bar" vs "/foo//bar"), so
entries in key_dirs_to_commit are compared using inode and device
number.  However RenameKeyDir() breaks this rule and compares raw paths.

Avoid this quirk by finding the entry in the list to replace before
doing the rename.

This doesn't fix any known problem, as vold is fairly consistent with
its paths in practice; this is just a robustness improvement.

Bug: 190398249
Change-Id: I3ce2c0119cb2012ac9d12849570e56600bc23867
2021-06-08 15:57:31 -07:00
Treehugger Robot
ee68ee6294 Merge "cryptfs: try harder to unmount subdirectory mounts" am: 827dfe6e75 am: bf28ef63eb am: 3ad9d341e1
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1729173

Change-Id: Ifd615cc8cd24107f3095acf65c3c1048d7361179
2021-06-08 20:46:19 +00:00
Eric Biggers
1d1d8ab82b Merge "Remove /data/misc/vold/user_keys/ce/${user_id} when no longer needed" am: 67db7b9786 am: 7ece899507 am: 883908791b
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1721850

Change-Id: I95bab073b3ae841d147c863af158574155adfe98
2021-06-08 20:44:30 +00:00
Treehugger Robot
3ad9d341e1 Merge "cryptfs: try harder to unmount subdirectory mounts" am: 827dfe6e75 am: bf28ef63eb
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1729173

Change-Id: I69e130850e108e9de59cf782e54cdce075376b19
2021-06-08 20:16:37 +00:00
Eric Biggers
883908791b Merge "Remove /data/misc/vold/user_keys/ce/${user_id} when no longer needed" am: 67db7b9786 am: 7ece899507
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1721850

Change-Id: Id39d7e567dc2484b859efb10a4d3b2cd696172ba
2021-06-08 20:15:47 +00:00
Treehugger Robot
bf28ef63eb Merge "cryptfs: try harder to unmount subdirectory mounts" am: 827dfe6e75
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1729173

Change-Id: Ia4e3e045742d5aa15fb25d20c027911a84872195
2021-06-08 19:59:37 +00:00
Eric Biggers
7ece899507 Merge "Remove /data/misc/vold/user_keys/ce/${user_id} when no longer needed" am: 67db7b9786
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1721850

Change-Id: Ia0ce45874af2fc1b01bf26c56887863d92ade912
2021-06-08 19:59:28 +00:00
Treehugger Robot
827dfe6e75 Merge "cryptfs: try harder to unmount subdirectory mounts" 2021-06-08 19:39:12 +00:00
Eric Biggers
8953430064 cryptfs: try harder to unmount subdirectory mounts
ensure_subdirectory_unmounted() was ignoring the return value from
umount(), so it wasn't possible to tell whether it succeeded or failed.
Make it log an error message on failure.

Also, there might be cases where ensure_subdirectory_unmounted() fails
initially but would succeed later, e.g. due to files in a subdirectory
mount being open and requiring processes to be killed.  To make this
more robust, keep calling ensure_subdirectory_unmounted() before each
attempt of umount("/data").

I'm not sure whether this will actually fix bug 189250652, as it hasn't
been root-caused yet, but this might help.

Bug: 189250652
Change-Id: I979b12d3c6a88fe3335ff548b1f8a5db43683c4f
2021-06-07 12:45:54 -07:00
Eric Biggers
67db7b9786 Merge "Remove /data/misc/vold/user_keys/ce/${user_id} when no longer needed" 2021-06-01 17:07:31 +00:00
Eric Biggers
d863b2cd4a Remove /data/misc/vold/user_keys/ce/${user_id} when no longer needed
When a user is removed, vold is deleting the subdirectories of
/data/misc/vold/user_keys/ce/${user_id} but not that directory itself.
This is unexpected, as none of the user's directories should be left
around.  Delete it too.

Bug: 188702840
Test: pm create-user foo
      pm remove-user 10
      stat /data/misc/vold/user_keys/ce/10 # no longer exists
Change-Id: Id4033a668fa6de1debb9ba6fdd1351c940bd35fc
2021-05-27 17:34:19 -07:00
Wale Ogunwale
c7df297a9d Revert "Change mounting storage data and obb flag to on by default" am: 6cc9a1d3dd
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/vold/+/14536506

Change-Id: I788cc3e244516d066400f489490b3411bad83872
2021-05-14 13:41:44 +00:00
Wale Ogunwale
6cc9a1d3dd Revert "Change mounting storage data and obb flag to on by default"
Revert "Change mounting storage data and obb flag to on by default"

Revert "Remove storage app data isolation checking in CTS"

Revert submission 14325408-enable_storage_iso_2

Reason for revert: b/187939590
Reverted Changes:
I6391b7381:Change mounting storage data and obb flag to on by...
Ic2f3d1be2:Remove storage app data isolation checking in CTS
Iffa8339b1:Change mounting storage data and obb flag to on by...

Bug: 187939590
Bug: 148049767
Change-Id: I8ef3e6fe0210bdf58e1292605ac1cc33a2eaafea
2021-05-14 10:31:12 +00:00
Satya Tangirala
ca14dff337 Merge "Fix bug with deferred commits for key upgrades in temporary directories" am: 54ebfb5806 am: 38c07b96a1 am: a387eda4d4 am: a1837ca9fe
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1706645

Change-Id: Ib58f5ff7a09d6a9c9a1008c05fc7d7df5d736a5b
2021-05-13 23:14:40 +00:00
Satya Tangirala
a1837ca9fe Merge "Fix bug with deferred commits for key upgrades in temporary directories" am: 54ebfb5806 am: 38c07b96a1 am: a387eda4d4
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1706645

Change-Id: I25a94c70abac50c65c1d04215bd58995e73f72ff
2021-05-13 22:58:51 +00:00
Satya Tangirala
a387eda4d4 Merge "Fix bug with deferred commits for key upgrades in temporary directories" am: 54ebfb5806 am: 38c07b96a1
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1706645

Change-Id: If03725290c7a6307255212471d682933360d2d9c
2021-05-13 22:42:09 +00:00
Satya Tangirala
38c07b96a1 Merge "Fix bug with deferred commits for key upgrades in temporary directories" am: 54ebfb5806
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1706645

Change-Id: I441e7684b9e35d168ef034456311e95c01e8b18b
2021-05-13 22:26:53 +00:00
Satya Tangirala
54ebfb5806 Merge "Fix bug with deferred commits for key upgrades in temporary directories" 2021-05-13 21:59:41 +00:00
Satya Tangirala
9475b11a1e Fix bug with deferred commits for key upgrades in temporary directories
storeKeyAtomically() stores keys in a temp directory before renaming
that directory to the real target directory. However when the key is
stored in the temporary directory, the Keymaster storage key might get
upgraded, and it's possible that the temp directory is scheduled for a
deferred commit. storeKeyAtomically() renames that temp directory, but
doesn't update the list of directories marked for deferred commit.

This patch fixes this by removing the temp directory from the list and
adding the real target directory to that list instead.

This bug was found when trying to switch from using the guest keymint to
using the host remote keymint implementation on cuttlefish
(aosp/1701925).  The device triggers this bug (and boots to recovery)
when aosp/1701925 is cherry-picked.

Co-Developed-By: Eric Biggers <ebiggers@google.com>
Test: Cuttlefish boots with and without aosp/1701925
Change-Id: I3b6fd6ad32ed415da94423cca6f5a121c16472f2
2021-05-13 11:21:23 -07:00
Satya Tangirala
ff906f994d Merge changes from topic "vold-keystore2-fixes" am: 98692ab9bb am: 545a13a568 am: 041bbff0bb am: 6c0c4e8f94
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1705226

Change-Id: I7847aee550538de11bd755d2783ecc517e4e2f6d
2021-05-12 23:54:30 +00:00
Satya Tangirala
6c0c4e8f94 Merge changes from topic "vold-keystore2-fixes" am: 98692ab9bb am: 545a13a568 am: 041bbff0bb
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1705226

Change-Id: I160caec0094cf97c65cab0309d50c034016e0204
2021-05-12 23:31:40 +00:00
Satya Tangirala
041bbff0bb Merge changes from topic "vold-keystore2-fixes" am: 98692ab9bb am: 545a13a568
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1705226

Change-Id: I5506a4ed4c7105d6102277b6fb659c3e39312197
2021-05-12 23:07:33 +00:00
Satya Tangirala
545a13a568 Merge changes from topic "vold-keystore2-fixes" am: 98692ab9bb
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1705226

Change-Id: I310d09e283e3d8804ba7154295d9b004e95cda98
2021-05-12 22:52:36 +00:00
Satya Tangirala
98692ab9bb Merge changes from topic "vold-keystore2-fixes"
* changes:
  Remove unused constants and cleanup KeyStorage.cpp
  Remove unused parameter "salt" from stretchSecret()
  Use AServiceManager_waitForService() to connect to keystore2
2021-05-12 22:32:32 +00:00
Satya Tangirala
6b98fb6122 Remove unused constants and cleanup KeyStorage.cpp
Now that the salt and hardware auth token related code has been removed,
we can remove the associated (and now unused) constants.

Also cleanup some comments and remove includes related to hardware auth
token support.

Bug: 181910578
Test: Cuttlefish boots.
Change-Id: I3733d5c6bbf6989adc165c554ee53faa2484f4b6
2021-05-12 13:05:35 -07:00
Satya Tangirala
478cea9783 Remove unused parameter "salt" from stretchSecret()
stretchSecret() no longer uses the "salt" parameter, so remove it and
simplify callers

Bug: 181910578
Test: Cuttlefish boots.
Change-Id: Ic2d0742b22b98a66da37f435e274c9d385b8e188
2021-05-12 13:05:35 -07:00
Satya Tangirala
6ef4e37351 Use AServiceManager_waitForService() to connect to keystore2
Vold currently uses AServiceManager_getService() to connect to
keystore2, which has an internal timeout of 5s. Since a lot of vold
keystore2 connection failures are fatal, we instead use
AServiceManager_waitForService(), which will wait efficiently for
keystore2 to start, instead of timing out after 5s.

Bug: 185934601
Test: Cuttlefish boots.
Change-Id: Ib4e977a997e020082382e0686f448d1aa72834ec
2021-05-11 19:30:30 -07:00
Songchun Fan
38969cfc6c Merge "[vold] pass along sysfs name in setOptions" into sc-dev am: 29a6d6bb46
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/vold/+/14490318

Change-Id: If3c7d07bf8b365eb3f847f65442dbaab5f67c50d
2021-05-11 22:41:16 +00:00
Songchun Fan
29a6d6bb46 Merge "[vold] pass along sysfs name in setOptions" into sc-dev 2021-05-11 22:36:55 +00:00
Treehugger Robot
791faea201 Merge "Show names of processes killed by KillProcessesWithOpenFiles()" am: 93dd933d85 am: 274804863c am: c591e3d68f am: 85a78a5ad1
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1697789

Change-Id: Iaea1920deace15c05a41d06cf3cc195eb32c3a5e
2021-05-11 21:18:05 +00:00
Eric Biggers
7b80629c84 Merge "cryptfs: kill processes more quickly in wait_and_unmount()" am: 297b23837e am: 03e021ba56 am: 9d7718cf05 am: 1e0cdac620
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1702389

Change-Id: I3c73357c29bc6f598bd15b36b3af59f12edaf38e
2021-05-11 21:17:55 +00:00
Treehugger Robot
85a78a5ad1 Merge "Show names of processes killed by KillProcessesWithOpenFiles()" am: 93dd933d85 am: 274804863c am: c591e3d68f
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1697789

Change-Id: I80cf3cf6b9d4e5e7f0ac32b0230cd9b6418cd047
2021-05-11 21:04:06 +00:00
Eric Biggers
1e0cdac620 Merge "cryptfs: kill processes more quickly in wait_and_unmount()" am: 297b23837e am: 03e021ba56 am: 9d7718cf05
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1702389

Change-Id: Ice91b35eda0f09cbb9d4a4e500a1e9984940b0f1
2021-05-11 21:04:02 +00:00
Treehugger Robot
c591e3d68f Merge "Show names of processes killed by KillProcessesWithOpenFiles()" am: 93dd933d85 am: 274804863c
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1697789

Change-Id: I367b674134c4af229a6490c0c03bee93e3d46cdb
2021-05-11 21:02:19 +00:00
Treehugger Robot
274804863c Merge "Show names of processes killed by KillProcessesWithOpenFiles()" am: 93dd933d85
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1697789

Change-Id: Ifc538a3c7cee0df30b727b08333f2e037011656d
2021-05-11 20:39:27 +00:00
Eric Biggers
9d7718cf05 Merge "cryptfs: kill processes more quickly in wait_and_unmount()" am: 297b23837e am: 03e021ba56
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1702389

Change-Id: I56fa2f1b0a434c15e846319774028c435b905671
2021-05-11 20:32:28 +00:00
Treehugger Robot
93dd933d85 Merge "Show names of processes killed by KillProcessesWithOpenFiles()" 2021-05-11 20:24:49 +00:00