Commit graph

3735 commits

Author SHA1 Message Date
Automerger Merge Worker
17d85205bd Merge "Make CTS not HEH the default post Q" am: 39969f0288
Change-Id: I0cb0430214ab69656c6e7f3116194b63eb54672b
2020-02-19 23:20:59 +00:00
Treehugger Robot
39969f0288 Merge "Make CTS not HEH the default post Q" 2020-02-19 23:04:37 +00:00
Automerger Merge Worker
970ea1cf68 Merge "Fix unaligned access to auth token user_id" am: 21a17b091e am: 01759662fd am: 7b9b164946
Change-Id: Ibe10561445571d7607ea93d7a988a9ab847e234a
2020-02-19 22:20:32 +00:00
Automerger Merge Worker
c45705672c Merge "Remove unused code in VoldUtil.h" am: e19189bd7f am: b6421644ec am: 923309aae2
Change-Id: I0ec249df609cbad7f80ac739545c6cf0199e6232
2020-02-19 22:19:46 +00:00
Automerger Merge Worker
7489ab6961 Merge changes from topics "metadata_wrapped_key_aosp", "volume_metadata" am: 36fd1ebfae am: 6891eb7e2d am: c14f46d114
Change-Id: I89f51bfaeb61c235aeccbe8a5a5a447ab14c46cb
2020-02-19 22:19:26 +00:00
Ricky Wai
879b9c0a59 Merge "Mount direct boot apps obb dir after fuse is ready." 2020-02-19 19:42:13 +00:00
Paul Crowley
eb241a1d65 Make CTS not HEH the default post Q
Making HEH the default was always a mistake and a giant foot-gun.
Let's make life easier for people by making the default depend on
first_api_level, so it's automatically set up right for new devices
without breaking old ones. Also use v2 fscrypt keys instead of v1 post
Q.

Bug: 147107322
Test: Various Cuttlefish configurations
Change-Id: I5432bdfd6fec6ed34e7f9ab7cdd32cdeb2a03472
2020-02-19 10:27:48 -08:00
Ricky Wai
07e64a4cea Mount direct boot apps obb dir after fuse is ready.
- Remove bind mounting Android/ code as we want to bind mount obb dir
for each process instead.
- Set property "vold.vold.fuse_running_users" as an array of user id
for which fuse is ready to use.
- After fuse is ready for a user, fork a background process in vold
to bind mount all direct boot apps for that user so its direct boot
apps obb dir will be mounted to lower fs for imporoved performance.

Bug: 148049767
Bug: 137890172
Test: After flag is enabled, AdoptableHostTest still pass.
Change-Id: I90079fbeed1c91f9780ca71e37b0012884680b7c
2020-02-19 16:45:07 +00:00
Martijn Coenen
816f4d94f6 Add fixupAppDir() API.
This can be used to fixup application directories in case they have been
created by some other entity besides vold; the main use case for this
API right now is OBB directories, which can be created by installers
outside of vold; on devices without sdcardfs, such directories and the
files contained therein are not setup correctly. This API will make sure
everything is setup the way it needs to be setup.

