* changes:
Revert "fskeyring & userspace reboot: support CE keys"
Evict adoptable storage CE and DE keys when possible
Don't erase key from s_new_ce_keys on eviction
Call fscrypt_destroy_volume_keys() under mCryptLock
Fold read_and_install_user_ce_key() into fscrypt_unlock_user_key()
Userspace reboot turned out to be a dead end and is no longer supported.
Therefore, remove the code from vold that handled keeping CE storage
unlocked past the userdata filesystem being unmounted and mounted.
This is a revert of commit 1c6731c649 (https://r.android.com/1254615)
with various conflicts resolved.
Bug: 292469129
Change-Id: If530edaf7c1566dd3bd8b1322f935f38a2e66beb
Merged-In: If530edaf7c1566dd3bd8b1322f935f38a2e66beb
(cherry picked from commit 2b97a88ba4)
Adoptable storage CE and DE keys were not being explicitly evicted,
resulting in the benefits of key eviction not being fully realized on
devices that use adoptable storage. Fix this by evicting the adoptable
storage keys when the corresponding internal storage keys are evicted:
- In lockUserKey, evict the CE keys for adoptable storage volumes, not
just the CE key for internal storage as was done before.
- In destroyUserKey, evict the user's CE and DE keys for adoptable
storage, not just the internal storage keys as was done before.
To make this possible, starting keeping track of the EncryptionPolicy of
each currently installed adoptable storage key.
(This CL is reworked from https://r.android.com/2660878,
original author Arnab Sen <arnabse@amazon.com>)
Test: On Cuttlefish with config_multiuserMaxRunningUsers changed to 1:
sm set-virtual-disk true
sm partition disk:7,416 private
pm create-user 10
am start-user 10
am stop-user 10
# Verified that this fails with "Required key not available".
touch /mnt/expand/f1ad173b-d6d9-4948-8eb7-ccdd7b053b22/misc_ce/10/foo.txt
am start-user 10
pm remove-user 10
# Checked for all the expected "Evicted fscrypt key" messages.
# 2 from when user was stopped, and 4 from when user was removed.
adb logcat | grep Evicted
Change-Id: I7f11a135d8550618cd96013f834cebd54be5ef84
Merged-In: I7f11a135d8550618cd96013f834cebd54be5ef84
(cherry picked from commit 68fd3689a1)
Erasing a key from s_new_ce_keys is equivalent to destroying it, so it
shouldn't be done when the key is merely being evicted.
This didn't matter in practice since eviction requests don't come in
before the key gets persisted, but fix this to avoid confusion.
Test: see I7f11a135d8550618cd96013f834cebd54be5ef84
Change-Id: I28412f243925b5a7242449b617fe9de9c90912b6
Merged-In: I28412f243925b5a7242449b617fe9de9c90912b6
(cherry picked from commit 3529302ede)
Everything in FsCrypt.cpp seems to run under VolumeManager::mCryptLock,
except for fscrypt_destroy_volume_keys() which uses mLock instead.
This was sort of okay because fscrypt_destroy_volume_keys() didn't
operate on any in-memory data structures. However, that is going to be
changed. Therefore, rework VoldNativeService::forgetPartition() to call
fscrypt_destroy_volume_keys() under mCryptLock.
Test: see I7f11a135d8550618cd96013f834cebd54be5ef84
Change-Id: Ia27a61faf2fdd546cdbddb2a3985c7c6696f6aa6
Merged-In: Ia27a61faf2fdd546cdbddb2a3985c7c6696f6aa6
(cherry picked from commit ce86e24d23)
No change in behavior, except for removing a redundant check of
's_ce_policies.count(user_id)' and removing an extra ERROR message.
Test: see I7f11a135d8550618cd96013f834cebd54be5ef84
Change-Id: If221e23991e8e04138ae7dbdafe8160b00893655
Merged-In: If221e23991e8e04138ae7dbdafe8160b00893655
(cherry picked from commit 92428b247f)
am skip reason: Merged-In Ic9bc7a7971790fa19a04181b6f89a33a0088bdd8 with SHA-1 efe3c891bd is already in history
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2775038
Change-Id: Ibb6f487a7d66e42001e6d9d1033e2de48745c3f4
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
am skip reason: Merged-In Ic9bc7a7971790fa19a04181b6f89a33a0088bdd8 with SHA-1 efe3c891bd is already in history
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2775038
Change-Id: I4c711ba7124c439599c458755a987a54701f1382
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
am skip reason: Merged-In Ic9bc7a7971790fa19a04181b6f89a33a0088bdd8 with SHA-1 efe3c891bd is already in history
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2775038
Change-Id: I99d21d97b0bd420673104f69208e04d3d6d2effa
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
am skip reason: Merged-In Ic9bc7a7971790fa19a04181b6f89a33a0088bdd8 with SHA-1 efe3c891bd is already in history
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2775038
Change-Id: I5c1e859445bee2b03bf313e2c673898039cefbad
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
am skip reason: Merged-In Ic9bc7a7971790fa19a04181b6f89a33a0088bdd8 with SHA-1 efe3c891bd is already in history
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2775038
Change-Id: I49a77e24d9d8f0e1417fcec64f0d3c5f24a14aab
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
am skip reason: Merged-In Ic9bc7a7971790fa19a04181b6f89a33a0088bdd8 with SHA-1 efe3c891bd is already in history
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2775038
Change-Id: If904a0387645ba8db75f57e6d15b8ef20a499d0e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
am skip reason: Merged-In Ic9bc7a7971790fa19a04181b6f89a33a0088bdd8 with SHA-1 efe3c891bd is already in history
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2775038
Change-Id: I2c8fd7b65a804c02742021fe03f151bf1de29c0b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
am skip reason: Merged-In Ic9bc7a7971790fa19a04181b6f89a33a0088bdd8 with SHA-1 efe3c891bd is already in history
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2775038
Change-Id: I37e11e5e0d4783306319b8ea40dbeb1fe01e8e5e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
Generated corpus using binder2corpus tool from recordings
of vold transactions and using it with vold service fuzzer.
Test: m vold_native_service_fuzzer && adb sync data && adb shell /data/fuzz/arm64/vold_native_service_fuzzer/vold_native_service_fuzzer /data/fuzz/arm64/vold_native_service_fuzzer/vold_native_service_fuzzer_corpus -runs=1000
Bug: b/299138341
Change-Id: Ic9bc7a7971790fa19a04181b6f89a33a0088bdd8