OSDN Git Service

android-x86/system-vold.git
4 years agoMerge "Don't do private app-dir permissions/quota on public volumes." into rvc-dev...
Martijn Coenen [Tue, 21 Apr 2020 12:41:54 +0000 (12:41 +0000)]
Merge "Don't do private app-dir permissions/quota on public volumes." into rvc-dev am: 15070b1833

Change-Id: I5b5d4b3f8b8b3ed94264eb79261097b1b93f53a2

4 years agoMerge "Don't do private app-dir permissions/quota on public volumes." into rvc-dev
Martijn Coenen [Tue, 21 Apr 2020 12:22:58 +0000 (12:22 +0000)]
Merge "Don't do private app-dir permissions/quota on public volumes." into rvc-dev

4 years agoMerge "Bind mount install and android writable DATA and OBB dirs" into rvc-dev am...
TreeHugger Robot [Tue, 21 Apr 2020 11:24:14 +0000 (11:24 +0000)]
Merge "Bind mount install and android writable DATA and OBB dirs" into rvc-dev am: 086c96ef6d

Change-Id: I227d66a376dad24ca40612849fa8259ba4dd0aae

4 years agoMerge "Bind mount install and android writable DATA and OBB dirs" into rvc-dev
TreeHugger Robot [Tue, 21 Apr 2020 11:08:07 +0000 (11:08 +0000)]
Merge "Bind mount install and android writable DATA and OBB dirs" into rvc-dev

4 years agoBind mount install and android writable DATA and OBB dirs
Ricky Wai [Tue, 7 Apr 2020 12:43:20 +0000 (13:43 +0100)]
Bind mount install and android writable DATA and OBB dirs

To improvement performance, and also making them able to list
the dirs.

This should also be fine under b/151055432, as the whole obb
directory is mounted, renameTo() from installer to apps should be
a move not copy.

Bug: 153422990
Bug: 153540919
Test: atest AdoptableHostTest
Change-Id: Ia18fd4393db14a0f11d6e5b947dd716515bdeeef

4 years agoDon't do private app-dir permissions/quota on public volumes.
Martijn Coenen [Mon, 20 Apr 2020 13:14:48 +0000 (15:14 +0200)]
Don't do private app-dir permissions/quota on public volumes.

While looking at some emulator logs, I noticed that we fail to create
dirs like /Android/data/com.foo/cache on public volumes, because we try
to chmod it; public volumes go completely through FUSE, even for
Android/, and so these operations will fail, because the underlying
UID/GID is not setup correctly.

Really the only thing we really have to do on public volumes is create
the dirs, like we used to do.

Bug: 152618535
Test: manually verify cache dirs can be created successfully
Change-Id: I66e5d0873f1198123787943b17b468eadf0a853d

4 years agoRename casefold/projectid properties (for f2fs). am: e9239f757e
Martijn Coenen [Fri, 17 Apr 2020 14:40:56 +0000 (14:40 +0000)]
Rename casefold/projectid properties (for f2fs). am: e9239f757e

Change-Id: I6829424a1ecee05ef8784159789a3a9991d897be

4 years agoRename casefold/projectid properties. am: aee6b6fccd
Martijn Coenen [Fri, 17 Apr 2020 08:10:36 +0000 (08:10 +0000)]
Rename casefold/projectid properties. am: aee6b6fccd

Change-Id: I43a490414c4bd816edb707ba350b4ee151133f8f

4 years agoRename casefold/projectid properties (for f2fs).
Martijn Coenen [Thu, 16 Apr 2020 08:16:29 +0000 (10:16 +0200)]
Rename casefold/projectid properties (for f2fs).

According to property naming guidelines.

Bug: 152170470
Bug: 153525566
Test: N/A
Change-Id: Iad1caff6e5cfb7f6a09b77532d64a24de9b0b3c6

4 years agoRename casefold/projectid properties.
Martijn Coenen [Wed, 15 Apr 2020 09:42:47 +0000 (11:42 +0200)]
Rename casefold/projectid properties.

According to property naming guidelines.

Bug: 152170470
Bug: 153525566
Test: N/A
Change-Id: Iaebff2a835288839a2faf0edbe0e47ceb96b4458
Merged-In: Iaebff2a835288839a2faf0edbe0e47ceb96b4458

