Commit graph

3748 commits

Author SHA1 Message Date
Eric Biggers
09b9cae24d [automerger skipped] vold: only allow emmc_optimized on eMMC storage am: 006eed8e3a -s ours
am skip reason: Change-Id Ie27b80658db53b1a4207b3cbb4e309d05130812e with SHA-1 eb566d0a7c is in history

Original change: https://googleplex-android-review.googlesource.com/c/platform/system/vold/+/12098822

Change-Id: Id8c90f1833a171c12936a5f4aa2bf80574f5cb64
2020-07-08 00:22:58 +00:00
Eric Biggers
09f789e227 Merge "vold: only allow emmc_optimized on eMMC storage" am: 428ae6e90a am: 7a1c4ccb96
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1356175

Change-Id: Ie124c2cec8e4235ae999463d5c03615880e0c01e
2020-07-07 17:37:34 +00:00
Eric Biggers
7a1c4ccb96 Merge "vold: only allow emmc_optimized on eMMC storage" am: 428ae6e90a
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1356175

Change-Id: I95f471e6a2a96929b1ff854cac195b68e86309f3
2020-07-07 17:24:35 +00:00
Eric Biggers
006eed8e3a vold: only allow emmc_optimized on eMMC storage
The emmc_optimized encryption flag is specifically designed for the
limitations of inline encryption hardware that follows the eMMC
standard.  It isn't appropriate to use on other types of storage.
So, make vold enforce that it's not used on other types of storage.

Bug: 160639344
Test:
  - Enabled emmc_optimized on Cuttlefish and verified it no longer boots
  - Using a modified version of this change, verified that
    IsEmmcStorage() works as expected on various devices including
    Cuttlefish, Cuttlefish booted in GSI image mode, a device with eMMC
    storage, and a device with UFS storage.
  - Verified that VtsKernelEncryptionTest still passes
Change-Id: Ie27b80658db53b1a4207b3cbb4e309d05130812e
Merged-In: Ie27b80658db53b1a4207b3cbb4e309d05130812e
2020-07-07 10:08:22 -07:00
Eric Biggers
428ae6e90a Merge "vold: only allow emmc_optimized on eMMC storage" 2020-07-07 17:07:58 +00:00
Eric Biggers
eb566d0a7c vold: only allow emmc_optimized on eMMC storage
The emmc_optimized encryption flag is specifically designed for the
limitations of inline encryption hardware that follows the eMMC
standard.  It isn't appropriate to use on other types of storage.
So, make vold enforce that it's not used on other types of storage.

Bug: 160639344
Test:
  - Enabled emmc_optimized on Cuttlefish and verified it no longer boots
  - Using a modified version of this change, verified that
    IsEmmcStorage() works as expected on various devices including
    Cuttlefish, Cuttlefish booted in GSI image mode, a device with eMMC
    storage, and a device with UFS storage.
  - Verified that VtsKernelEncryptionTest still passes
Change-Id: Ie27b80658db53b1a4207b3cbb4e309d05130812e
2020-07-06 19:11:43 -07:00
Martijn Coenen
bb8a543e43 Configure backing device max_ratio for FUSE filesystems. am: a485006ab1
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/vold/+/12024019

