Commit graph

4937 commits

Author SHA1 Message Date
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
Martijn Coenen
717c1926fc Merge "vold: do not acquire lock when abort fuse" 2021-03-19 08:21:00 +00:00
lijiazi
ffe7622d83 vold: do not acquire lock when abort fuse
reboot maybe cause a deadlock scenario:

1:init->vdc->vold for abort_fuse blocked on futex hold by another
vold binder_x

2:binder_x blocked in binder_ioctl_write_read wait a dead service's
response

3:dead service is exiting and schedule a deferred work for put files
in binder_vma_close, after put files is completed, the binder_x will
eventually wake up

4:kworker execute binder_deferred_work is blocked on fuse request:
crash> bt 1707
PID: 1707   TASK: ffffffe366175e80  CPU: 2   COMMAND: "kworker/2:4"
 #0 [ffffff801b8b3ac0] __switch_to at ffffff962ce88a60
 #1 [ffffff801b8b3b10] __schedule at ffffff962e2d3d30
 #2 [ffffff801b8b3b70] schedule at ffffff962e2d3ff4
 #3 [ffffff801b8b3bc0] __fuse_request_send at ffffff962d20e008
 #4 [ffffff801b8b3c00] fuse_request_send at ffffff962d20deac
 #5 [ffffff801b8b3c30] fuse_flush at ffffff962d217fa4
 #6 [ffffff801b8b3c80] filp_close at ffffff962d0bd7b4
 #7 [ffffff801b8b3cb0] put_files_struct at ffffff962d0e7658
 #8 [ffffff801b8b3d30] binder_deferred_func at ffffff962dc9e60c
 #9 [ffffff801b8b3d90] process_one_work at ffffff962cee761c
 #10 [ffffff801b8b3e00] worker_thread at ffffff962cee7a68
 #11 [ffffff801b8b3e60] kthread at ffffff962ceecc14
waiting for init abort_fuse

suggested by maco, do not acquire lock when abort fuse.

Test: reboot stress test

Change-Id: If6dd7f5e9c413a16ba047204c33d82d6ff41c4ae
Signed-off-by: lijiazi <lijiazi@xiaomi.com>
2021-03-17 10:11:18 +00:00
Eric Biggers
36b86e50bd Merge "KeyStorage: improve logging for key generation" into sc-dev 2021-03-16 18:39:40 +00:00
Eric Biggers
edcbdd977e Merge "KeyStorage: improve logging for key generation" am: 759022d0f1 am: 209084f877 am: 514cce99b8
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1638259

Change-Id: If6e766b8699fb2b05de7d33c1c6d3ce569a18b11
2021-03-16 01:55:59 +00:00
Eric Biggers
514cce99b8 Merge "KeyStorage: improve logging for key generation" am: 759022d0f1 am: 209084f877
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1638259

Change-Id: I1982ef32bdf67ccfa655f2f973a70dacbba284d4
2021-03-16 00:56:21 +00:00
Eric Biggers
209084f877 Merge "KeyStorage: improve logging for key generation" am: 759022d0f1
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1638259

Change-Id: I7d44cdbf632751092ed63ca7084b6ce26180a2bc
2021-03-16 00:17:24 +00:00
Eric Biggers
c6d94cf76e KeyStorage: improve logging for key generation
The error messages that are printed when probing for rollback resistance
support on a device that doesn't support rollback-resistant keys can
make it sound like something is going wrong.  Print a WARNING message
afterwards to try to make it clear what is going on.  Also adjust or add
DEBUG messages when starting to generate each key so that it's easier to
distinguish the log messages for different key generation operations.

Bug: 182815123
Test: boot on device that doesn't support rollback-resistant keys and
      check log.
Change-Id: I37a13eb5c1e839fb94581f3e7ec1cd8da0263d2b
Merged-In: I37a13eb5c1e839fb94581f3e7ec1cd8da0263d2b
2021-03-15 16:47:55 -07:00
Eric Biggers
759022d0f1 Merge "KeyStorage: improve logging for key generation" 2021-03-15 23:46:54 +00:00
Eric Biggers
b2024e0349 KeyStorage: improve logging for key generation
The error messages that are printed when probing for rollback resistance
support on a device that doesn't support rollback-resistant keys can
make it sound like something is going wrong.  Print a WARNING message
afterwards to try to make it clear what is going on.  Also adjust or add
DEBUG messages when starting to generate each key so that it's easier to
distinguish the log messages for different key generation operations.

Bug: 182815123
Test: boot on device that doesn't support rollback-resistant keys and
      check log.
