Commit graph

5163 commits

Author SHA1 Message Date
Zim
817f224fb4 Abort FUSE as part of volume reset
This fixes a bug in Android T where MediaProvider leaked FUSE fds in
it's process preveventing it from dying after being killed. This
resulted in the MP in a zombie state.

Even though, this bug was more prevalent in Android T due to a change
in the Parcel lifecycle (see b/233216232), this bug could have always
occurred in theory.

This fix should be harmless since after volume reset, all FUSE volumes
should be unmounted and aborting the FUSE connections will either
no-op or actually prevent the FUSE daemon from getting wedged in a
zombie state.

Test: Manually trigger a FUSE fd leak in the MediaProvider, kill it
and verify that it is restarted without zombie.
Bug: 233216232
Bug: 231792374
Bug: 230445008
Change-Id: I9e559a48b9a72e6ecbc3a277a09ea5d34c9ec499
2022-05-20 09:33:12 +00:00
Daeho Jeong
c0de6d8184 Merge changes from topic "change_period"
* changes:
  vold: remove overprovision area from free segments
  vold: do not set gc sleep time with zero dirty segments
  vold: add gc period in setGCUrgentPace
2022-03-25 22:26:12 +00:00
Daeho Jeong
3ccdeb3fbb vold: remove overprovision area from free segments
overprovision space and reserved area should be subtracted when we
calculate free segments count in GC for data blocks.

Test: check Vold setGCUrgentPace log
Bug: 202283480
Bug: 181079477
Signed-off-by: Daeho Jeong <daehojeong@google.com>
Change-Id: I7b749588ff794ff0429e17a787d83bcc19af0ec1
2022-03-25 10:06:13 -07:00
Treehugger Robot
203ad70aa2 Merge "Add vold to hwasan-postsubmit" 2022-03-24 09:56:09 +00:00
Treehugger Robot
fa9165f07b Merge "Use make_f2fs -g android by default" 2022-03-23 20:33:51 +00:00
Jaegeuk Kim
2b8957dce6 Use make_f2fs -g android by default
It enables encrypt, proejct_quota, verity by default.

Bug: 225401790
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
Change-Id: I6c6dc81b8e62b20b0107d40a9ed5b645cdafbda1
2022-03-22 17:54:40 -07:00
Eric Biggers
d420cae64e Merge "Increase early boot logging to kernel log" 2022-03-22 17:44:07 +00:00
Eric Biggers
66d13bd28c Merge "Remove FDE methods from binder interface" 2022-03-22 17:37:32 +00:00
Shikha Malhotra
8acf8298f9 Merge "Enable ProjectID for the file systems by default." 2022-03-22 16:32:40 +00:00
Eric Biggers
fb486660ca Increase early boot logging to kernel log
Make vold log warnings and errors to the kernel log until both
init_user0 has run and /data is mounted.  Previously it only logged
errors, and not warnings, to the kernel log until /data is mounted.

This is helpful to diagnose failures of init_user0, since adb still
isn't started by that point.

Also, error messages can be misleading without seeing related warning
messages, e.g. the following which is expected on many devices:

    E vold    : keystore2 Keystore generateKey returned service specific error: -67
    W vold    : Failed to generate rollback-resistant key.  This is
                expected if keystore doesn't support rollback
                resistance.  Falling back to non-rollback-resistant key.

Therefore, increase the log level to WARNING and above.

Test: Intentionally broke fscrypt_init_user0(), then verified that the
      error and warning messages appear in the kernel log on Cuttlefish.
Bug: 205314634
Bug: 222540970
Change-Id: Ia751f7c88cbf28caf81e891a518953cc0cee911e
2022-03-22 00:33:52 +00:00
Samiul Islam
fda93c9f31 Merge "Create misc_ce and misc_de directories on /mnt/expand" 2022-03-21 12:01:54 +00:00
Eric Biggers
b3ea454002 Remove FDE methods from binder interface
Now that none of these methods are used anymore, we can remove them.
Also remove the related constants.

Bug: 208476087
Change-Id: I1f56c8e05fb3fba09aab4bf5f8609b0f552b8999
2022-03-21 05:11:21 +00:00
Daeho Jeong
0b5f397e2b vold: do not set gc sleep time with zero dirty segments
When there is not enough dirty segments to reclaim, we don't have to set
gc sleep time.

Test: Run smart idle maint with zero dirty segments
Bug: 202283480
Bug: 181079477
Signed-off-by: Daeho Jeong <daehojeong@google.com>
Change-Id: If6a9965ecb9b1a91bf5d0dd763d5fa0af63348e0
2022-03-18 21:30:47 -07:00
Treehugger Robot
10ca7def20 Merge changes from topic "metadata_encryption_options"
* changes:
  Rename FstabEntry::metadata_encryption to metadata_encryption_options
  Fix check for whether metadata encryption is enabled