Bug: 146419093
Test: inspect OBB dir after install
Change-Id: I2e35b7ac2992dbb21cc950e53651ffc07cfca907
2020-02-19 12:11:34 +01:00
Automerger Merge Worker
7b9b164946 Merge "Fix unaligned access to auth token user_id" am: 21a17b091e am: 01759662fd
Change-Id: I224885ade242636a9806574c164f34494a8f377f
2020-02-19 00:06:04 +00:00
Automerger Merge Worker
923309aae2 Merge "Remove unused code in VoldUtil.h" am: e19189bd7f am: b6421644ec
Change-Id: If68c55c8e6f3db5e00e08f958845ceab8cf36f4e
2020-02-19 00:05:34 +00:00
Automerger Merge Worker
c14f46d114 Merge changes from topics "metadata_wrapped_key_aosp", "volume_metadata" am: 36fd1ebfae am: 6891eb7e2d
Change-Id: I39904b704f983124afd8ff62cd3b863fd600e6a2
2020-02-19 00:05:22 +00:00
Automerger Merge Worker
01759662fd Merge "Fix unaligned access to auth token user_id" am: 21a17b091e
Change-Id: If1b44823f6758c9428b5874b2629579f384399b7
2020-02-18 23:40:09 +00:00
Automerger Merge Worker
b6421644ec Merge "Remove unused code in VoldUtil.h" am: e19189bd7f
Change-Id: I52b8e04f85890a1a320c47a191bf1c0429e058a4
2020-02-18 23:40:04 +00:00
Automerger Merge Worker
6891eb7e2d Merge changes from topics "metadata_wrapped_key_aosp", "volume_metadata" am: 36fd1ebfae
Change-Id: Ieb478426e40feffcefd3a5e478e5e1c5d72539b7
2020-02-18 23:39:37 +00:00
Paul Crowley
21a17b091e Merge "Fix unaligned access to auth token user_id" 2020-02-18 23:18:46 +00:00
Paul Crowley
e19189bd7f Merge "Remove unused code in VoldUtil.h" 2020-02-18 23:18:30 +00:00
Paul Crowley
36fd1ebfae Merge changes from topics "metadata_wrapped_key_aosp", "volume_metadata"
* changes:
  On newer devices, use dm-default-key to encrypt SD cards
  vold: Wrapped key support for metadata encryption
  Refactor: make makeGen local
2020-02-18 23:17:07 +00:00
Paul Crowley
886e572009 On newer devices, use dm-default-key to encrypt SD cards
The dm-crypt solution requires a kernel patch that won't be present in
the GKI kernel, while the new metadata encryption system in the GKI
kernel solves this problem in a much cleaner way.

Test: create private volume on Cuttlefish, setting property both ways.
Bug: 147814592
Change-Id: Ie02bd647c38d8101af2bbc47637f65845d312cea
2020-02-18 13:01:00 -08:00
Barani Muthukumaran
312b7df621 vold: Wrapped key support for metadata encryption
metadata_encryption fstab option provides details on the cipher
and flags used for metadata encryption. wrappedkey_v0 is provided
to dm-default-key dm device when a wrapped key is used. The
inline encryption hardware unwraps the key and derives the
encryption key used to encrypt metadata without returning the key
in the clear to software.

Bug: 147733587
Test: FBE with metadata encryption using wrapped keys.
Change-Id: Ibf69bdc12bb18d2f0aef8208e65f3a8dececfd2a
2020-02-18 12:51:06 -08:00
Paul Crowley
249c2fb4aa Refactor: make makeGen local
No need for KeyUtil to know how to make a KeyGeneration, it's cleaner
if each module handles it separately. Also, create a CryptoOptions
structure to track metadata encryption options, and simplify legacy
cipher/option handling.

Test: Treehugger
Bug: 147814592
Change-Id: I740063882914097329ff72348d0c0855c26c7aab
2020-02-18 12:49:36 -08:00
Paul Crowley
d281de75ad Fix unaligned access to auth token user_id
Bug: 65232288
Test: Set a pattern on cuttlefish, ensure we can unlock
Change-Id: I5ee09cf72ab7d3d636a25755134bfad6f88265f9
2020-02-18 11:00:15 -08:00
Paul Crowley
2ae96731ac Remove unused code in VoldUtil.h
Test: Treehugger
Change-Id: I87585852af49ee49d63e3b1cde579114f855118b
2020-02-18 10:48:16 -08:00
Martijn Coenen
442bb83828 Set a default ACL on the top-level OBB directory.
Since installers can create directories in Android/obb, make sure those
directories end up with the correct ACL bits as well.

Bug: 146419093
Test: inspect filesystem manually
Change-Id: I211e921197560a40599938463f3171a0ff92d9aa
2020-02-18 15:24:26 +01:00
Martijn Coenen
10570c00db Add sticky dir bit to Android/ dirs.
We want subdirectories of Android/data, Android/obb etc. to
automatically maintain their group-id.

