Commit graph

3580 commits

Author SHA1 Message Date
Nikita Ioffe
7e29904e8c Merge "Configure read ahead for fuse mounts" into rvc-dev am: bcd7d5e7ce
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/vold/+/11837171

Change-Id: I16f0f0b5925c503c66d1d7b14687232b9c30f782
2020-06-17 16:53:01 +00:00
Nikita Ioffe
bcd7d5e7ce Merge "Configure read ahead for fuse mounts" into rvc-dev 2020-06-17 16:37:37 +00:00
Nikita Ioffe
dcee5c1d21 Configure read ahead for fuse mounts
For fuse read ahead can be configured by writing a value to the
/sys/class/bdi/{MAJOR}:{MINOR}/read_ahead_kb file.

There are several different ways of getting {MAJOR}:{MINOR} values of
the filesystem:

* Look at st_dev of stat("/mnt/user/0/emulated").
* Parse /proc/self/mountinfo.

Stat'ing approach is used since it's easier to implement.

Bug: 157982297
Test: atest vold_tests
Test: adb shell cat /proc/self/mountinfo to get MAJOR:MINOR
Test: adb shell cat /sys/class/bdi/{MAJOR}:{MINOR}/read_ahead_kb
Test: created public volume, checked it's read_ahead_kb is also 256
Change-Id: Id0c149c4af1ceabf3afc33b4100563a512b38316
2020-06-17 15:58:25 +01:00
Martijn Coenen
55565a991f Add app's own UID to the default ACL. am: 1129b81071
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/vold/+/11871333

Change-Id: Icff0c7db7e572aedb6da75c38bdea08c204e087e
2020-06-17 07:01:53 +00:00
Martijn Coenen
1129b81071 Add app's own UID to the default ACL.
On devices without sdcardfs, /Android/data/com.foo and
/Android/obb/com.foo can be written by other processes (eg installers);
in those cases, file ownership may be wrong. To ensure that the original
app always has access to the files contained in this directory, add a
group to the default ACL that matches the UID of the app. Since all apps
have their own UID also as their group ID, this ensures that things keep
working correctly.

Bug: 157530951
Test: atest
android.appsecurity.cts.ExternalStorageHostTest#testExternalStorageUnsharedObb
Change-Id: I829a2a7c7b578a8328643f38681e68796adcd6b2

Change-Id: Ibbc333fb395507363830dfcf5dc6f1cfd55f008d
2020-06-16 15:16:18 +02:00
Martijn Coenen
8714d59e29 Merge "vold: Support aborting FUSE connections." into rvc-dev am: cbb69e548a
Change-Id: I587b49c9baed58fb87d27e060faf5d3d4ef8d788
2020-05-29 15:59:55 +00:00
Martijn Coenen
cbb69e548a Merge "vold: Support aborting FUSE connections." into rvc-dev 2020-05-29 15:47:05 +00:00
Abhijeet Kaur
13bfc2465c FuseDaemonHostTest is migrated to CTS and renamed. am: de83802e41
Change-Id: Iebe048b3e1dd31a63ed62df8c2010e9e5d5d5e4a
2020-05-29 15:06:57 +00:00
Abhijeet Kaur
de83802e41 FuseDaemonHostTest is migrated to CTS and renamed.
FuseDaemonHostTest is migrated to CTS and renamed to
CtsScopedStorageHostTest.

Bug: 142926859
Test: atest --test-mapping
Change-Id: I24c74e20909ccf8868d1487e1cc93f6f2c0108fc
2020-05-28 18:43:08 +01:00
Martijn Coenen
23c0445355 vold: Support aborting FUSE connections.
This can be done through binder as well as vdc, using 'vdc volume
abort_fuse'.