2022-03-19 04:12:05 +00:00
Treehugger Robot
aadef5cd8a Merge "Replace an outdated TODO in Keystore::exportKey" 2022-03-19 03:53:45 +00:00
Florian Mayer
11d45326d9 Add vold to hwasan-postsubmit
Test: Run tests under HWASan.
Bug: 193568145
Change-Id: I03e7506f932cb42a91261bd1c28f3d7f60dd5f1e
2022-03-18 14:25:02 -07:00
Daeho Jeong
7c788fc3e9 vold: add gc period in setGCUrgentPace
To make gc period changable, added a new gcPeriod parameter to
setGCUrgentPace.

Test: adb shell device_config put storage_native_boot smart_idle_maint_period 10
Bug: 202283480
Bug: 181079477
Signed-off-by: Daeho Jeong <daehojeong@google.com>
Change-Id: I4e44a80ea5b51d9a7cde69d25e129dd0673b271f
2022-03-18 12:56:17 -07:00
Mohammad Samiul Islam
e833630eb7 Create misc_ce and misc_de directories on /mnt/expand
We want to store sdk data on the same volume as app data. Since sdk data
is stored in misc_ce and misc_de directory, we need to ensure they exist
on adopted storage mounted at /mnt/expand/<volume-uuid>.

This CL creates `/mnt/expand/<volume-uuid>/misc_{ce,de}` directories
when disk is mouted and then when user storage is prepared, the sdk root
directory is created.

By having these directories, we can now move the sdk data to other
volume when app data is moved.

Bug: b/222034645
Test: atest SdkSandboxStorageHostTest (see ag/17120883)
Ignore-AOSP-First: End to end test added which exists in internal branch
    only. Will cherry-pick this CL to aosp standalone once it is safely
    merged to internal branch.
Change-Id: I0e73d9ce105abec4b77c378cde58aa7365258f01
Merged-In: I0e73d9ce105abec4b77c378cde58aa7365258f01
(cherry picked from commit b459591fd1)
2022-03-18 11:11:22 +00:00
Eric Biggers
41d7843513 Rename FstabEntry::metadata_encryption to metadata_encryption_options
There have been two bugs where people use !metadata_encryption.empty()
to check whether metadata encryption is enabled.  It should actually be
!metadata_key_dir.empty(), since 'metadata_encryption' is the encryption
options, which can be empty if the defaults are sufficient.

Rename the field in FstabEntry appropriately.

To avoid breaking fstab files, don't rename the flag in the fstab file
itself.  So, now the fstab flags map to FstabEntry fields as follows:

    keydirectory => metadata_key_dir
    metadata_encryption => metadata_encryption_options

Change-Id: I3b5e28c273950bcf13bfd433aaaa49d1e92e177c
2022-03-17 23:21:16 +00:00
Eric Biggers
f14f8627bb Fix check for whether metadata encryption is enabled
metadata_key_dir controls whether metadata encryption is enabled, not
metadata_encryption which is just the encryption options and can be
empty if the default options are sufficient.

Bug: 198405417
Fixes: 156d9d2293 ("Pre-create userdata metadata encryption device.")
Change-Id: I98ee253c7e5e738ee087ec07ed60f4a376ca7cee
2022-03-17 23:17:33 +00:00
Eric Biggers
3aa35ee431 Replace an outdated TODO in Keystore::exportKey
The bug this TODO references has been closed, so replace the TODO with
an explanation of why the code is correct.

Bug: 185811713
Change-Id: I8f4230ab3e290f8ffa8ca25aaa188e8d7156cf8e
2022-03-17 22:39:19 +00:00
Daeho Jeong
119b9ae8a5 Merge "vold: switch f2fs gc_urgent_high to gc_urgent_mid" 2022-03-16 21:33:23 +00:00
Daeho Jeong
5e879421a3 vold: switch f2fs gc_urgent_high to gc_urgent_mid
We need to reduce F2FS GC intensity for smart idle maintenance service
not to interfere with other I/O activities.

Test: check smart idle maintenance log every hour
Bug: 202283480
Bug: 181079477
Signed-off-by: Daeho Jeong <daehojeong@google.com>
Change-Id: Ideb1641a1539a23828bc8b00d9739c8128a984c0
2022-03-15 21:42:55 -07:00
Eric Biggers
e7dbc48584 Merge "Remove HardwareAuthToken parameters from binder interface" 2022-03-15 21:33:26 +00:00
Treehugger Robot
1faebba8c9 Merge "Disable fuse-bpf" 2022-03-15 15:40:11 +00:00
Eric Biggers
90a305232e Remove HardwareAuthToken parameters from binder interface
These are no longer used.