4 years agoMerge "Choose options format using property" into rvc-dev am: 0fbd0c1542
TreeHugger Robot [Wed, 8 Apr 2020 00:24:40 +0000 (00:24 +0000)]
Merge "Choose options format using property" into rvc-dev am: 0fbd0c1542

Change-Id: I2d891dd6a28c8f599b68a5df840d0d331fc1c440

4 years agoMerge "Choose options format using property" into rvc-dev
TreeHugger Robot [Wed, 8 Apr 2020 00:10:59 +0000 (00:10 +0000)]
Merge "Choose options format using property" into rvc-dev

4 years agoChoose options format using property
Paul Crowley [Sun, 22 Mar 2020 15:02:06 +0000 (08:02 -0700)]
Choose options format using property

To make it easier to support disk formats created using old versions
of dm-default-key with new kernels, choose the disk format to use
based on options_format_version and first_api_version properties
instead of checking the version number of the kernel module.

Bug: 150761030
Test: crosshatch and cuttlefish boot normally; cuttlefish
    fails with "default-key: Not enough arguments" as expected when
    option is set to 1
Cherry-Picked-From: f56d553babc368e557fe90513e78a5ba06626b0d
Merged-In: Ib51071b7c316ce074de72439741087b18335048c
Change-Id: Ib51071b7c316ce074de72439741087b18335048c

4 years agoAdditional operation check when enabling read logs. am: 605a44fe93
Alex Buynytskyy [Sat, 4 Apr 2020 04:08:31 +0000 (04:08 +0000)]
Additional operation check when enabling read logs. am: 605a44fe93

Change-Id: I6b91438709189302d4afe64d3d5dfe28fadd513d

4 years agoAdditional operation check when enabling read logs.
Alex Buynytskyy [Thu, 2 Apr 2020 22:21:47 +0000 (15:21 -0700)]
Additional operation check when enabling read logs.

Vold now does not check caller's permission, but only accepts
transactions from system_server. And it's up to system server to do the
right thing and check permissions/appops.

Bug: b/152633648
Test: atest PackageManagerShellCommandTest PackageManagerShellCommandIncrementalTest
Test: adb shell appops set 1000 GET_USAGE_STATS deny
Change-Id: Id56c1673b135b72b3ec86e572aa4bcca3afc19ab

4 years agoReplace EnsureDirExists with a call to setupAppDir am: 75973cb0dd
Linus Tufvesson [Fri, 3 Apr 2020 13:28:11 +0000 (13:28 +0000)]
Replace EnsureDirExists with a call to setupAppDir am: 75973cb0dd

Change-Id: I58cb29e233e98b588a2e66797bd260b548059ca2

4 years agoReplace EnsureDirExists with a call to setupAppDir
Linus Tufvesson [Mon, 23 Mar 2020 11:59:43 +0000 (11:59 +0000)]
Replace EnsureDirExists with a call to setupAppDir

Test: Manually verified ownership of /storage/emulated/0/Android/data on cf_x86_phone-userdebug after enabling feature
Bug: 151455752

Change-Id: I75a1e3b769476e56094e41d82e7f8e1a72827ded

4 years agoMerge "Checking LOADER_USAGE_STATS before enabling read logs." into rvc-dev am: 6ce90...
Alex Buynytskyy [Thu, 2 Apr 2020 00:48:13 +0000 (00:48 +0000)]
Merge "Checking LOADER_USAGE_STATS before enabling read logs." into rvc-dev am: 6ce90ced12

Change-Id: Ib92de641097b748c417e0d4dfdc21213da7fd789

4 years agoMerge "Checking LOADER_USAGE_STATS before enabling read logs." into rvc-dev
Alex Buynytskyy [Thu, 2 Apr 2020 00:36:26 +0000 (00:36 +0000)]
Merge "Checking LOADER_USAGE_STATS before enabling read logs." into rvc-dev

4 years agoMerge "Send earlyBootEnded notice to all Keymasters" into rvc-dev am: be39b1d53e
TreeHugger Robot [Wed, 1 Apr 2020 22:42:32 +0000 (22:42 +0000)]
Merge "Send earlyBootEnded notice to all Keymasters" into rvc-dev am: be39b1d53e

Change-Id: Ie48c8f230f88cab75c72594269adb1aed7529f3b

