Commit graph

3522 commits

Author SHA1 Message Date
Automerger Merge Worker
369c24a751 Merge "Only set quota project ID inheritance on app-private dirs." into rvc-dev am: cbd458bb35
Change-Id: Ic4c437ba93728b0552a42505c13cefc7c9b3242f
2020-03-11 13:09:22 +00:00
TreeHugger Robot
cbd458bb35 Merge "Only set quota project ID inheritance on app-private dirs." into rvc-dev 2020-03-11 12:54:58 +00:00
Automerger Merge Worker
45c30df34f Merge "fskeyring & userspace reboot: support CE keys" into rvc-dev am: 58d89a355a
Change-Id: I79e495fe735c9c6380fa46de3b734e802c2a098a
2020-03-11 12:01:04 +00:00
Nikita Ioffe
58d89a355a Merge "fskeyring & userspace reboot: support CE keys" into rvc-dev 2020-03-11 11:43:30 +00:00
Martijn Coenen
9171fcc984 Only set quota project ID inheritance on app-private dirs.
Previously every directory on external storage had project ID quota
inheritance enabled; this means that if any new file/directory is
created under such a directory, it will inherit the project ID from the
parent. We use a default project ID of 1000 for generic directories, and
application-specific project IDs for app-specific directories.

MediaProvider is responsible for updating the quota type in the generic
directories, as it scans all files there. However, there is a problem
with this approach: if you move a file to a directory with project ID
inheritance set, and the project ID of that file differs from the
project ID of the dir, that results in an EXDEV error, and requires a
copy instead. For example, if /sdcard/DCIM/test.jpg has a project ID of
1003 (for images), and you try to move it to /sdcard/Pictures/test.jpg,
that would require a copy, because the project ID of /sdcard/Pictures is
1000.

While this is not a very common scenario, it's still better to avoid it.
Luckily we can - since MediaProvider anyway scans all files, it will set
the project ID on individual files correctly - there's no need to
inherit them.

We then only need to inherit quota in application-specific directories,
since in those directories the app can create files itself, and those
need to be tagged correctly.

This change enables that, by removing quota inheritance setting from the
top-level directory, and instead doing it for app-specific directories
instead.

Bug: 151078664
Test: atest StorageHostTest
      atest com.android.tests.fused.host.FuseDaemonHostTest#testRenameAndReplaceFile
Change-Id: I38a057ec61cb627e39a3ff7ac58c7218dc251bdc
2020-03-11 11:51:45 +01:00
Nikita Ioffe
1ee35cf002 fskeyring & userspace reboot: support CE keys
During userspace reboot /data might be unmounted & remounted, meaning
that CE keys stored in fs-level keyring will be lost. In order to be
able to restore them, when installing new key to fs-level keyring, it's
also added to session-level keyring with type "fscrypt-provisioning".

Then when init_user0 is called during userspace reboot, vold will try to
load CE keys from the session-level keyring back into fs-level keyring
for all the users that were unlocked before the reboot.

If for any user vold fails to install the key, init_user0 will fail and
fallback to hard reboot will be triggered.

Test: set a pin pattern
Test: adb shell setprop sys.init.userdata_remount.force_umount 1
Test: adb shell svc power reboot userspace
Test: atest CtsUserspaceRebootHostSideTestCases
Bug: 143970043
Change-Id: I37603dc136c7ededc7b0381e4d730cb0ffd912b4
2020-03-07 01:19:42 +00:00
Automerger Merge Worker
8988772f16 [automerger skipped] Use the blk_device supplied by vdc encryptFstab am: 7de5377c89 -s ours
am skip reason: Change-Id I279f087b1b7aded40c5a62281154851ce970ba70 with SHA-1 48aa90cd6b is in history

Change-Id: I9eb2f1872efa09a914d77404e4ae675cc106f59d
2020-03-06 00:28:29 +00:00
Paul Crowley
7de5377c89 Use the blk_device supplied by vdc encryptFstab
fs_mgr may put other dm devices on top of the raw disk, such as for
checkpointing, and it hands metadata encryption the uppermost device in
vdc. That's what should be encrypted, not the raw disk.