Test: atest com.android.server.locksettings
Bug: 184723544
Change-Id: I6160d30deb138a5366532de84cbf6f02cbc69b8c
(cherry picked from commit 5bb9faab49)
Merged-In: I6160d30deb138a5366532de84cbf6f02cbc69b8c
2022-03-15 01:26:08 +00:00
Paul Lawrence
d88e4682e3 Disable fuse-bpf
ag/17002484 does not disable fuse-bpf as hoped when the device has once
booted with fuse-bpf enabled, since the persistent property persists

Change name of property as read to disable feature regardless of current
state

Bug: 221892618
Test: fuse-bpf is disabled even if persist.sys.fuse.bpf.enable is true
Change-Id: I423d05d24809b097d02ca5845ab16283edc953b0
Merged-In: I423d05d24809b097d02ca5845ab16283edc953b0
2022-03-14 11:12:49 +00:00
Treehugger Robot
c1b4ce01f8 Merge "vdc: remove FDE commands" 2022-03-11 00:03:48 +00:00
Eric Biggers
b140eba44d vdc: remove FDE commands
Remove the "enablecrypto" and "mountdefaultencrypted" commands, since
they aren't used anymore.  These were specific to FDE, for which support
has been removed.

Bug: 208476087
Change-Id: I2045488034dca46a97e50c5124182375691d09f9
2022-03-10 22:44:22 +00:00
Treehugger Robot
536beac4bd Merge "Remove unused function UnmountTreeWithPrefix()" 2022-03-10 22:00:46 +00:00
Treehugger Robot
a10ce5db7d Merge "Stop using -Wno-missing-field-initializers" 2022-03-10 21:45:31 +00:00
Treehugger Robot
8a73bf6710 Merge "Stop using -Wno-unused-variable" 2022-03-10 21:40:02 +00:00
Eric Biggers
b5f688aaeb Remove unused function UnmountTreeWithPrefix()
Change-Id: I6940498e4d6269dfcb78cab75bf56d1d545dd784
2022-03-10 20:31:51 +00:00
Eric Biggers
4e152c1c1d Stop using -Wno-missing-field-initializers
There aren't actually any instances of this warning, so just stop
disabling this warning.

Change-Id: I3e810ab2b478851e0651e71b9fda109be70c3cc7
2022-03-10 20:19:46 +00:00
Eric Biggers
0d12fd668d Stop using -Wno-unused-variable
This is a useful warning, so remove two unused variables and stop
disabling this warning.

Change-Id: I3efe0b300ea139ea11d645dec6fb2613acc0e51b
2022-03-10 20:17:23 +00:00
Eric Biggers
8bf0d914df Merge "Remove progress property support from encrypt_inplace()" 2022-03-09 22:39:37 +00:00
Eric Biggers
640a1a9f43 Remove progress property support from encrypt_inplace()
Now that FDE support has been removed, encrypt_inplace() is only used by
metadata encryption, which passes false for the set_progress_properties
parameter.  Therefore, remove the set_progress_properties parameter and
the associated code to update the "vold.encrypt_inplace" and
"vold.encrypt_time_remaining" system properties.

Note that encrypt_inplace() still keeps track of its progress to some
extent, for the purpose of printing log messages; that hasn't changed.

Bug: 208476087
Change-Id: If695db1c4e23f568ff865bccc9fc1b98148815be
2022-03-09 21:03:52 +00:00
Samiul Islam
1e1bade6ff Merge changes I72734267,I66ef7a72 am: 6ace0c8ba0
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2005652

Change-Id: I23ecce1614673146253c000c71701e32c2d9e10c
2022-03-07 15:24:13 +00:00
Samiul Islam
17eca61449 Create root directory for supplemental data during user creation am: a6f36ae8d0
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2005651

Change-Id: Ie7c16c5562932432818ac138abbfce9aa4cb90a6
2022-03-07 15:24:11 +00:00
Samiul Islam
6ace0c8ba0 Merge changes I72734267,I66ef7a72
* changes:
  Rename SupplementalProcess to SdkSandbox
  Create root directory for supplemental data during user creation
2022-03-07 15:03:18 +00:00
Eric Biggers
b643247502 Merge "Remove broken code for mounting encrypted OBB files" am: 74d9fb9757
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2003210

