Commit graph

3757 commits

Author SHA1 Message Date
Yurii Zubrytskyi
58802279e2 Merge changes from topic "merge-incremental-vold" am: 10a372f1d2 am: 41c1c40afc
Change-Id: I542b7a48e7d94b78bf3fb01e44263e2b161df60f
2020-03-26 07:59:46 +00:00
Yurii Zubrytskyi
b52e063350 Expose new IncFS interface through Vold am: d05bcc8070 am: 636da65360
Change-Id: I349002a3eb80d962c86b24f89816c4ce76d5d65e
2020-03-26 07:59:44 +00:00
Yurii Zubrytskyi
100553416a [automerger skipped] Merge changes from topic "merge-incremental-vold" am: 10a372f1d2 am: 41c1c40afc -s ours
am skip reason: Change-Id I03a8cab0dd6abd7d5c9dcbbc2acb651e818e6cd8 with SHA-1 131365a3e5 is in history

Change-Id: Ic73870d77b44d60bd7bdcbb44ca43267fd456945
2020-03-26 07:55:47 +00:00
Yurii Zubrytskyi
7867b1299c [automerger skipped] Expose new IncFS interface through Vold am: d05bcc8070 am: 636da65360 -s ours
am skip reason: Change-Id I09b33a34ff1ac7f6e415b7bd090c22e7df24d72d with SHA-1 3497cb5be5 is in history

Change-Id: I71e68b76895658e5546f7c96678905b249ff8ffc
2020-03-26 07:55:45 +00:00
Yurii Zubrytskyi
41c1c40afc Merge changes from topic "merge-incremental-vold" am: 10a372f1d2
Change-Id: Id6fe791310761aa715fdf0e37760052a1534a4f0
2020-03-26 07:33:58 +00:00
Yurii Zubrytskyi
636da65360 Expose new IncFS interface through Vold am: d05bcc8070
Change-Id: Icbdb9f233850e70e8ca7c458fd30c4bea93a9923
2020-03-26 07:33:56 +00:00
Yurii Zubrytskyi
10a372f1d2 Merge changes from topic "merge-incremental-vold"
* changes:
  [vold] Add argument verification to IncFS methods
  Expose new IncFS interface through Vold
2020-03-26 07:23:11 +00:00
Yurii Zubrytskyi
ae78344623 [vold] Add argument verification to IncFS methods am: 131365a3e5
Change-Id: I8a19bea4ca9c8f30f754cf7d43feba432152e204
2020-03-26 04:25:24 +00:00
Yurii Zubrytskyi
9e7482ece1 [vold] Add argument verification to IncFS methods
+ Get rid of an extra string copy in path validation function

Bug: 152349257
Test: atest vold_tests
Change-Id: I03a8cab0dd6abd7d5c9dcbbc2acb651e818e6cd8
Merged-In: I03a8cab0dd6abd7d5c9dcbbc2acb651e818e6cd8
2020-03-25 17:21:49 -07:00
Yurii Zubrytskyi
131365a3e5 [vold] Add argument verification to IncFS methods
+ Get rid of an extra string copy in path validation function

Bug: 152349257
Test: atest vold_tests
Change-Id: I03a8cab0dd6abd7d5c9dcbbc2acb651e818e6cd8
2020-03-25 14:33:24 -07:00
Yurii Zubrytskyi
d05bcc8070 Expose new IncFS interface through Vold
CL is a part of multi-repository topic and will be merged
to AOSP

Bug: 146080380
Test: manual

Change-Id: I09b33a34ff1ac7f6e415b7bd090c22e7df24d72d
Merged-In: I09b33a34ff1ac7f6e415b7bd090c22e7df24d72d
2020-03-24 14:26:27 -07:00
Paul Crowley
94abae03a9 Record use of metadata encryption in property
Bug: 152150018
Test: Cuttlefish with and without keydirectory option
Change-Id: I400873ec207cb63f0407fefc83962bb3a927e294
2020-03-24 09:12:48 -07:00
Martijn Coenen
7b64ad549a Merge "Bind mount Android/data and Android/obb individually." into rvc-dev am: 81872e826c
Change-Id: I1a454da8ca2f14c2e77f29d0b9e0f6e2a48528e1
2020-03-24 08:51:18 +00:00
Martijn Coenen
81872e826c Merge "Bind mount Android/data and Android/obb individually." into rvc-dev 2020-03-24 08:31:44 +00:00
TreeHugger Robot
aab174907a Merge "Add quota / casefold options to f2fs if needed." into rvc-dev am: fe6253e3a2
Change-Id: Ia97181187e3eff582d2edf887b21811aa88ea7d2
2020-03-20 14:48:23 +00:00
TreeHugger Robot
fe6253e3a2 Merge "Add quota / casefold options to f2fs if needed." into rvc-dev 2020-03-20 14:35:07 +00:00
Martijn Coenen
449a7d8ae0 Bind mount Android/data and Android/obb individually.
Because we want all other paths (in particular Android/media) to go
through FUSE.

Also use scope_guard to make unwinding some failures easier.

