Commit graph

4913 commits

Author SHA1 Message Date
Ricky Wai
cebee9c533 Merge "Only kill apps with storage app data isolation enabled" into sc-dev 2021-04-30 13:49:13 +00:00
Ricky Wai
a58b535495 Only kill apps with storage app data isolation enabled
Originally it kills all the apps with obb and data mounted.
Due to recent changes, all apps will have obb and data dirs mounted
in default root namespace. Hence all apps will be killed by
by KillProcessesWithMounts().

To fix this, we also check if the dir is mounted as tmpfs,
as the default namespace one is bind mounted to lowerfs,
which app data isolation is mounted as tmpfs, so we only
kill the process that have obb dir mounted as tmpfs.

Bug: 148049767
Test: Able to boot without warnings / errors
Ignore-AOSP-First: Merge it along with other CLs, will cherry-pick to
AOSP afterwards.

Change-Id: I45d9a63ed47cbc27aebb63357a43f51ad62275db
2021-04-30 10:06:32 +01:00
Ricky Wai
4ae2c65f8d Change mounting storage data and obb flag to on by default
Change mounting storage data and obb flag to on by default

Test: unbundled/launcher/nexus_unit_test_multi_device_platform
Test: atest android.appsecurity.cts.ExternalStorageHostTest
Test: atest AdoptableHostTest
Test: pass cts/cts_postsubmit_cf_stable-cloud-tf

Bug: 148049767
Ignore-AOSP-First: Merge it along with other CLs, will cherry-pick to
AOSP afterwards.

Change-Id: I6391b7381699b4ffdbf715b67938bc3f79a5210c
2021-04-29 15:59:13 +00:00
Songchun Fan
046e68abd6 [vold] pass sysfs_name to mount options
Ignore-AOSP-First: Will cherry-pick to AOSP

Test: manual
BUG: 184844615
Change-Id: I216210132f49f55098c0f2d1b8d4e571b22cfcc4
2021-04-29 08:35:43 -07:00
Treehugger Robot
ee2f2e081d Merge "Fix cryptfs RSA signing with keystore2" am: d2bb367549 am: 97455f85b0 am: f04542fcac
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1684055

Change-Id: I0762df0881f194acd1d1a13dc1eae54647ac02f6
2021-04-26 20:27:50 +00:00
Treehugger Robot
f04542fcac Merge "Fix cryptfs RSA signing with keystore2" am: d2bb367549 am: 97455f85b0
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1684055

Change-Id: Ia25afd08bb0a0400d24343f37aeea4246f3ec1e8
2021-04-26 19:50:00 +00:00
Treehugger Robot
97455f85b0 Merge "Fix cryptfs RSA signing with keystore2" am: d2bb367549
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1684055

Change-Id: Ib91a29bf3d216c09ece619b9554c8f391efbe5fd
2021-04-26 19:13:28 +00:00
Treehugger Robot
d2bb367549 Merge "Fix cryptfs RSA signing with keystore2" 2021-04-26 18:51:13 +00:00
Hasini Gunasinghe
33f9b160a2 Merge "Make vold use the updated keystore 2 API for storage keys." am: 68bdb45cf8 am: 0e9eb8ebca am: d14ab5c35c
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1681547

Change-Id: I26878bfc82857c05539c1a2705ddcb3fad0c3fb4
2021-04-23 23:48:18 +00:00
Hasini Gunasinghe
d14ab5c35c Merge "Make vold use the updated keystore 2 API for storage keys." am: 68bdb45cf8 am: 0e9eb8ebca
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1681547

Change-Id: I8ee13ffd60784cee2ffbe8ff640b30a0f7716f5f
2021-04-23 23:25:35 +00:00
Hasini Gunasinghe
0e9eb8ebca Merge "Make vold use the updated keystore 2 API for storage keys." am: 68bdb45cf8
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1681547

Change-Id: Ib4156e85984c903cf521977e39522d013daf140c
2021-04-23 23:03:46 +00:00
Hasini Gunasinghe
68bdb45cf8 Merge "Make vold use the updated keystore 2 API for storage keys." 2021-04-23 22:39:04 +00:00
Eric Biggers
940c0e5f6e Fix cryptfs RSA signing with keystore2
Fix KeymasterOperation::updateCompletely() to not treat an empty output
as an error, since for RSA signing (used by cryptfs / FDE) it is
expected that the output from update() be empty.  The output is instead
produced at the end by finish().

This is one of a set of changes that is needed to get FDE working again
so that devices that launched with FDE can be upgraded to Android 12.

Bug: 186165644
Change-Id: Icf120f8b9526d051d0ebe16bc8ad1edf712241e1
2021-04-23 10:44:41 -07:00
Jaegeuk Kim
5b6c40e3c0 Merge "mkfs_f2fs: give the log in kernel" am: 177b9db866 am: b79f93bea9 am: 52b6cc4a8a
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1677035