4 years agoMerge "Send earlyBootEnded notice to all Keymasters" into rvc-dev
TreeHugger Robot [Wed, 1 Apr 2020 22:31:35 +0000 (22:31 +0000)]
Merge "Send earlyBootEnded notice to all Keymasters" into rvc-dev

4 years agoSend earlyBootEnded notice to all Keymasters
Shawn Willden [Wed, 1 Apr 2020 16:02:16 +0000 (10:02 -0600)]
Send earlyBootEnded notice to all Keymasters

Vold incorrectly sends the earlyBootEnded signal only to the Keymaster
instance used for device encryption, but all of them need it.

Bug: 152932559
Test: VtsHalKeymasterV4_1TargetTest
Change-Id: Id8f01a1dc7d2398395f369c3ea74656a82888829

4 years agoChecking LOADER_USAGE_STATS before enabling read logs.
Alex Buynytskyy [Tue, 31 Mar 2020 21:46:25 +0000 (14:46 -0700)]
Checking LOADER_USAGE_STATS before enabling read logs.

Bug: b/152633648
Test: atest PackageManagerShellCommandTest PackageManagerShellCommandIncrementalTest
Change-Id: I29bf16d06a013566c8dd08e64be2a23ad805e37d

4 years agoMerge "Prefer f2fs for virtual (private) storage volumes." into rvc-dev am: 60d7c823ee
TreeHugger Robot [Tue, 31 Mar 2020 11:11:49 +0000 (11:11 +0000)]
Merge "Prefer f2fs for virtual (private) storage volumes." into rvc-dev am: 60d7c823ee

Change-Id: Icf293e9f683a5a24c2c510c2201705c8c898fa88

4 years agoMerge "Prefer f2fs for virtual (private) storage volumes." into rvc-dev
TreeHugger Robot [Tue, 31 Mar 2020 11:00:31 +0000 (11:00 +0000)]
Merge "Prefer f2fs for virtual (private) storage volumes." into rvc-dev

4 years ago[automerger skipped] Block and wait for /dev/block/loop<N> to appear in case it was...
David Anderson [Mon, 30 Mar 2020 09:12:02 +0000 (09:12 +0000)]
[automerger skipped] Block and wait for /dev/block/loop<N> to appear in case it was created asynchronously. am: 5ba8aeaa80 -s ours am: 87bf96a60e -s ours

am skip reason: Change-Id Id8616804bba622226ca21b8eff0d3eb577b4b7e0 with SHA-1 1dd5c4f787 is in history

Change-Id: If9bb43422e10f5c5053f00191b1f1dcec1718aea

4 years ago[automerger skipped] Block and wait for /dev/block/loop<N> to appear in case it was...
David Anderson [Mon, 30 Mar 2020 09:00:04 +0000 (09:00 +0000)]
[automerger skipped] Block and wait for /dev/block/loop<N> to appear in case it was created asynchronously. am: 5ba8aeaa80 -s ours

am skip reason: Change-Id Id8616804bba622226ca21b8eff0d3eb577b4b7e0 with SHA-1 1dd5c4f787 is in history

Change-Id: Iaffd50d7b736066cfa429edf28b3f18fb956715d

4 years ago[vold] update with incfs_ndk.h am: 01c4e91c09
Songchun Fan [Sun, 29 Mar 2020 17:15:00 +0000 (17:15 +0000)]
[vold] update with incfs_ndk.h am: 01c4e91c09

Change-Id: I70d5449b42f1126885582b701bc45d9a501514e8

4 years ago[vold] update with incfs_ndk.h
Songchun Fan [Wed, 4 Mar 2020 01:58:20 +0000 (17:58 -0800)]
[vold] update with incfs_ndk.h

BUG: 150470163
Test: atest PackageManagerShellCommandIncrementalTest
Change-Id: I5166c49cf48f353dab35e385571ada517cb751ac

4 years agoBlock and wait for /dev/block/loop<N> to appear in case it was created asynchronously.
David Anderson [Tue, 11 Jun 2019 21:51:25 +0000 (14:51 -0700)]
Block and wait for /dev/block/loop<N> to appear in case it was created asynchronously.