Bug: 153411204
Test: adb shell vdc volume abort_fuse
Change-Id: I93e46dc1cd361729cc1162c63520cf73152ea409
2020-05-28 16:07:16 +02:00
Daniel Rosenberg
09daf93c62 Move enabling sdcardfs behind a property am: f36bdddc7e
Change-Id: I6ded03167243e9fc60dc2206b5781a84a0140aa3
2020-05-21 08:41:18 +00:00
Daniel Rosenberg
f36bdddc7e Move enabling sdcardfs behind a property
This allows devices that have sdcardfs enabled in the kernel to not use
it. When external_storage.sdcardfs.enabled=0, sdcardfs will not be
mounted. This is treated as default true to not affect upgrading
devices. It does not use the old ro.sys.sdcardfs as that has been
repurposed over time and no longer can be relied on to turn off
sdcardfs. This is included within emulated_storage.mk

Bug: 155222498
Test: mount|grep "type sdcardfs" should find nothing after boot complete
      if external_storage.sdcardfs.enabled=0
Change-Id: I23d75fb1225aeabbcb1a035ad62fd042b6b3c7b5
2020-05-19 22:11:49 -07:00
TreeHugger Robot
34d72f126b Merge "Handle virtio in private fs mapping" into rvc-dev am: 0d1fcb90d6
Change-Id: I11bc694a26676dd9f8b0fda7f2078a9bc6ed8719
2020-05-20 04:44:11 +00:00
TreeHugger Robot
0d1fcb90d6 Merge "Handle virtio in private fs mapping" into rvc-dev 2020-05-20 04:28:31 +00:00
Alistair Delva
c671731075 Handle virtio in private fs mapping
When the vold core decides if a device is SD or USB, it checks for MMC
or virtio, however when the filesystem type is decided, it does not
check for virtio, only MMC. This causes virtio SD cards to be formatted
with ext4 unconditionally.

This fix is independently correct, but it incidentally gets adopted
storage working on cuttlefish (and Android Emulator) because f2fs can
support fscrypt and casefolding at the same time; ext4 currently cannot.

Bug: 156286088
Change-Id: I0b41670d5f76b2506dad437917c2276f8e0aaccf
2020-05-19 17:42:20 -07:00
Paul Crowley
4ca39e4b56 Merge "Record use of metadata encryption in property" into rvc-dev am: 09ff429e2a
Change-Id: I75726c747937654cdaea15e299cedf0f72c7c5a5
2020-05-19 23:12:02 +00:00
Paul Crowley
09ff429e2a Merge "Record use of metadata encryption in property" into rvc-dev 2020-05-19 22:59:13 +00:00
Alistair Delva
ac8027eed5 Expand virtio_block check to other virtual devices am: ff1fc9bc41
Change-Id: I2eda581574e0adecf1617624a66af92b540c35c4
2020-05-16 01:47:58 +00:00
Alistair Delva
ff1fc9bc41 Expand virtio_block check to other virtual devices
The Android Emulator isn't the only virtual device the virtio-block
detection code is useful for, and those platforms might not set any
discriminating properties to indicate that they are virtual.

Rework the virtio-block major detection to use /proc/devices instead
of hardcoding the assumption that any virtual platform can have
virtio-block at any experimental major; the new code permits only the
exact experimental major assigned to virtio-block.

The new code runs everywhere, but it will only run once and could be
expanded later to detect dynamic or experimental majors.

Bug: 156286088
Change-Id: Ieae805d08fddd0124a397636f04d99194a9ef7e5
2020-05-15 17:00:44 -07:00
TreeHugger Robot
08b5b882d6 Merge "Mount storage Android/data and Android/obb as tmpfs in app namespace" into rvc-dev am: dbc0da396a
Change-Id: Ib19a8ab5fc09b138b2dae8b1db2003127d277f10
2020-05-13 14:27:17 +00:00
TreeHugger Robot
dbc0da396a Merge "Mount storage Android/data and Android/obb as tmpfs in app namespace" into rvc-dev 2020-05-13 14:17:04 +00:00
Satoshi Niwa
198657d332 Revert "ARC++ swap for AppFuseUtil" am: 58d4044082
Change-Id: I46e6d976324d956b1ad173ba8ed97de760999451
2020-05-13 14:00:54 +00:00
Satoshi Niwa
58d4044082 Revert "ARC++ swap for AppFuseUtil"
This reverts commit ab7c958cc5.