Bug: 150354860
Test: Treehugger
Merged-In: I279f087b1b7aded40c5a62281154851ce970ba70
Change-Id: I279f087b1b7aded40c5a62281154851ce970ba70
2020-03-05 12:57:40 -08:00
Automerger Merge Worker
32f9bd4e8b Merge "Use the blk_device supplied by vdc encryptFstab" am: 3b3a13a81a am: eeb005eb7d
Change-Id: I830e0e44c0d54d5b89e1dab0ab51192261746556
2020-03-05 16:32:43 +00:00
Automerger Merge Worker
eeb005eb7d Merge "Use the blk_device supplied by vdc encryptFstab" am: 3b3a13a81a
Change-Id: I7967532a151eb373b878e7723e73df67cce1061f
2020-03-05 16:18:03 +00:00
Paul Crowley
3b3a13a81a Merge "Use the blk_device supplied by vdc encryptFstab" 2020-03-05 15:59:18 +00:00
Automerger Merge Worker
01d16c8a7e [automerger skipped] Merge "umount /data/user/0 before umount /data" into rvc-dev am: 16df3dc2b5 -s ours
am skip reason: Change-Id I919f9e31a9d2d745b297a7ab99b399aa9b293b39 with SHA-1 3cf3233bac is in history

Change-Id: I22164c5f84bf5ab19a8586d2000cbb98a28e33c0
2020-03-05 00:37:18 +00:00
Hung-ying Tyan
16df3dc2b5 Merge "umount /data/user/0 before umount /data" into rvc-dev 2020-03-05 00:24:34 +00:00
Automerger Merge Worker
73353ee3df [automerger skipped] Merge "fskeyring & userspace reboot: support DE keys" am: 3b719ed32e am: ac589ee784 -s ours
am skip reason: Change-Id I153caa1d7c373b3c906a34f1184c681e52854a9d with SHA-1 1eaea5a6a2 is in history

Change-Id: Ic498847cfe85ac0e45b33d221f6fdb69321f673d
2020-03-04 15:33:05 +00:00
Automerger Merge Worker
ac589ee784 Merge "fskeyring & userspace reboot: support DE keys" am: 3b719ed32e
Change-Id: I23ff1535eacf875561c6fef250b431fe17b6dc14
2020-03-04 15:19:40 +00:00
Nikita Ioffe
3b719ed32e Merge "fskeyring & userspace reboot: support DE keys" 2020-03-04 15:02:23 +00:00
Automerger Merge Worker
dabac069d8 Merge "fskeyring & userspace reboot: support DE keys" into rvc-dev am: e8c7f09834
Change-Id: Id1089810030a33b92273afd29fd2d9eace9ba684
2020-03-04 12:31:38 +00:00
Nikita Ioffe
f0550af103 fskeyring & userspace reboot: support DE keys
During userspace reboot /data might be unmounted, which means that if
device supports filesystem keyring, DE keys will be lost and are needed
to be re-installed.

Test: adb shell setprop sys.init.userdata_remount.force_umount 1
Test: adb shell svc power reboot userspace
Test: atest CtsUserspaceRebootHostSideTestCases
Bug: 143970043
Change-Id: I153caa1d7c373b3c906a34f1184c681e52854a9d
Merged-In: I153caa1d7c373b3c906a34f1184c681e52854a9d
(cherry picked from commit 1eaea5a6a2)
2020-03-04 12:18:53 +00:00
Nikita Ioffe
e8c7f09834 Merge "fskeyring & userspace reboot: support DE keys" into rvc-dev 2020-03-04 12:13:55 +00:00
Hyangseok Chae
79b03ff9e6 umount /data/user/0 before umount /data
FDE device has shut down and restart the framework.
But restart is not triggered due to umount fail.
umount /data fail with "device is busy"
It is because bind mount /data/data to /data/user/0

We need umount /data/user/0 before umount /data

Bug: 148004718
Test: Flash GSI and check boot with FDE and FBE device.
Change-Id: I919f9e31a9d2d745b297a7ab99b399aa9b293b39
Merged-In: I919f9e31a9d2d745b297a7ab99b399aa9b293b39
(cherry picked from commit 3cf3233bac)
2020-03-04 14:33:08 +08:00
Automerger Merge Worker
332d1ec143 Merge "umount /data/user/0 before umount /data" am: 3a0fd35b62 am: 20f9f29d53
Change-Id: I0cef7deb44c9b55d7f9adbc7022bb484086449c9
2020-03-04 05:09:52 +00:00
Automerger Merge Worker
20f9f29d53 Merge "umount /data/user/0 before umount /data" am: 3a0fd35b62
Change-Id: Ibb3aa685585e8dab22f504a7f862cad5e551ca96
2020-03-04 04:53:16 +00:00
Treehugger Robot
3a0fd35b62 Merge "umount /data/user/0 before umount /data" 2020-03-04 04:34:46 +00:00
Hyangseok Chae
3cf3233bac umount /data/user/0 before umount /data
FDE device has shut down and restart the framework.
But restart is not triggered due to umount fail.
umount /data fail with "device is busy"
It is because bind mount /data/data to /data/user/0

We need umount /data/user/0 before umount /data