Change-Id: Idc20fc59694a4fefb0118c9e18c948e3af8cd8fe
2021-04-20 23:20:48 +00:00
Jaegeuk Kim
52b6cc4a8a Merge "mkfs_f2fs: give the log in kernel" am: 177b9db866 am: b79f93bea9
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1677035

Change-Id: I10b8cf99a771b28e66a2c9a391b7c9d00281d492
2021-04-20 22:54:45 +00:00
Jaegeuk Kim
b79f93bea9 Merge "mkfs_f2fs: give the log in kernel" am: 177b9db866
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1677035

Change-Id: I55cce35d98afdf058854746e90c42be6c4f7d52c
2021-04-20 22:26:22 +00:00
Jaegeuk Kim
177b9db866 Merge "mkfs_f2fs: give the log in kernel" 2021-04-20 22:08:26 +00:00
Janis Danisevskis
3915b08f80 Make vold use the updated keystore 2 API for storage keys.
This CL updates vold to use the updated storage key API that provides an
optional upgraded key blob. In this patch the upgraded key blob is not
yet stored by vold.

Bug: 185811713
Test: N/A
Change-Id: I39eeb20df0eb2b023479f3adebab264d29d00048
2021-04-20 12:53:12 -07:00
Jaegeuk Kim
2c1380f1ab mkfs_f2fs: give the log in kernel
It's very useful to see the mkfs log in console to debug any issues.

Bug: 172378121
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
Change-Id: Icdac3609860cf0bba3fa758cead885bd4960f2c0
2021-04-15 20:24:04 -07:00
Treehugger Robot
73eda071ef Merge "vold: add getUnlockedUsers() method to Binder interface" am: 5e5819a761 am: ffcb495f2c am: b22fa25e7b
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1674805

Change-Id: I46101eff7eaa690af8c3dc53442ba05d9a30bb8b
2021-04-15 04:42:14 +00:00
Treehugger Robot
b22fa25e7b Merge "vold: add getUnlockedUsers() method to Binder interface" am: 5e5819a761 am: ffcb495f2c
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1674805

Change-Id: I6a28604fbf87bc8e299596eaed5261f2925676dd
2021-04-15 03:52:14 +00:00
Treehugger Robot
ffcb495f2c Merge "vold: add getUnlockedUsers() method to Binder interface" am: 5e5819a761
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1674805

Change-Id: I6b491e5939d3c878351bdfed3452e95ca8f19a89
2021-04-15 03:06:01 +00:00
Treehugger Robot
5e5819a761 Merge "vold: add getUnlockedUsers() method to Binder interface" 2021-04-15 02:33:22 +00:00
Eric Biggers
18ba15223c vold: add getUnlockedUsers() method to Binder interface
This is needed so that system_server can remind itself about which users
have their storage unlocked, if system_server is restarted due to a
userspace reboot (soft restart).

Bug: 146206679
Test: see I482ed8017f7bbc8f7d4fd5a2c0f58629317ce4ed
Change-Id: I02f0494d827094bd41bcfe5f63c24e204b728595
(cherry picked from commit 1799debfd6)
2021-04-13 10:53:00 -07:00
Eric Biggers
23d93638c5 Merge "vold: add getUnlockedUsers() method to Binder interface" into sc-dev 2021-04-13 17:52:02 +00:00
Eric Biggers
1799debfd6 vold: add getUnlockedUsers() method to Binder interface
This is needed so that system_server can remind itself about which users
have their storage unlocked, if system_server is restarted due to a
userspace reboot (soft restart).

Bug: 146206679
Test: see I482ed8017f7bbc8f7d4fd5a2c0f58629317ce4ed
Change-Id: I02f0494d827094bd41bcfe5f63c24e204b728595
2021-04-08 12:29:57 -07:00
Alex Buynytskyy
dcfeaa1d76 Adding an option to shorten the read timeout.
E.g. during installation to protect the system.

Ignore-AOSP-First: this depends on changes to framework and/or incfs and does not make sense without them. We'll merge it at a single large scale merge later.

Bug: 160635296
Test: atest PackageManagerShellCommandTest PackageManagerShellCommandIncrementalTest IncrementalServiceTest PackageManagerServiceTest ChecksumsTest

Change-Id: I5851e1e9dbc8e8c2b331c407002cf7133bf6e35a
2021-04-08 09:58:15 +00:00
Satya Tangirala
6a88ae1891 Merge changes from topic "vold-use-keystore2" am: 08873d0d7d am: 54460f0635 am: 10912a295f
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1649730