Bug: 134711825
Bug: 149462396
Test: StorageManagerTest
Change-Id: Id8616804bba622226ca21b8eff0d3eb577b4b7e0
Merged-In: Id8616804bba622226ca21b8eff0d3eb577b4b7e0

4 years ago[vold] Add argument verification to IncFS methods am: 131365a3e5
Yurii Zubrytskyi [Thu, 26 Mar 2020 04:25:16 +0000 (04:25 +0000)]
[vold] Add argument verification to IncFS methods am: 131365a3e5

Change-Id: I149dfdef094804c5eeaa928ee841f7fd7a5f228f

4 years ago[vold] Add argument verification to IncFS methods
Yurii Zubrytskyi [Wed, 25 Mar 2020 06:49:02 +0000 (23:49 -0700)]
[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

4 years agoMerge "Bind mount Android/data and Android/obb individually." into rvc-dev am: 81872e826c
Martijn Coenen [Tue, 24 Mar 2020 08:50:52 +0000 (08:50 +0000)]
Merge "Bind mount Android/data and Android/obb individually." into rvc-dev am: 81872e826c

Change-Id: I59741944c7731abe21c4b680f496d80beb911a38

4 years agoMerge "Bind mount Android/data and Android/obb individually." into rvc-dev
Martijn Coenen [Tue, 24 Mar 2020 08:31:44 +0000 (08:31 +0000)]
Merge "Bind mount Android/data and Android/obb individually." into rvc-dev

4 years agoMerge "Add quota / casefold options to f2fs if needed." into rvc-dev am: fe6253e3a2
TreeHugger Robot [Fri, 20 Mar 2020 14:48:05 +0000 (14:48 +0000)]
Merge "Add quota / casefold options to f2fs if needed." into rvc-dev am: fe6253e3a2

Change-Id: I7debdd40fc1193146816cb1c54f5a608d5f4af32

4 years agoMerge "Add quota / casefold options to f2fs if needed." into rvc-dev
TreeHugger Robot [Fri, 20 Mar 2020 14:35:07 +0000 (14:35 +0000)]
Merge "Add quota / casefold options to f2fs if needed." into rvc-dev

4 years agoBind mount Android/data and Android/obb individually.
Martijn Coenen [Mon, 16 Mar 2020 13:37:33 +0000 (14:37 +0100)]
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

4 years agoFix vold wedge when unmounting Android/ am: b6488f3f04
Zim [Wed, 18 Mar 2020 09:55:29 +0000 (09:55 +0000)]
Fix vold wedge when unmounting Android/ am: b6488f3f04

Change-Id: Idc5260aca207ee933720a7762cf4be9ea1b18686

4 years agoFix vold wedge when unmounting Android/
Zim [Tue, 17 Mar 2020 15:15:42 +0000 (15:15 +0000)]
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

4 years agoMake storage dirs remount fork() safe am: 6b12257702
Automerger Merge Worker [Mon, 16 Mar 2020 15:55:40 +0000 (15:55 +0000)]
Make storage dirs remount fork() safe am: 6b12257702

Change-Id: I99fd33c2969236efc8f245aafb55ba4a0d5e9691

4 years agoMake storage dirs remount fork() safe
Ricky Wai [Fri, 28 Feb 2020 16:30:47 +0000 (16:30 +0000)]
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

4 years agoPrefer f2fs for virtual (private) storage volumes.
Martijn Coenen [Wed, 11 Mar 2020 14:33:22 +0000 (15:33 +0100)]
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

4 years agoAdd quota / casefold options to f2fs if needed.
Martijn Coenen [Tue, 10 Mar 2020 08:28:39 +0000 (09:28 +0100)]
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

4 years agoMerge "Only set quota project ID inheritance on app-private dirs." into rvc-dev am...
Automerger Merge Worker [Wed, 11 Mar 2020 13:09:25 +0000 (13:09 +0000)]
Merge "Only set quota project ID inheritance on app-private dirs." into rvc-dev am: cbd458bb35

Change-Id: Id8975b6e44e613285467eac8c4156f94fe76fb0d

4 years agoMerge "Only set quota project ID inheritance on app-private dirs." into rvc-dev
TreeHugger Robot [Wed, 11 Mar 2020 12:54:58 +0000 (12:54 +0000)]
Merge "Only set quota project ID inheritance on app-private dirs." into rvc-dev

4 years agoMerge "fskeyring & userspace reboot: support CE keys" into rvc-dev am: 58d89a355a
Automerger Merge Worker [Wed, 11 Mar 2020 12:00:54 +0000 (12:00 +0000)]
Merge "fskeyring & userspace reboot: support CE keys" into rvc-dev am: 58d89a355a

Change-Id: Id2460f313eac688973af9a20b4fc4fddd5cd609a

4 years agoMerge "fskeyring & userspace reboot: support CE keys" into rvc-dev
Nikita Ioffe [Wed, 11 Mar 2020 11:43:30 +0000 (11:43 +0000)]
Merge "fskeyring & userspace reboot: support CE keys" into rvc-dev

4 years agoOnly set quota project ID inheritance on app-private dirs.
Martijn Coenen [Wed, 11 Mar 2020 10:51:45 +0000 (11:51 +0100)]
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

4 years agofskeyring & userspace reboot: support CE keys
Nikita Ioffe [Fri, 28 Feb 2020 19:50:31 +0000 (19:50 +0000)]
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

4 years agoUse the blk_device supplied by vdc encryptFstab am: 7de5377c89
Automerger Merge Worker [Fri, 6 Mar 2020 01:36:39 +0000 (01:36 +0000)]
Use the blk_device supplied by vdc encryptFstab am: 7de5377c89

Change-Id: I7d25460f5f4333ce9278349dadaa58b09f197c02

4 years agoUse the blk_device supplied by vdc encryptFstab
Paul Crowley [Mon, 2 Mar 2020 20:57:58 +0000 (12:57 -0800)]
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

4 years agoMerge "umount /data/user/0 before umount /data" into rvc-dev am: 16df3dc2b5
Automerger Merge Worker [Thu, 5 Mar 2020 00:36:49 +0000 (00:36 +0000)]
Merge "umount /data/user/0 before umount /data" into rvc-dev am: 16df3dc2b5

Change-Id: I830613a9271a131e555eeb57f6e617053bf1a87a

4 years agoMerge "umount /data/user/0 before umount /data" into rvc-dev
Hung-ying Tyan [Thu, 5 Mar 2020 00:24:34 +0000 (00:24 +0000)]
Merge "umount /data/user/0 before umount /data" into rvc-dev

4 years agoMerge "fskeyring & userspace reboot: support DE keys" into rvc-dev am: e8c7f09834
Automerger Merge Worker [Wed, 4 Mar 2020 12:31:32 +0000 (12:31 +0000)]
Merge "fskeyring & userspace reboot: support DE keys" into rvc-dev am: e8c7f09834

Change-Id: I260d865a5f6954647ea9d7835e45d8219b7de6a3

4 years agoMerge "fskeyring & userspace reboot: support DE keys" into rvc-dev
Nikita Ioffe [Wed, 4 Mar 2020 12:13:55 +0000 (12:13 +0000)]
Merge "fskeyring & userspace reboot: support DE keys" into rvc-dev

4 years agoumount /data/user/0 before umount /data
Hyangseok Chae [Thu, 27 Feb 2020 09:21:50 +0000 (18:21 +0900)]
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 3cf3233bac176744d43c682b7f9244db58c3402a)