Change-Id: I5cd116bfb01b0fe98dfdcd7d4b8005819ccfeb11
2020-06-30 09:57:21 +00:00
Martijn Coenen
a485006ab1 Configure backing device max_ratio for FUSE filesystems.
By default FUSE filesystems have a max_ratio of 1%, meaning only 1% of
dirty pages on the system can belong to a FUSE filesystem before we
start writing back pages (and throttling, if writeback can't keep up).
This limit is useful for untrusted filesystems, but in our case, we
trust the FUSE filesystem. Since FUSE writes result in writes to the
lower filesystem, FUSE should take at most 50%. Let's start with
changing max_ratio to 40%, to avoid needless throttling.

Bug: 159254170
Bug: 159770752
Test: inspect /sys/class/bdi manually after boot
Change-Id: I467e3770fc4afba0a08fa480c0b86aa054c8b875
2020-06-30 10:16:55 +02:00
Zim
c1f45db6e1 Unmount public volume if FUSE mount fails am: f71707916f
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/vold/+/11900947

Change-Id: Ie390d39ede3dbd63012b0c5acdbcac57e0143145
2020-06-22 16:53:26 +00:00
Zim
f71707916f Unmount public volume if FUSE mount fails
Sometimes, during early boot, a public volume may be created before
the user is unlocked and the mount may fail. This mount failure does
not revert the lower fs mounts (sdcardfs and vfat). Subsequent
mount attempts will then fail because we'd attempt to mount vfat on
already mounted /mnt/media_rw/<volname>

Bug: 158489548
Test: Resilient to an artificial sleep in
StorageManagerService#completeUnlockUser to
delay user unlock longer than public volume mount

Change-Id: I9a1574596434a2eb6b2553c0c9220c2118c7e4fd
2020-06-22 14:26:57 +01:00
David Anderson
f1353b9ec4 [automerger skipped] Merge "Add an isCheckpointing() binder call for adb remount." into rvc-dev am: f87198e025 -s ours
am skip reason: Change-Id I33a691da3b99343acfc1e8ddf68a14504c3bfbe1 with SHA-1 23850d30f6 is in history

Original change: https://googleplex-android-review.googlesource.com/c/platform/system/vold/+/11917729

Change-Id: I324e156e155f361491f963518f69a956ac23dd7f
2020-06-19 20:21:48 +00:00
David Anderson
f87198e025 Merge "Add an isCheckpointing() binder call for adb remount." into rvc-dev 2020-06-19 20:04:54 +00:00
David Anderson
7e07c53aab Add an isCheckpointing() binder call for adb remount.
This is needed so "adb remount" can avoid writing to /data during a
checkpoint.

Bug: 157540389
Test: manual test
Change-Id: I33a691da3b99343acfc1e8ddf68a14504c3bfbe1
Merged-In: I33a691da3b99343acfc1e8ddf68a14504c3bfbe1
2020-06-18 16:04:36 -07:00
TreeHugger Robot
c6e83ca68d [automerger skipped] Merge "Don't call block checkpoint functions above dm-default-key" into rvc-dev am: 14d4e7c7df -s ours
am skip reason: Change-Id Ic15fadc67d306463dd0b554f679306d8f9081451 with SHA-1 3fe931109c is in history

Original change: https://googleplex-android-review.googlesource.com/c/platform/system/vold/+/11886461

Change-Id: I4559e77b9ea60cf49f4824dc93a6a6141b9fb94b
2020-06-18 22:36:16 +00:00
TreeHugger Robot
14d4e7c7df Merge "Don't call block checkpoint functions above dm-default-key" into rvc-dev 2020-06-18 22:22:58 +00:00
Paul Lawrence
ebc8801fb3 Merge "Don't call block checkpoint functions above dm-default-key" am: 1bb7e8a928 am: 53f1d07339
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1330879

Change-Id: I54fdd3098c52dcb53cee0956f4dd1e43e09f5800
2020-06-18 22:16:14 +00:00
David Anderson
026ae1a9ac Merge "Add an isCheckpointing() binder call for adb remount." am: b50480bb96 am: 60e41b7084
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1330854

Change-Id: I0aa0536cfd33f189525115efa07e49930f53b79a
2020-06-18 22:15:56 +00:00
Paul Lawrence
53f1d07339 Merge "Don't call block checkpoint functions above dm-default-key" am: 1bb7e8a928
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1330879

Change-Id: Ifa48af749baa5d50c7459dbb5bda1573d847b622
2020-06-18 22:00:47 +00:00
David Anderson
60e41b7084 Merge "Add an isCheckpointing() binder call for adb remount." am: b50480bb96
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1330854

Change-Id: I14674da2b3cf86c09179b94e28e76fec30378e12
2020-06-18 22:00:37 +00:00
Paul Lawrence
67f9044ab5 Don't call block checkpoint functions above dm-default-key
Bug: 156225476
Test: Build for f2fs and ext4 device, make sure checkpoints roll back
and commit

Merged-In: Ic15fadc67d306463dd0b554f679306d8f9081451
Change-Id: Ic15fadc67d306463dd0b554f679306d8f9081451
2020-06-18 21:58:32 +00:00
Paul Lawrence
1bb7e8a928 Merge "Don't call block checkpoint functions above dm-default-key" 2020-06-18 21:56:10 +00:00
David Anderson
b50480bb96 Merge "Add an isCheckpointing() binder call for adb remount." 2020-06-18 21:45:21 +00:00
Nikita Ioffe
356baaa10a 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: I90e3ab660ddb356bd7c0212e188b997f6bfa07d4
2020-06-17 16:53:30 +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
53b6f32850 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: Icbff1ee04a5f79582e92d5fa8ed8913260cc417f
2020-06-17 07:01:58 +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
Paul Lawrence
3fe931109c Don't call block checkpoint functions above dm-default-key
Bug: 156225476
Test: Build for f2fs and ext4 device, make sure checkpoints roll back
and commit

Change-Id: Ic15fadc67d306463dd0b554f679306d8f9081451
2020-06-12 09:13:42 -07:00
David Anderson
23850d30f6 Add an isCheckpointing() binder call for adb remount.
This is needed so "adb remount" can avoid writing to /data during a
checkpoint.

Bug: 157540389
Test: manual test
Change-Id: I33a691da3b99343acfc1e8ddf68a14504c3bfbe1
2020-06-10 23:52:25 -07:00
Treehugger Robot
3727ec993e [automerger skipped] Merge "Record use of metadata encryption in property" am: f20a16575f am: d49f8c9eb7 -s ours
am skip reason: Change-Id I400873ec207cb63f0407fefc83962bb3a927e294 with SHA-1 94abae03a9 is in history

Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1322598

Change-Id: Idf38f57a2370789e069846b6dc3e4b36cb80d9e4
2020-06-02 19:33:43 +00:00
Treehugger Robot
d49f8c9eb7 Merge "Record use of metadata encryption in property" am: f20a16575f
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1322598

Change-Id: I7b102707853ea2556c5a24858ae43ea5c2717616
2020-06-02 19:20:44 +00:00
Treehugger Robot
f20a16575f Merge "Record use of metadata encryption in property" 2020-06-02 19:04:12 +00:00
Paul Crowley
7fbd8d4474 Record use of metadata encryption in property
Bug: 152150018
Test: Cuttlefish with and without keydirectory option
Cherry-Picked-From: 94abae03a9
Merged-In: I400873ec207cb63f0407fefc83962bb3a927e294
Change-Id: I400873ec207cb63f0407fefc83962bb3a927e294
2020-06-02 11:16:55 -07:00
Martijn Coenen
eaca298077 Merge "vold: Support aborting FUSE connections." into rvc-dev am: cbb69e548a
Change-Id: I9f3435a686e76f9fbc8b8ec8cae33f5538a94ec5
2020-05-29 16:00:05 +00:00
Martijn Coenen
cbb69e548a Merge "vold: Support aborting FUSE connections." into rvc-dev 2020-05-29 15:47:05 +00:00
Abhijeet Kaur
e2e2b5499b FuseDaemonHostTest is migrated to CTS and renamed. am: de83802e41
Change-Id: I1e26192d3ae181bc3fd9bcb3f7bf56db0f073328
2020-05-29 15:07:04 +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
4835e936fc Move enabling sdcardfs behind a property am: f36bdddc7e
Change-Id: I8bf90ef649975d182787757d73f9e2b46389483f
2020-05-21 08:41:14 +00:00
Treehugger Robot
16cbb5a2c8 [automerger skipped] Merge "Handle virtio in private fs mapping" am: e471d11d46 am: d625abfda2 -s ours
am skip reason: Change-Id I0b41670d5f76b2506dad437917c2276f8e0aaccf with SHA-1 c671731075 is in history

Change-Id: Id73de89d4b905212935da4286ee50789b47695e6
2020-05-20 07:26:02 +00:00
Treehugger Robot
d625abfda2 Merge "Handle virtio in private fs mapping" am: e471d11d46
Change-Id: If088b875ff4cbca66fe9c6f9224b437edc85dae8
2020-05-20 07:08:04 +00:00
Treehugger Robot
e471d11d46 Merge "Handle virtio in private fs mapping" 2020-05-20 06:32:43 +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
9ec7ed5b11 Merge "Handle virtio in private fs mapping" into rvc-dev am: 0d1fcb90d6
Change-Id: Idfa020f7211187ddc9c530482de9a53d14ef315a
2020-05-20 04:44:06 +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
ea97154183 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
Merged-In: I0b41670d5f76b2506dad437917c2276f8e0aaccf
2020-05-20 00:45:02 +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
b2c448fa6d Merge "Record use of metadata encryption in property" into rvc-dev am: 09ff429e2a
Change-Id: I2e39a3e24ea8bf488ffb8e901fa6449175673b5c
2020-05-19 23:12:25 +00:00
Paul Crowley
09ff429e2a Merge "Record use of metadata encryption in property" into rvc-dev 2020-05-19 22:59:13 +00:00
Treehugger Robot
7c39a18450 [automerger skipped] Merge "Expand virtio_block check to other virtual devices" am: ff9975c04f am: edb596fc36 -s ours
am skip reason: Change-Id Ieae805d08fddd0124a397636f04d99194a9ef7e5 with SHA-1 ff1fc9bc41 is in history

Change-Id: I8e4c5e3a044f8305dd29820709e073687991e559
2020-05-16 05:27:30 +00:00