Change-Id: I3f8ea815c5c3de2678c11815ddaf41776d470552
2021-04-08 02:21:37 +00:00
Satya Tangirala
bcf02854e1 Make vold use keystore2 instead of keymaster am: e8de4ffd73 am: 7a8ac746a2 am: b79360f80c
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1640885

Change-Id: I7445d17137f563c5cb3f6d8e62f4bb92da2c2fa1
2021-04-08 02:21:36 +00:00
Satya Tangirala
dbbe0363bb Remove HardwareAuthToken support from vold::Keymaster am: e13617100d am: 695fadddf3 am: 57e480b3d5
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1640884

Change-Id: Ia1d707a541b18d29ad9643294f6868d48422fa78
2021-04-08 02:21:34 +00:00
Satya Tangirala
10912a295f Merge changes from topic "vold-use-keystore2" am: 08873d0d7d am: 54460f0635
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1649730

Change-Id: I8a70c04881275aa5e3bf4cf629316870798df27a
2021-04-08 01:36:42 +00:00
Satya Tangirala
b79360f80c Make vold use keystore2 instead of keymaster am: e8de4ffd73 am: 7a8ac746a2
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1640885

Change-Id: I7a45fdb9ed25c5543d0a9dda80106241f90e53db
2021-04-08 01:36:41 +00:00
Satya Tangirala
57e480b3d5 Remove HardwareAuthToken support from vold::Keymaster am: e13617100d am: 695fadddf3
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1640884

Change-Id: I84747f3ea29f6b78f8f1a9bb11959a46ec8c3189
2021-04-08 01:36:40 +00:00
Satya Tangirala
54460f0635 Merge changes from topic "vold-use-keystore2" am: 08873d0d7d
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1649730

Change-Id: Ie7db671fc7e90fa86cf84773786ea6afaab37a7f
2021-04-08 00:52:41 +00:00
Satya Tangirala
7a8ac746a2 Make vold use keystore2 instead of keymaster am: e8de4ffd73
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1640885

Change-Id: I0a9b288902f5bb0f27d524dcf509ce461e4495fe
2021-04-08 00:52:40 +00:00
Satya Tangirala
695fadddf3 Remove HardwareAuthToken support from vold::Keymaster am: e13617100d
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1640884

Change-Id: Id8528a10d976e94e8bdb4e308d91107b1afdced6
2021-04-08 00:52:35 +00:00
Satya Tangirala
08873d0d7d Merge changes from topic "vold-use-keystore2"
* changes:
  Remove Keymaster::isSecure() and simplify callers
  Make vold use keystore2 instead of keymaster
  Remove HardwareAuthToken support from vold::Keymaster
2021-04-08 00:48:19 +00:00
Satya Tangirala
23452c1e3a Remove Keymaster::isSecure() and simplify callers
Now that isSecure() always returns true, we can remove it and simplify
all the callers (i.e. cryptfs). Refer to the commit description for
Iaebfef082eca0da8a305043fafb6d85e5de14cf8 for why this function always
return true.

Bug: 181910578
Test: Cuttlefish and bramble boot
Change-Id: I185dd8180bd7842b05295263f0b1aa7205329a88
2021-04-08 00:47:54 +00:00
Satya Tangirala
e8de4ffd73 Make vold use keystore2 instead of keymaster
Make vold use keystore2 for all its operations instead of directly using
keymaster. This way, we won't have any clients that bypass keystore2,
and we'll no longer need to reserve a keymaster operation for vold.

Note that we now hardcode "SecurityLevel::TRUSTED_ENVIRONMENT" (TEE)
when talking to Keystore2 since Keystore2 only allows TEE and STRONGBOX.
Keystore2 presents any SOFTWARE implementation as a TEE to callers when
no "real" TEE is present. As far as storage encryption is concerned,
there's no advantage to using a STRONGBOX when a "real" TEE is present,
and a STRONGBOX can't be present if a "real" TEE isn't, so asking
Keystore2 for a TEE is the best we can do in any situation.

The difference in behaviour only really affects the full disk encryption
code in cryptfs.cpp, which used to explicitly check that the keymaster
device is a "real" TEE (as opposed to a SOFTWARE implementation) before
using it (it can no longer do so since Keystore2 doesn't provide a way
to do this).

A little code history digging (7c49ab0a0b in particular) shows that
cryptfs.cpp cared about two things when using a keymaster.
 - 1) that the keys generated by the keymaster were "standalone" keys -
      i.e. that the keymaster could operate on those keys without
      requiring /data or any other service to be available.
 - 2) that the keymaster was a non-SOFTWARE implementation so that things
      would still work in case a "real" TEE keymaster was ever somehow
      added to the device after first boot.

Today, all "real" TEE keymasters always generate "standalone" keys, and
a TEE has been required in Android devices since at least Android N. The
only two exceptions are Goldfish and ARC++, which have SOFTWARE
keymasters, but both those keymasters also generate "standalone" keys.