4 years agoAdd Android/data mounting along with obb mounting in vold am: c1e33a3cc9
Automerger Merge Worker [Mon, 2 Mar 2020 13:47:12 +0000 (13:47 +0000)]
Add Android/data mounting along with obb mounting in vold am: c1e33a3cc9

Change-Id: If6b5826c9440e45ff54da90ef5b0ccc34b5edb46

4 years agoAdd Android/data mounting along with obb mounting in vold
Ricky Wai [Thu, 20 Feb 2020 16:10:01 +0000 (16:10 +0000)]
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 d88e090098d4a95112aecb135d1bcba96150bdd1)

4 years agofskeyring & userspace reboot: support DE keys
Nikita Ioffe [Thu, 27 Feb 2020 18:21:55 +0000 (18:21 +0000)]
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

4 years agoMerge "Switch to new project ID constants."
Martijn Coenen [Thu, 20 Feb 2020 08:58:56 +0000 (08:58 +0000)]
Merge "Switch to new project ID constants."

4 years agoMerge "Make CTS not HEH the default post Q" am: 39969f0288 am: 17d85205bd am: f0bea38daa
Automerger Merge Worker [Thu, 20 Feb 2020 00:22:25 +0000 (00:22 +0000)]
Merge "Make CTS not HEH the default post Q" am: 39969f0288 am: 17d85205bd am: f0bea38daa