Bug: 148004718
Test: Flash GSI and check boot with FDE and FBE device.
Change-Id: I919f9e31a9d2d745b297a7ab99b399aa9b293b39
2020-03-04 02:27:50 +00:00
Paul Crowley
48aa90cd6b Use the blk_device supplied by vdc encryptFstab
fs_mgr may put other dm devices on top of the raw disk, such as for
checkpointing, and it hands metadata encryption the uppermost device in
vdc. That's what should be encrypted, not the raw disk.

Bug: 150354860
Test: Treehugger
Change-Id: I279f087b1b7aded40c5a62281154851ce970ba70
2020-03-02 13:52:22 -08:00
Automerger Merge Worker
f06148d31c Add Android/data mounting along with obb mounting in vold am: c1e33a3cc9
Change-Id: I27cf0237c56e1a932746bdc147e842381374601d
2020-03-02 13:46:59 +00:00
Ricky Wai
c1e33a3cc9 Add Android/data mounting along with obb mounting in vold
We should mount Android/data also, not only Android/obb.

Test: After flag is enabled, AdoptableHostTest still pass.
Bug: 148049767
Bug: 150584566
Change-Id: I26dc3756aa5843b85565495e9c2698130113f49a
Merged-In: I26dc3756aa5843b85565495e9c2698130113f49a
(cherry picked from commit d88e090098)
2020-03-02 10:58:44 +00:00
Nikita Ioffe
1eaea5a6a2 fskeyring & userspace reboot: support DE keys
During userspace reboot /data might be unmounted, which means that if
device supports filesystem keyring, DE keys will be lost and are needed
to be re-installed.

Test: adb shell setprop sys.init.userdata_remount.force_umount 1
Test: adb shell svc power reboot userspace
Test: atest CtsUserspaceRebootHostSideTestCases
Bug: 143970043
Change-Id: I153caa1d7c373b3c906a34f1184c681e52854a9d
2020-02-27 21:42:08 +00:00
Automerger Merge Worker
cf54a7bf4f [automerger skipped] Merge "Use optional for nullable types" am: deb7085453 am: c63694c6e1 -s ours
am skip reason: Change-Id I98549c8614c9152d5d45e2f1f33f2f3c31a9bbbf with SHA-1 4fcb707ecd is in history

Change-Id: I333576d11d8782d4b379403459d7cb5b870a9866
2020-02-27 03:35:31 +00:00
Automerger Merge Worker
c63694c6e1 Merge "Use optional for nullable types" am: deb7085453
Change-Id: Iea4d8e042d65e2ed1befa6dc18c822f2982c41ab
2020-02-27 03:22:54 +00:00
Jooyung Han
deb7085453 Merge "Use optional for nullable types" 2020-02-27 03:06:14 +00:00
Jooyung Han
4fcb707ecd Use optional for nullable types
AIDL generates optional<T> for nullable T types for C++, which is more
efficient and idomatic and easy to use.

Bug: 144773267
Test: build/flash/boot
Merged-In: I98549c8614c9152d5d45e2f1f33f2f3c31a9bbbf
Change-Id: I98549c8614c9152d5d45e2f1f33f2f3c31a9bbbf
(cherry picked from commit 3ce0ee5363)

Exempt-From-Owner-Approval: CP from master
2020-02-26 03:58:22 +00:00
Martijn Coenen
6a4d95d08e Merge "Switch to new project ID constants." 2020-02-20 08:58:56 +00:00
Jooyung Han
d75a10ac6f Use optional for nullable types
AIDL generates optional<T> for nullable T types for C++, which is more
efficient and idomatic and easy to use.

Bug: 144773267
Test: build/flash/boot
Merged-In: I98549c8614c9152d5d45e2f1f33f2f3c31a9bbbf
Change-Id: I98549c8614c9152d5d45e2f1f33f2f3c31a9bbbf
(cherry picked from commit 0568fd287cfc0affc8e985f21da3793cdda286a3)
2020-02-20 17:32:21 +09:00
Automerger Merge Worker
d80d53e31f Merge "Make CTS not HEH the default post Q" am: 39969f0288 am: 17d85205bd am: f0bea38daa
Change-Id: I3cf8f261ce7ecf41315ffddbf4964cf47bca1655
2020-02-20 00:22:25 +00:00
Martijn Coenen
aee40511ae Switch to new project ID constants.
Use new constants, instead of reusing previous sdcardfs values.

Bug: 146419093
Test: lsattr -pR
Change-Id: I7409d86cac5360e125e843cc79f3c5f41d74dd1e
2020-02-20 00:39:05 +01:00
Automerger Merge Worker
f0bea38daa Merge "Make CTS not HEH the default post Q" am: 39969f0288 am: 17d85205bd
Change-Id: I0c3114a77c37b30e542c45fc4d4d6ea592444b1a
2020-02-19 23:37:01 +00:00
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