We're also no longer worried about possibly adding a "real" TEE KM to
either of those devices after first boot. So there's no longer a reason
cryptfs.cpp can't use the SOFTWARE keymaster on those devices.

There's also already an upgrade path in place (see
test_mount_encrypted_fs() in cryptfs.cpp) to upgrade the kdf that's
being used once a TEE keymaster is added to the device. So it's safe for
cryptfs.cpp to ask for a TEE keymaster from Keystore2 and use it
blindly, without checking whether or not it's a "real" TEE, which is why
Keymaster::isSecure() just returns true now. A future patch will remove
that function and simplify its callers.

Bug: 181910578
Test: cuttlefish and bramble boot. Adding, switching between, stopping
      and removing users work.
Change-Id: Iaebfef082eca0da8a305043fafb6d85e5de14cf8
2021-04-08 00:16:01 +00:00
Satya Tangirala
e13617100d Remove HardwareAuthToken support from vold::Keymaster
HardwareAuthTokens are no longer used by vold since Android P. So remove
the auth token parameter from vold. This patch doesn't remove the token
from IVold.aidl, and the methods in VoldNativeService.cpp return an
error if a non-empty auth token is passed to them.

Bug: 181910578
Test: cuttlefish and bramble boot with patch
Change-Id: I1a9f54e10f9efdda9973906afd0a5de5a699ada5
2021-04-07 02:05:35 -07:00
Alan Stokes
186143cb40 Merge "Vold will always bind mount obb and data dirs to lowerfs" am: 159a11f600 am: fab8b2835b am: 00a48a7a99
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1647187

Change-Id: I4e22134f7590e94e619361b7d7814b6b4b0585f8
2021-03-23 19:14:47 +00:00
Alan Stokes
00a48a7a99 Merge "Vold will always bind mount obb and data dirs to lowerfs" am: 159a11f600 am: fab8b2835b
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1647187

Change-Id: I1cba8f70b47d325e7dd8ae005bff12db7a8f3b3f
2021-03-23 18:52:12 +00:00
Alan Stokes
fab8b2835b Merge "Vold will always bind mount obb and data dirs to lowerfs" am: 159a11f600
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1647187

Change-Id: I23b628c92b76f84511f0c8fc87b7b8aa52eb20a6
2021-03-23 18:12:19 +00:00
Alan Stokes
159a11f600 Merge "Vold will always bind mount obb and data dirs to lowerfs" 2021-03-23 17:25:18 +00:00
Ricky Wai
259a49ae15 Vold will always bind mount obb and data dirs to lowerfs
So shell / root will always access to them directly not via fuse.
And zygote will be unmount these directories to prevent them being
abused for leaking app visibility.

Also, /mnt/androidwritable is not very useful now as it's the same as
/mnt/installer, but we should make shell / root to access /mnt/androidwritable
later and /mnt/installer should only access obb but not data dir.

Bug: 182997439
Test: Able to boot without errors
Test: df on /sdcard/Android/data shows it's no on fuse.
Change-Id: I2ad10b1e80c135f637d37ddf502ee010f89f4946
2021-03-22 16:12:50 +00:00
Ricky Wai
36c6e252a1 Merge "Revert "Change mounting storage data and obb to on by default"" into sc-dev 2021-03-19 16:03:55 +00:00
Ricky Wai
cc3b59f5aa Revert "Change mounting storage data and obb to on by default"
Revert "Change mounting storage data and obb to on by default"

Revert submission 13469849-turn_on_iso-sc-dev

Reason for revert: Failing existing CTS b/182843583
Reverted Changes:
If819ee161:Change mounting storage data and obb to on by defa...
I46a095448:Change mounting storage data and obb to on by defa...

Change-Id: Ic5156df1cac3a5ecd661b5f3bfa0095b2b767d5d
2021-03-19 14:21:46 +00:00
Martijn Coenen
bca322d931 Merge "vold: do not acquire lock when abort fuse" am: 717c1926fc am: d616d6e1ba am: c678a95db2
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1639945

Change-Id: I7c52c6ce39a37ce8fbc719fd8f242d2106e344bf
2021-03-19 09:44:14 +00:00
Martijn Coenen
c678a95db2 Merge "vold: do not acquire lock when abort fuse" am: 717c1926fc am: d616d6e1ba
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1639945

Change-Id: Id114cc272baabc99d6d9985761f7cec578dcd896
2021-03-19 09:01:27 +00:00
Martijn Coenen
d616d6e1ba Merge "vold: do not acquire lock when abort fuse" am: 717c1926fc
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1639945

Change-Id: I137677f0625e3d46cc8d5a50aa3327e274676589
2021-03-19 08:42:45 +00:00