Change-Id: I3cf8f261ce7ecf41315ffddbf4964cf47bca1655

4 years agoSwitch to new project ID constants.
Martijn Coenen [Tue, 18 Feb 2020 15:29:25 +0000 (16:29 +0100)]
Switch to new project ID constants.

Use new constants, instead of reusing previous sdcardfs values.

Bug: 146419093
Test: lsattr -pR
Change-Id: I7409d86cac5360e125e843cc79f3c5f41d74dd1e

4 years agoMerge "Make CTS not HEH the default post Q" am: 39969f0288 am: 17d85205bd
Automerger Merge Worker [Wed, 19 Feb 2020 23:37:01 +0000 (23:37 +0000)]
Merge "Make CTS not HEH the default post Q" am: 39969f0288 am: 17d85205bd

Change-Id: I0c3114a77c37b30e542c45fc4d4d6ea592444b1a

4 years agoMerge "Make CTS not HEH the default post Q" am: 39969f0288
Automerger Merge Worker [Wed, 19 Feb 2020 23:20:59 +0000 (23:20 +0000)]
Merge "Make CTS not HEH the default post Q" am: 39969f0288

Change-Id: I0cb0430214ab69656c6e7f3116194b63eb54672b

4 years agoMerge "Make CTS not HEH the default post Q"
Treehugger Robot [Wed, 19 Feb 2020 23:04:37 +0000 (23:04 +0000)]
Merge "Make CTS not HEH the default post Q"

4 years agoMerge "Fix unaligned access to auth token user_id" am: 21a17b091e am: 01759662fd...
Automerger Merge Worker [Wed, 19 Feb 2020 22:20:32 +0000 (22:20 +0000)]
Merge "Fix unaligned access to auth token user_id" am: 21a17b091e am: 01759662fd am: 7b9b164946

Change-Id: Ibe10561445571d7607ea93d7a988a9ab847e234a

4 years agoMerge "Remove unused code in VoldUtil.h" am: e19189bd7f am: b6421644ec am: 923309aae2
Automerger Merge Worker [Wed, 19 Feb 2020 22:19:46 +0000 (22:19 +0000)]
Merge "Remove unused code in VoldUtil.h" am: e19189bd7f am: b6421644ec am: 923309aae2

Change-Id: I0ec249df609cbad7f80ac739545c6cf0199e6232

4 years agoMerge changes from topics "metadata_wrapped_key_aosp", "volume_metadata" am: 36fd1ebf...
Automerger Merge Worker [Wed, 19 Feb 2020 22:19:26 +0000 (22:19 +0000)]
Merge changes from topics "metadata_wrapped_key_aosp", "volume_metadata" am: 36fd1ebfae am: 6891eb7e2d am: c14f46d114

Change-Id: I89f51bfaeb61c235aeccbe8a5a5a447ab14c46cb

4 years agoMerge "Mount direct boot apps obb dir after fuse is ready."
Ricky Wai [Wed, 19 Feb 2020 19:42:13 +0000 (19:42 +0000)]
Merge "Mount direct boot apps obb dir after fuse is ready."

4 years agoMake CTS not HEH the default post Q
Paul Crowley [Tue, 18 Feb 2020 18:10:08 +0000 (10:10 -0800)]
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

4 years agoMount direct boot apps obb dir after fuse is ready.
Ricky Wai [Tue, 11 Feb 2020 14:31:24 +0000 (14:31 +0000)]
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

4 years agoAdd fixupAppDir() API.
Martijn Coenen [Tue, 18 Feb 2020 14:06:37 +0000 (15:06 +0100)]
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

4 years agoMerge "Fix unaligned access to auth token user_id" am: 21a17b091e am: 01759662fd
Automerger Merge Worker [Wed, 19 Feb 2020 00:06:04 +0000 (00:06 +0000)]
Merge "Fix unaligned access to auth token user_id" am: 21a17b091e am: 01759662fd

Change-Id: I224885ade242636a9806574c164f34494a8f377f