Change-Id: I37a13eb5c1e839fb94581f3e7ec1cd8da0263d2b
2021-03-15 12:44:36 -07:00
Ricky Wai
a67a37ddac Merge "Change mounting storage data and obb to on by default" into sc-dev 2021-03-15 14:03:44 +00:00
Treehugger Robot
106a179266 Merge "Avoid killing the FUSE daemon during unmount" am: 05bb5cc71e am: 5e953c70fc am: a02960e5ed
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1614817

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I789eb902ba1a686753d85a6d57efeb5741423ce3
2021-03-05 20:39:30 +00:00
Treehugger Robot
a02960e5ed Merge "Avoid killing the FUSE daemon during unmount" am: 05bb5cc71e am: 5e953c70fc
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1614817

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I769ded970fbf021c241043063e34758bfebada98
2021-03-05 19:57:22 +00:00
Treehugger Robot
5e953c70fc Merge "Avoid killing the FUSE daemon during unmount" am: 05bb5cc71e
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1614817

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I25ce3bb0d699478ac00ca25a72d3b4dd0c63d2c1
2021-03-05 18:47:05 +00:00
Treehugger Robot
05bb5cc71e Merge "Avoid killing the FUSE daemon during unmount" 2021-03-05 18:08:14 +00:00
Zim
75273001a2 Avoid killing the FUSE daemon during unmount
The FUSE daemon is often holding fds on behalf of other apps and if a
volume is ejected the daemon would often get killed first while vold
is walking /proc/<pid>/fd to kill pids with open fds on the
volume. This is required for the volume unmount successfully.

To mitigate this, we avoid killing the FUSE daemon during the usual
/proc walk. This ensures that we first send SIGINT, SIGTERM and
SIGKILL to other apps first. There is an additional SIGKILL attempt
and on that last attempt, we kill the FUSE daemon as a last resort

Test: Manual
Bug: 171673908
Change-Id: I100d2ce4cb4c145cbb49e0696842e97dfba2c1c9
2021-03-05 11:05:16 +00:00
Abhijeet Kaur
371213f4da Merge "Remove unused mount modes and re-number the modes for consistency" am: 2d0ea90538 am: 6111dc99fe am: 7d0b75e407
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1605433

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I83fd80266a5b558b899963554950b20f5bf56e83
2021-03-03 13:32:00 +00:00
Abhijeet Kaur
7d0b75e407 Merge "Remove unused mount modes and re-number the modes for consistency" am: 2d0ea90538 am: 6111dc99fe
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1605433

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ic29cce9e12067fdc7ea4827bb25210af7420cd4e
2021-03-03 13:02:43 +00:00
Abhijeet Kaur
6111dc99fe Merge "Remove unused mount modes and re-number the modes for consistency" am: 2d0ea90538
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1605433

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I958437ce02963f69c3498ef829e9bcbef27dabd4
2021-03-03 11:12:54 +00:00
Abhijeet Kaur
2d0ea90538 Merge "Remove unused mount modes and re-number the modes for consistency" 2021-03-03 10:09:46 +00:00
Treehugger Robot
703bc87889 Merge "Set a default ACL on /data/media/userId." am: f6546171af am: ca3fbd1e4b am: 541c8e03f2
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1603534

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I935e9217d592818c5df46941e2b303134a15f0f7
2021-03-02 20:40:14 +00:00
Treehugger Robot
541c8e03f2 Merge "Set a default ACL on /data/media/userId." am: f6546171af am: ca3fbd1e4b
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1603534

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ib4f7ecc6b6e53fc9f61a4e83027ebb7a86b69b86
2021-03-02 19:47:14 +00:00
Treehugger Robot
ca3fbd1e4b Merge "Set a default ACL on /data/media/userId." am: f6546171af
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1603534

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I13d1ee215c805b25d73e3d39508ea05cdc60b703
2021-03-02 19:03:54 +00:00
Treehugger Robot
f6546171af Merge "Set a default ACL on /data/media/userId." 2021-03-02 09:25:52 +00:00
Treehugger Robot
16d09d3357 Merge "[vold] expose binder headers to dependent modules" am: 51ff06df22 am: b06061cace am: c0bd8a260d
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1607482

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: If7f00620faf15b159537820136df13b3ac628616
2021-02-26 06:07:25 +00:00
Treehugger Robot
c0bd8a260d Merge "[vold] expose binder headers to dependent modules" am: 51ff06df22 am: b06061cace
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1607482

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ie3321467c877bf1518594ea190cc109be9a0e483
2021-02-26 05:24:15 +00:00
Treehugger Robot
b06061cace Merge "[vold] expose binder headers to dependent modules" am: 51ff06df22
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1607482

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I32b3d8d656a07491b644c8fd05aa38b8031597a4
2021-02-26 04:33:56 +00:00