Change-Id: Iebc830bc01a54ce1292cf98f5c7905adcea55b5f
2022-03-04 21:27:43 +00:00
Eric Biggers
74d9fb9757 Merge "Remove broken code for mounting encrypted OBB files" 2022-03-04 20:58:13 +00:00
Nikita Ioffe
d302608a07 Rename SupplementalProcess to SdkSandbox
Ignore-AOSP-First: code not in AOSP yet
Bug: 220320098
Test: presubmit
Change-Id: I727342675f6817d4dced431b4ef57e909c02eb5a
Merged-In: I727342675f6817d4dced431b4ef57e909c02eb5a
(cherry picked from commit bad7cd0fd7)
2022-03-02 16:11:26 +00:00
Samiul Islam
a6f36ae8d0 Create root directory for supplemental data during user creation
In order to store supplemental data for apps, we want to create a root
directory at location `/data/misc_ce/<user-id>/supplmental` and
`/data/misc_de/<user-id>supplemental`. These directories will then host
supplemental data for each app based on package name, e.g,
`/data/misc_ce/0/supplemental/<app-name>`.

Since these are sub-directories of misc directory, vold should prepare
them for consistency.

Bug: 217543371
Test: atest SupplementalProcessStorageHostTest
Test: see ag/16681989
Ignore-AOSP-First: Feature is being developed in internal branch
Change-Id: I66ef7a7241c9f82cecedaeb6c9a91f127668300a
Merged-In: I66ef7a7241c9f82cecedaeb6c9a91f127668300a
(cherry picked from commit 0cf90d7ca0)
2022-03-02 14:14:41 +00:00
Eric Biggers
7e79a43a72 Remove broken code for mounting encrypted OBB files
Mounting encrypted OBB files has never worked reliably across devices,
partly due to its reliance on Twofish encryption support in the kernel.
This is because Twofish support (CONFIG_CRYPTO_TWOFISH) has never been
required or even recommended for Android.  It has never been enabled in
GKI, but even before GKI it wasn't required or recommended.  Moreover,
this is now the only Android feature that still uses dm-crypt
(CONFIG_DM_CRYPT), and some devices don't have that enabled either.

Therefore, it appears that this feature is unused.  That's perhaps not
surprising, considering that the documentation for OBBs
(https://developer.android.com/google/play/expansion-files) says that
they are deprecated, and also it explains OBBs as being app files that
are opaque to the platform; the ability of the platform to mount OBBs
that happen to be in a particular format is never mentioned.  That means
that OBB mounting is probably rarely used even with unencrypted OBBs.
Finally, the usefulness of OBBs having their own encryption layer (in
addition to what the platform already provides via FBE) is not clear
either, especially with such an unusual choice of cipher.

To avoid the confusion that is being caused by having the broken code
for mounting encrypted OBBs still sitting around, let's remove it.

Test: atest StorageManagerTest # on Cuttlefish
Test: atest StorageManagerIntegrationTest # on Cuttlefish
Bug: 216475849
Change-Id: Iaef32cce90f95ea745ba2b143f89e66f533f3479
2022-03-01 21:19:18 +00:00
Xin Li
891a5f7c8d Empty merge of sc-v2-dev-plus-aosp-without-vendor@8084891
Bug: 214455710
Merged-In: I012cfb9b01e5d21ec71700c3c52ac9c096cd1a90
Change-Id: I67f80ee94d0f1f273ef49aa45ea0e4674311892b
2022-02-11 06:17:38 +00:00
Shikha Malhotra
f7bc4958c4 Enable ProjectID for the file systems by default.
This is in conjunction with enabling the project id for internal directories. The check whether project ids should be used or not, is done in installd process. If they cannot be used, then the installd process falls back to previous approaches.

Bug: b/215154615
Test: atest installd/StorageHostTest
Test: atest installd/installd_service_test.cpp
Change-Id: I2c6672640295ebbc5ec78075290fc8e8703384ef
2022-02-04 15:32:31 +00:00
Treehugger Robot
98fc484581 Merge "[vold] Check incremental paths before mounting" am: 537b76cd98
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1966063

Change-Id: I6b3a1e77b153ea5d5180cd1210bfdb4e91d9aaf2
2022-02-01 01:45:30 +00:00
Treehugger Robot
537b76cd98 Merge "[vold] Check incremental paths before mounting" 2022-02-01 01:29:12 +00:00
Yurii Zubrytskyi
18eb877246 [vold] Check incremental paths before mounting
Vold was trusting system_server too much and allowed for pretty
much any path in mount()/bindMount() calls for incremental.
This CL adds validation to make sure it's only accessing own
directories. This includes enforcing no symlinks in the paths

Bug: 198657657
Bug: 216722132
Test: manual
Change-Id: I6035447f94ef44c4ae3294c3ae47de2d7210683a
Merged-In: I6035447f94ef44c4ae3294c3ae47de2d7210683a
2022-01-31 22:13:14 +00:00