4 years agoMerge "Remove unused code in VoldUtil.h" am: e19189bd7f am: b6421644ec
Automerger Merge Worker [Wed, 19 Feb 2020 00:05:34 +0000 (00:05 +0000)]
Merge "Remove unused code in VoldUtil.h" am: e19189bd7f am: b6421644ec

Change-Id: If68c55c8e6f3db5e00e08f958845ceab8cf36f4e

4 years agoMerge changes from topics "metadata_wrapped_key_aosp", "volume_metadata" am: 36fd1ebf...
Automerger Merge Worker [Wed, 19 Feb 2020 00:05:22 +0000 (00:05 +0000)]
Merge changes from topics "metadata_wrapped_key_aosp", "volume_metadata" am: 36fd1ebfae am: 6891eb7e2d

Change-Id: I39904b704f983124afd8ff62cd3b863fd600e6a2

4 years agoMerge "Fix unaligned access to auth token user_id" am: 21a17b091e
Automerger Merge Worker [Tue, 18 Feb 2020 23:40:09 +0000 (23:40 +0000)]
Merge "Fix unaligned access to auth token user_id" am: 21a17b091e

Change-Id: If1b44823f6758c9428b5874b2629579f384399b7

4 years agoMerge "Remove unused code in VoldUtil.h" am: e19189bd7f
Automerger Merge Worker [Tue, 18 Feb 2020 23:40:04 +0000 (23:40 +0000)]
Merge "Remove unused code in VoldUtil.h" am: e19189bd7f

Change-Id: I52b8e04f85890a1a320c47a191bf1c0429e058a4

4 years agoMerge changes from topics "metadata_wrapped_key_aosp", "volume_metadata" am: 36fd1ebfae
Automerger Merge Worker [Tue, 18 Feb 2020 23:39:37 +0000 (23:39 +0000)]
Merge changes from topics "metadata_wrapped_key_aosp", "volume_metadata" am: 36fd1ebfae

Change-Id: Ieb478426e40feffcefd3a5e478e5e1c5d72539b7

4 years agoMerge "Fix unaligned access to auth token user_id"
Paul Crowley [Tue, 18 Feb 2020 23:18:46 +0000 (23:18 +0000)]
Merge "Fix unaligned access to auth token user_id"

4 years agoMerge "Remove unused code in VoldUtil.h"
Paul Crowley [Tue, 18 Feb 2020 23:18:30 +0000 (23:18 +0000)]
Merge "Remove unused code in VoldUtil.h"

4 years agoMerge changes from topics "metadata_wrapped_key_aosp", "volume_metadata"
Paul Crowley [Tue, 18 Feb 2020 23:17:07 +0000 (23:17 +0000)]
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

4 years agoOn newer devices, use dm-default-key to encrypt SD cards
Paul Crowley [Fri, 7 Feb 2020 20:51:56 +0000 (12:51 -0800)]
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

4 years agovold: Wrapped key support for metadata encryption
Barani Muthukumaran [Fri, 7 Feb 2020 06:56:27 +0000 (22:56 -0800)]
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

4 years agoRefactor: make makeGen local
Paul Crowley [Fri, 7 Feb 2020 20:51:56 +0000 (12:51 -0800)]
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

4 years agoFix unaligned access to auth token user_id
Paul Crowley [Thu, 30 Aug 2018 22:25:19 +0000 (15:25 -0700)]
Fix unaligned access to auth token user_id

Bug: 65232288
Test: Set a pattern on cuttlefish, ensure we can unlock
Change-Id: I5ee09cf72ab7d3d636a25755134bfad6f88265f9

4 years agoRemove unused code in VoldUtil.h
Paul Crowley [Fri, 7 Feb 2020 23:08:12 +0000 (15:08 -0800)]
Remove unused code in VoldUtil.h

Test: Treehugger
Change-Id: I87585852af49ee49d63e3b1cde579114f855118b

4 years agoSet a default ACL on the top-level OBB directory.
Martijn Coenen [Tue, 18 Feb 2020 12:44:59 +0000 (13:44 +0100)]
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

4 years agoAdd sticky dir bit to Android/ dirs.
Martijn Coenen [Tue, 18 Feb 2020 09:41:37 +0000 (10:41 +0100)]
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