Bug: 151272568
Test: atest AdoptableHostTest
Change-Id: Ib487b9071b5b212c7bb12ce54f80c96d98acaef5
2020-03-20 13:24:41 +01:00
Xin Li
8db17c3111 DO NOT MERGE - Empty merge qt-qpr1-dev-plus-aosp@6304901 into stag-aosp-master am: 4e13a60b8d
Change-Id: Ic6e88b868f1e8de04713198d892411caab957906
2020-03-19 04:22:43 +00:00
Xin Li
f54a1177ad [automerger skipped] DO NOT MERGE - Empty merge qt-qpr1-dev-plus-aosp@6304901 into stag-aosp-master am: 4e13a60b8d -s ours
am skip reason: subject contains skip directive

Change-Id: I8ad9a8221d0713df7d28b42a46fe270bd6ffd134
2020-03-19 04:19:36 +00:00
Xin Li
4e13a60b8d DO NOT MERGE - Empty merge qt-qpr1-dev-plus-aosp@6304901 into stag-aosp-master
Bug: 151763422
Change-Id: I3f26efbcf61365bfac87aa83a0bc8a5dbb2d0a65
2020-03-18 19:40:59 -07:00
Zim
3b6d40f941 Fix vold wedge when unmounting Android/ am: b6488f3f04
Change-Id: Iad3d05b416a9ace3986c3d9db35322fd2c8a099d
2020-03-18 09:55:44 +00:00
Zim
b6488f3f04 Fix vold wedge when unmounting Android/
In EmulatedVolume#doMount, if some operations fail, we call
EmulatedVolume#doUnmount.

During this unmount we try to unmount Android/ causing a FUSE_LOOKUP
on the FUSE mount. If the FUSE mount is not up, this can hang.

Now we introduce a new state to prevent unmounting Android/ if it
wasn't mounted.

Test: atest AdoptableHostTest
Bug: 151685786
Change-Id: I6246d3910c352034d2a4fb09ad9c1e7fd91cba5e
2020-03-17 16:14:56 +00:00
Automerger Merge Worker
fdacc8d462 Make storage dirs remount fork() safe am: 6b12257702
Change-Id: I589afb12062914cc3da9ff8f7c8dd43014ac6ce9
2020-03-16 15:56:09 +00:00
Ricky Wai
6b12257702 Make storage dirs remount fork() safe
Also, use the pids provided by system server to remount all existing
processes, so we don't need to do the heavy and unreliable scanning in
/proc anymore.

Bug: 149548518
Test: atest AdoptableHostTest
Change-Id: Ifb5b79a3bc5438f36e0d61ec8aec96bdbc60ca13
2020-03-12 18:16:27 +00:00
Automerger Merge Worker
b06025acb7 Merge "fskeyring & userspace reboot: support CE keys" am: eaa3443ad8 am: 91ba0c8fa4
Change-Id: I393e9464b2579cfd9b59596a70ca8c3881e0582d
2020-03-11 20:31:30 +00:00
Automerger Merge Worker
03d5991abc [automerger skipped] Merge "fskeyring & userspace reboot: support CE keys" am: eaa3443ad8 am: 91ba0c8fa4 -s ours
am skip reason: Change-Id I37603dc136c7ededc7b0381e4d730cb0ffd912b4 with SHA-1 1ee35cf002 is in history

Change-Id: Idf341b045a9cebb52431265832821cf40f99cd26
2020-03-11 20:30:41 +00:00
Automerger Merge Worker
91ba0c8fa4 Merge "fskeyring & userspace reboot: support CE keys" am: eaa3443ad8
Change-Id: Ib22499ed549567b9ad12cd0f9c0ef5197724fee0
2020-03-11 20:12:14 +00:00
Nikita Ioffe
eaa3443ad8 Merge "fskeyring & userspace reboot: support CE keys" 2020-03-11 16:10:35 +00:00
Martijn Coenen
6c695ef1d9 Prefer f2fs for virtual (private) storage volumes.
Since ext4 currently doesn't have the required kernel patches in place
on cuttlefish.

Bug: 150935323
Test: sm set-virtual-disk true
      sm partition disk:7,xyz private
      inspect mount output
Change-Id: Ief5bd9ace9d39bdfbae8d3857044a2143801f6be
2020-03-11 15:36:14 +01:00
Martijn Coenen
2f1c983240 Add quota / casefold options to f2fs if needed.
These were only added for ext4.

Bug: 150935323
Test: when creating a private f2fs volume, things work as expected.
Change-Id: I11ee04bfddecb6c95e223e66c9bf532c425e6fac
2020-03-11 15:36:14 +01:00
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
1c6731c649 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
Merged-In: I37603dc136c7ededc7b0381e4d730cb0ffd912b4
(cherry picked from commit 1ee35cf002)
2020-03-11 11:46:46 +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
af5251bc31 Merge "Use the blk_device supplied by vdc encryptFstab" am: 3b3a13a81a am: eeb005eb7d
Change-Id: If29abc839cb196072cccc7024b499ef5d54a0f45
2020-03-05 16:32:43 +00: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
21505d9536 Merge "fskeyring & userspace reboot: support DE keys" am: 3b719ed32e am: ac589ee784
Change-Id: I50a54e3ac6a873930d2c3b0ee62ca389100b0787
2020-03-04 15:33:10 +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