Reason for revert: ARC is migrating to ARCVM on R, which doesn't use AppFuse any more.

Bug: 110379912
Test: m
Change-Id: Icc827c59530274421e4c94789d96fd3d287e591e
2020-05-12 14:43:42 +00:00
Ricky Wai
e96b34fe82 Mount storage Android/data and Android/obb as tmpfs in app namespace
So Android/data and Android/obb won't be accessing fuse anymore,
and apps should not see other packages as well as it's sandboxed
the tmpfs.

Bug: 155462341
Test: atest AppDataIsolationTests pass after feature flag is on
Change-Id: I5658440772e669c1235d318f708a3d336523754f
2020-05-07 16:01:33 +01:00
Martijn Coenen
2e05806850 Introduce postMount() VolumeBase helper. am: 5ec8658abc
Change-Id: Id8ce7dbaabafef41121dbdf9f6169f1377ae1174
2020-05-06 09:29:56 +00:00
Martijn Coenen
5ec8658abc Introduce postMount() VolumeBase helper.
When we're mounting a private volume, we create stacked emulated volumes
on top of it. Due to the ordering there, we would broadcast the emulated
volumes being created *before* the "mounted" status update. This in turn
could cause us to try and mount these emulated volumes before the
underlying private volume is really mounted. This is problematic in
particular on devices that support a filesystem keyring, where we need
to do some additional setup before the devices can be used.

While we could modify StorageManagerService to delay the mount, a safer
fix at this stage of the release is to just fix the ordering of these
events. To achieve that, add a simple postMount() helper, that is called
after a succesful mount. This allows us to setup the volume properly
before trying to mount any stacked volumes.

Bug: 151079464
Test: atest AdoptableHostTest
Change-Id: I2cc4113d4d71d89aa629bb9c0fa9be441355c079
2020-05-04 15:09:32 +02:00
Yurii Zubrytskyi
12ffb988c2 [incfs] Use new IncFs_ReleaseControlFds() instead of duping am: fc7b6697b4
Change-Id: Ieff848e641fe40d7a199e460f327ef8aba041dae
2020-04-23 21:56:23 +00:00
Yurii Zubrytskyi
fc7b6697b4 [incfs] Use new IncFs_ReleaseControlFds() instead of duping
Vold needs to pass / accept IncFs control via Binder, so it
neeeds to get and put its internal FDs in and out. Using the new
release() function it works without extra fd duping