4 years agoMerge "Retry deleting dm devices."
TreeHugger Robot [Tue, 18 Feb 2020 13:59:56 +0000 (13:59 +0000)]
Merge "Retry deleting dm devices."

4 years agoFix vold cannot create obb directory
Ricky Wai [Mon, 17 Feb 2020 18:57:01 +0000 (18:57 +0000)]
Fix vold cannot create obb directory

Test: setupAppDir works now
Change-Id: I4bc67ecb57c30b1d0728580abc738e91f97de722

4 years agoresolve merge conflicts of bdd9fbf9dbda429393ee0d86a74c71fdfbaa6a19 to master
Paul Crowley [Sun, 16 Feb 2020 15:37:18 +0000 (07:37 -0800)]
resolve merge conflicts of bdd9fbf9dbda429393ee0d86a74c71fdfbaa6a19 to master

Bug: None
Test: Treehugger
Change-Id: I17a300687bc7f56feb79b820b7196b2a9124c5f4

4 years agoMerge "Refactor key generation to handle both normal and metadata encryption." am...
Paul Crowley [Sat, 15 Feb 2020 02:13:22 +0000 (02:13 +0000)]
Merge "Refactor key generation to handle both normal and metadata encryption." am: 8e0780cba2 am: 79b853551d

Change-Id: I644d55df9c5a5441ead5b6790efff159b292c957

4 years agoMerge "Refactor key generation to handle both normal and metadata encryption." am...
Paul Crowley [Sat, 15 Feb 2020 02:03:19 +0000 (02:03 +0000)]
Merge "Refactor key generation to handle both normal and metadata encryption." am: 8e0780cba2

Change-Id: I59510b64f6803f5e76fefa359abfcc9207420126

4 years agoMerge "Refactor key generation to handle both normal and metadata encryption."
Paul Crowley [Sat, 15 Feb 2020 01:40:26 +0000 (01:40 +0000)]
Merge "Refactor key generation to handle both normal and metadata encryption."

4 years agoRetry deleting dm devices.
Ricky Wai [Sat, 15 Feb 2020 01:15:42 +0000 (01:15 +0000)]
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

4 years agoRefactor key generation to handle both normal and metadata encryption.
Paul Crowley [Wed, 12 Feb 2020 19:04:05 +0000 (11:04 -0800)]
Refactor key generation to handle both normal and metadata encryption.

Bug: 147733587
Test: Treehugger
Change-Id: Iee176037dec2621c84da325c2627f988fcebbc8d
Merged-In: Iee176037dec2621c84da325c2627f988fcebbc8d

4 years agoRefactor key generation to handle both normal and metadata encryption.
Paul Crowley [Wed, 12 Feb 2020 19:04:05 +0000 (11:04 -0800)]
Refactor key generation to handle both normal and metadata encryption.

Bug: 147733587
Test: Treehugger
Change-Id: Iee176037dec2621c84da325c2627f988fcebbc8d

4 years agoMerge "Refactor MetadataCrypt.cpp to make create_crypto_blk_dev more general" am...
Paul Crowley [Fri, 14 Feb 2020 21:35:09 +0000 (21:35 +0000)]
Merge "Refactor MetadataCrypt.cpp to make create_crypto_blk_dev more general" am: 7566e467ab am: b272b21a0a am: 41bac014cf

Change-Id: Id9e2e9b5b9f720635218d16b2d5a65780dea1974

4 years agoMerge "Refactor MetadataCrypt.cpp to make create_crypto_blk_dev more general" am...
Paul Crowley [Fri, 14 Feb 2020 21:19:41 +0000 (21:19 +0000)]
Merge "Refactor MetadataCrypt.cpp to make create_crypto_blk_dev more general" am: 7566e467ab am: b272b21a0a

Change-Id: I6afc145de2a06a5d3bb9af516fa20cdeeb4f2c56

4 years agoMerge "Refactor MetadataCrypt.cpp to make create_crypto_blk_dev more general" am...
Paul Crowley [Fri, 14 Feb 2020 21:07:09 +0000 (21:07 +0000)]
Merge "Refactor MetadataCrypt.cpp to make create_crypto_blk_dev more general" am: 7566e467ab

Change-Id: Ib59c92bf516a171bfebc7c11be92502b37acf375