Bug: 146419093
Test: manual inspection of /sdcard/Android
Change-Id: I36883febb01aa155dfafb0e86f8b99223cde9815
2020-02-18 15:24:26 +01:00
TreeHugger Robot
eab67ccac9 Merge "Retry deleting dm devices." 2020-02-18 13:59:56 +00:00
Ricky Wai
e50ddb786a Fix vold cannot create obb directory
Test: setupAppDir works now
Change-Id: I4bc67ecb57c30b1d0728580abc738e91f97de722
2020-02-18 11:42:32 +00:00
Paul Crowley
e3f78f4843 resolve merge conflicts of bdd9fbf9db to master
Bug: None
Test: Treehugger
Change-Id: I17a300687bc7f56feb79b820b7196b2a9124c5f4
2020-02-16 07:37:18 -08:00
Paul Crowley
bdd9fbf9db Merge "Refactor key generation to handle both normal and metadata encryption." am: 8e0780cba2 am: 79b853551d
Change-Id: I644d55df9c5a5441ead5b6790efff159b292c957
2020-02-15 02:13:22 +00:00
Paul Crowley
79b853551d Merge "Refactor key generation to handle both normal and metadata encryption." am: 8e0780cba2
Change-Id: I59510b64f6803f5e76fefa359abfcc9207420126
2020-02-15 02:03:19 +00:00
Paul Crowley
8e0780cba2 Merge "Refactor key generation to handle both normal and metadata encryption." 2020-02-15 01:40:26 +00:00
Ricky Wai
9eb4367165 Retry deleting dm devices.
For some reason this can be racy; until we understand the root cause,
retry to unblock AdoptableHostTest.

Bug: 149396179
Test: atest AdoptableHostTest no longer hangs
Change-Id: I162ff8ad305535e7a4fab3d88f38b687b50cf4a3
2020-02-15 01:15:42 +00:00
Paul Crowley
4eac264727 Refactor key generation to handle both normal and metadata encryption.
Bug: 147733587
Test: Treehugger
Change-Id: Iee176037dec2621c84da325c2627f988fcebbc8d
Merged-In: Iee176037dec2621c84da325c2627f988fcebbc8d
2020-02-14 13:59:06 -08:00
Paul Crowley
b3d018a62c Refactor key generation to handle both normal and metadata encryption.
Bug: 147733587
Test: Treehugger
Change-Id: Iee176037dec2621c84da325c2627f988fcebbc8d
2020-02-14 13:39:19 -08:00
Paul Crowley
96cbfe4cab Merge "Refactor MetadataCrypt.cpp to make create_crypto_blk_dev more general" am: 7566e467ab am: b272b21a0a am: 41bac014cf
Change-Id: Id9e2e9b5b9f720635218d16b2d5a65780dea1974
2020-02-14 21:35:09 +00:00
Paul Crowley
41bac014cf Merge "Refactor MetadataCrypt.cpp to make create_crypto_blk_dev more general" am: 7566e467ab am: b272b21a0a
Change-Id: I6afc145de2a06a5d3bb9af516fa20cdeeb4f2c56
2020-02-14 21:19:41 +00:00
Paul Crowley
b272b21a0a Merge "Refactor MetadataCrypt.cpp to make create_crypto_blk_dev more general" am: 7566e467ab
Change-Id: Ib59c92bf516a171bfebc7c11be92502b37acf375
2020-02-14 21:07:09 +00:00
Paul Crowley
7566e467ab Merge "Refactor MetadataCrypt.cpp to make create_crypto_blk_dev more general" 2020-02-14 20:48:35 +00:00
Paul Crowley
85d1c77ff6 Merge changes Ic3993c1f,I06645bb4 am: ac34e9aa3e am: b62afed286 am: 54d05de798
Change-Id: Ib122e011bb7be162b76b94a31885863d2aff6d1e
2020-02-14 18:57:33 +00:00
Paul Crowley
54d05de798 Merge changes Ic3993c1f,I06645bb4 am: ac34e9aa3e am: b62afed286
Change-Id: Id009631e1622d1534674332a1f146934fb4841a5
2020-02-14 18:45:55 +00:00
Paul Crowley
b62afed286 Merge changes Ic3993c1f,I06645bb4 am: ac34e9aa3e
Change-Id: I4e11f42f1f302f8a08f60756cf08356aac8652cd
2020-02-14 18:25:49 +00:00
Paul Crowley
ac34e9aa3e Merge changes Ic3993c1f,I06645bb4
* changes:
  Generalize CryptoType infrastructure
  Refactor CryptoType to use better names, and size_t not uint32_t