Bug: 153704006
Test: builds & boots
Change-Id: I64bc5b1ca9f2c69e34c3a860ed3edbe58bd9ea29
2020-04-22 23:26:32 -07:00
Nikita Ioffe
a2596ddf5e Merge "Introduce ro.crypto.uses_fs_ioc_add_encryption_key property" into rvc-dev am: 4e1e7ef09a
Change-Id: I1d4f16c45ac8082ae5c6aa7216a4636a32e0c0b7
2020-04-21 14:44:12 +00:00
Nikita Ioffe
4e1e7ef09a Merge "Introduce ro.crypto.uses_fs_ioc_add_encryption_key property" into rvc-dev 2020-04-21 14:27:18 +00:00
Martijn Coenen
fcabee6875 Merge "Don't do private app-dir permissions/quota on public volumes." into rvc-dev am: 15070b1833
Change-Id: I5b5d4b3f8b8b3ed94264eb79261097b1b93f53a2
2020-04-21 12:41:54 +00:00
Martijn Coenen
15070b1833 Merge "Don't do private app-dir permissions/quota on public volumes." into rvc-dev 2020-04-21 12:22:58 +00:00
TreeHugger Robot
95d66bc103 Merge "Bind mount install and android writable DATA and OBB dirs" into rvc-dev am: 086c96ef6d
Change-Id: I227d66a376dad24ca40612849fa8259ba4dd0aae
2020-04-21 11:24:14 +00:00
TreeHugger Robot
086c96ef6d Merge "Bind mount install and android writable DATA and OBB dirs" into rvc-dev 2020-04-21 11:08:07 +00:00
Nikita Ioffe
78f806198f Introduce ro.crypto.uses_fs_ioc_add_encryption_key property
Bug: 154327249
Test: adb shell getprop ro.crypto.uses_fs_ioc_add_encryption_key
Test: adb bugreport && checked content contains new property
Change-Id: I562df49deffdccdb2cfd657130fc05b24d40a6a6
2020-04-20 22:21:49 +01:00
Ricky Wai
ef63921f81 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
2020-04-20 15:06:58 +01:00
Martijn Coenen
bf205ab7d4 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
2020-04-20 15:20:09 +02:00
Martijn Coenen
3426c36540 Rename casefold/projectid properties (for f2fs). am: e9239f757e
Change-Id: I6829424a1ecee05ef8784159789a3a9991d897be
2020-04-17 14:40:56 +00:00
Martijn Coenen
f417e12e56 Rename casefold/projectid properties. am: aee6b6fccd
Change-Id: I43a490414c4bd816edb707ba350b4ee151133f8f
2020-04-17 08:10:36 +00:00
Martijn Coenen
e9239f757e Rename casefold/projectid properties (for f2fs).
According to property naming guidelines.

Bug: 152170470
Bug: 153525566
Test: N/A
Change-Id: Iad1caff6e5cfb7f6a09b77532d64a24de9b0b3c6
2020-04-16 10:18:36 +02:00
Martijn Coenen
aee6b6fccd Rename casefold/projectid properties.
According to property naming guidelines.

Bug: 152170470
Bug: 153525566
Test: N/A
Change-Id: Iaebff2a835288839a2faf0edbe0e47ceb96b4458
Merged-In: Iaebff2a835288839a2faf0edbe0e47ceb96b4458
2020-04-16 10:18:30 +02:00
TreeHugger Robot
a46dc6fe7a Merge "Choose options format using property" into rvc-dev am: 0fbd0c1542
Change-Id: I2d891dd6a28c8f599b68a5df840d0d331fc1c440
2020-04-08 00:24:40 +00:00
TreeHugger Robot
0fbd0c1542 Merge "Choose options format using property" into rvc-dev 2020-04-08 00:10:59 +00:00
Paul Crowley
4073c0b524 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: f56d553bab
Merged-In: Ib51071b7c316ce074de72439741087b18335048c
Change-Id: Ib51071b7c316ce074de72439741087b18335048c
2020-04-07 07:35:16 -07:00
Alex Buynytskyy
5cbdc3153c Additional operation check when enabling read logs. am: 605a44fe93
Change-Id: I6b91438709189302d4afe64d3d5dfe28fadd513d
2020-04-04 04:08:31 +00:00
Alex Buynytskyy
605a44fe93 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
2020-04-03 18:42:04 -07:00
Linus Tufvesson
c00e508709 Replace EnsureDirExists with a call to setupAppDir am: 75973cb0dd
Change-Id: I58cb29e233e98b588a2e66797bd260b548059ca2
2020-04-03 13:28:11 +00:00
Linus Tufvesson
75973cb0dd 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
2020-04-03 10:29:51 +00:00
Alex Buynytskyy
19e3a19d75 Merge "Checking LOADER_USAGE_STATS before enabling read logs." into rvc-dev am: 6ce90ced12
Change-Id: Ib92de641097b748c417e0d4dfdc21213da7fd789
2020-04-02 00:48:13 +00:00
Alex Buynytskyy
6ce90ced12 Merge "Checking LOADER_USAGE_STATS before enabling read logs." into rvc-dev 2020-04-02 00:36:26 +00:00