2020-02-14 18:17:56 +00:00
Martijn Coenen
8b31810922 Merge "Stop using a regex for setupAppDir." 2020-02-14 11:44:13 +00:00
Paul Crowley
572c024853 Refactor MetadataCrypt.cpp to make create_crypto_blk_dev more general
Bug: 147814592
Test: Treehugger
Change-Id: I13c6f84d729f2953f78626493d6e6d34d578a013
2020-02-14 01:15:35 -08:00
Paul Crowley
220567c33a Generalize CryptoType infrastructure
More consistency between MetadataCrypt and cryptfs, and steps towards
supporting Adiantum properly in MetadataCrypt.

Test: create private volume on Cuttlefish
Bug: 147814592
Change-Id: Ic3993c1fde11b4f5a9e6cc8ee588a7d92241c6ab
2020-02-14 00:48:27 -08:00
Risan
73a7a85c85 Passed kUsb and kSd flags
Initially, we were thinking to pass kInternal for non usb drive/sd card
drive (for local external storage like directory shared from ChromeOS).
Fortunately, the DocumentsUI logic apparently has TYPE_LOCAL with
R.drawable.ic_root_smartphone (that is overlayable) for external storage
other than TYPE_USB and TYPE_SD.

Therefore, instead of creating a kInternal flags, we can just passed kUsb
and kSd and not passing anything for "internal external storage" - which
will render ic_root_usb, ic_root_sd, and ic_root_smartphone as icons
accordingly. And since ic_root_smartphone is already overlayable,  we
could overlayed in /vendor - which effectively is what we initially
wanted when thinking of introducing kInternal flag.

Bug: 132796154
Test: Customize flags in /vendor for different devices and DocumentsUI
shows the ic_root_smartphone (which can be overlayed) when kUsb is not
passed, and USB icon when kUsb is passed.
Change-Id: I55f13e214bbb2aeed96b6950bcf391121174c354
2020-02-14 04:38:59 +00:00
TreeHugger Robot
dd85fe2e5e Merge "Add disk for StubVolume" 2020-02-14 04:35:15 +00:00
Paul Crowley
a661fb659b Refactor CryptoType to use better names, and size_t not uint32_t
Test: treehugger
Bug: 147814592
Change-Id: I06645bb4941794797beebf05b817c4ac52e09cd7
2020-02-13 16:40:25 -08:00
Martijn Coenen
b5a31c9985 Stop using a regex for setupAppDir.
This was hard to read and understand. Instead, fall back to explicit
string operations with more comments on what we're doing and what we're
allowing.

This also fixes an issue where apps were asking us to create dirs on
their behalf that our more than 2 levels deep, eg
com.foo/files/downloads ; I thought such paths weren't allowed, but
apparently they are (and there's no good reason for us to not set them
up correctly).

Bug: 149407572
Test: launch opera
Change-Id: I7c64831032b66e90960b96e41ee42c7d616a759c
2020-02-13 23:37:12 +01:00
Automerger Merge Worker
50f7de29be Merge "Use DM layer directly to manage private DM volumes" am: dd12ea5bd2 am: 47aff8772d am: e3609aa837
Change-Id: I663a0ad6990acfc2cd936b52e39b346c2e48b6ed
2020-02-13 19:08:54 +00:00