Commit graph

5772 commits

Author SHA1 Message Date
Eric Biggers
c6f004a9c4 Move encrypted directories into place already-encrypted
Even after having changed the SELinux policy to remove system_server's
permission to create directories like /data/system_ce/10, there's still
a very small loophole where system_server can create a subdirectory
after vold creates the directory but before vold assigns an encryption
policy to it.  This isn't known to have actually happened (b/285239971
was a candidate, but it seems to have actually been caused by SELinux
being in permissive mode), but it's theoretically possible.

Close this loophole by making vold create encrypted directories under
temporary names and move them into place once they are fully prepared.

Bug: 156305599
Bug: 285239971
Test: Cuttlefish boots, and can be rebooted.
Change-Id: I53407c938bab02ab4b7e5bab8402f36eb47fb203
2023-06-08 22:08:09 +00:00
Treehugger Robot
39f11368a5 Merge "vold: move some libs from shared to static" 2023-05-23 16:33:31 +00:00
Devin Moore
965d67ce6f vold: move some libs from shared to static
These libraries are only used by vold on a device and gain no
benifit from being included as shared libraries.

Moving them to static saves disk space, memory, and cpu cycles from the
dynamic linker.

Checking on cuttlefish accross 3 reboots:
This saves 613827 bytes of storage from the installed-files, 44KB of
private dirty memory, 172KB of PSS when only looking at the
libraries, and 155KB of PSS when looking at libraries and heap/stack
with shomap.

go/shared-to-static for more info on how this was determined.

Test: m
Bug: 280829178

Change-Id: I29af66dd66f4087ff1820ca661dc6dc2ace841fc
2023-05-23 00:37:02 +00:00
Pawan Wagh
a3e128a868 Merge "Disable leak detection in vold fuzzer" 2023-05-08 22:53:03 +00:00
Pawan Wagh
e7b16911cb Disable leak detection in vold fuzzer
Bug: 278100447
Bug: 277650211
Test: m vold_native_service_fuzzer
Change-Id: I90ecbdadde5bfcdc967d8b5b750f0e551f30acb0
2023-05-05 23:57:13 +00:00
Treehugger Robot
823898eca3 Merge "[vold] Add mount lazy if forcemount fail." 2023-04-25 10:32:16 +00:00
Steven Moreland
6c8b6e1651 Merge "Explicit init .rc user." 2023-04-11 21:33:30 +00:00
Steven Moreland
0eff1d2890 Explicit init .rc user.
Set the user explicitly.

Bug: 276813155
Test: boot
Change-Id: I54c14c47a3435d72e00280cf663f23ffbb9659ee
2023-04-10 20:54:26 +00:00
Daeho Jeong
13a57d2a26 Merge "vold: fix write kbytes handling" 2023-03-28 20:15:53 +00:00
Daeho Jeong
dd08c52eb8 vold: fix write kbytes handling
Since Android platform codespace doesn't support exception handling, we
use strtoll() instead of stoll for direct error handling.

Bug: 274369737
Test: check smart idle maintenace service log
Change-Id: I57c709b1e329228790e0a883edb64dc023135a24
2023-03-27 18:19:18 -07:00
Pawan Wagh
c1572fe8cf Merge "Set sehandle in voldFuzzer" 2023-03-16 07:28:40 +00:00
Pawan Wagh
25effc38ff Set sehandle in voldFuzzer
Bug: 271649747
Test: m vold_native_service_fuzzer && adb sync && adb shell data/fuzz/x86_64/vold_native_service_fuzzer/vold_native_service_fuzzer
Change-Id: I55a17ffd631b0b85e2fc049bffe9a91623699e64
2023-03-15 20:54:42 +00:00
Eric Biggers
60c71b9950 Merge "Avoid error message when destroying key w/o secdiscardable file" am: dc262c27f0
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2470460

Change-Id: I0259a28cc469a98149512f258751771f09112fda
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-03-04 06:30:21 +00:00
Eric Biggers
dc262c27f0 Merge "Avoid error message when destroying key w/o secdiscardable file" 2023-03-03 22:14:58 +00:00
Eric Biggers
73e2936fc2 Avoid error message when destroying key w/o secdiscardable file
Since commit 08f4bdfe98 ("Don't use a secdiscardable file for keys
encrypted by SP") (https://r.android.com/2242561), some keys don't use a
secdiscardable file.  Currently if such a key is destroyed, an ERROR
message like the following is logged:

    E secdiscard: Secure discard open failed for: /data/misc/vold/user_keys/ce/14/current/secdiscardable

This case is expected, so it should not be an ERROR.  Fix this by only
passing the secdiscardable file to the secdiscard program if it exists.

Bug: 232452368
Change-Id: I490289dfdaf0db6c3f4fb507509095e0033e2f69
2023-03-03 19:51:36 +00:00
Eric Biggers
0c7abb02e5 Merge "Check for SELinux labelling errors" am: 826eef6b33
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2465051

Change-Id: I55ae26d92455278fb9e687571392083c5859e4d9
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-03-02 19:14:42 +00:00
Eric Biggers
826eef6b33 Merge "Check for SELinux labelling errors" 2023-03-02 18:35:16 +00:00
Eric Biggers
c7c4f5a902 Check for SELinux labelling errors
It's essential that files created by vold get the correct SELinux
labels, so make sure to check for errors when setting them.

ENOENT (no label defined) is expected on some files such as
/mnt/appfuse/*, so allow ENOENT but log a DEBUG message.

This will help debug b/269567270.  This is not a fix for b/269567270.

Bug: 269567270
Test: Created user and checked SELinux labels of user's directories
Test: atest CtsBlobStoreHostTestCases
Change-Id: Ife005bdd896952653943c57336deb33456f7c5d8
2023-03-01 22:11:29 +00:00
Austin Delgado
9a4265cc20 Merge "Revert "Strictly check for SELinux labelling errors"" am: 545f0ab758
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2461593

Change-Id: Id02634939a86d6fb05b8a2762c4a6cb161ed7476
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-02-28 22:44:36 +00:00
Austin Delgado
545f0ab758 Merge "Revert "Strictly check for SELinux labelling errors"" 2023-02-28 22:05:45 +00:00
Austin Delgado
b0f997deae Revert "Strictly check for SELinux labelling errors"
This reverts commit 2ef4e85448.

Reason for revert: b/271157681

Change-Id: I7224fd68027e2e9824694171547b8b2c808f9923
2023-02-28 21:58:08 +00:00
Eric Biggers
d8bf3b2681 Merge "Strictly check for SELinux labelling errors" am: 5554b80afb
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2456274

Change-Id: I7c4ab5c3fdfbda22b24a8875915f3acfef1b8003
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-02-28 20:25:42 +00:00
Eric Biggers
5554b80afb Merge "Strictly check for SELinux labelling errors" 2023-02-28 19:31:24 +00:00
Eric Biggers
2ef4e85448 Strictly check for SELinux labelling errors
It's essential that files created by vold get the correct SELinux
labels, so make sure to check for errors when setting them.

This will help debug b/269567270.  This is not a fix for b/269567270.

Bug: 269567270
Test: Created user and checked SELinux labels of user's directories
Change-Id: I99e4d530a00f9401532c9cb0990df254b7a12a80
2023-02-27 21:01:25 +00:00
Eric Biggers
6f2860e3d1 Merge "Fix logspam when user removed before CE storage prepared" am: 481a5367a3
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2456268

Change-Id: I23d149b794f713a87b6af202eb3c843ce590db54
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-02-25 02:04:20 +00:00
Eric Biggers
481a5367a3 Merge "Fix logspam when user removed before CE storage prepared" 2023-02-24 22:40:59 +00:00
Eric Biggers
629c63414e Fix logspam when user removed before CE storage prepared
Due to frameworks/base commit 5c65b1ee1023 ("Don't prepare CE storage on
user creation") (http://ag/20241697), removing a user immediately after
creating it causes the user's directories to be destroyed before CE
storage was prepared.

Functionally this works fine; however, it causes some error messages to
be spammed to the log because 'vold_prepare_subdirs destroy' doesn't
like that /data/misc_ce/$userId and /data/vendor_ce/$userId don't exist.
vold_prepare_subdirs logs two error messages itself, but it also exits
with a failure status, which bubbles up and causes a Slog.wtf with a
stack trace in StorageManagerService.

Fix this by making rmrf_contents() simply return true if the directory
doesn't exist.

Bug: 232452368
Test: 'pm create-user 10 && pm remove-user 10' and check logcat
Change-Id: I867a915f4b25e1a5f0603fbd84680b673ff5eb96
2023-02-24 22:38:06 +00:00
Nathan Huckleberry
5c76dbd2b9 Merge "Clean up potential busy files after key eviction." am: eee1149800
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2448745

Change-Id: I8f821920d4d1e344741d90594e2a96b9e6ecc3ee
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-02-24 08:30:59 +00:00
Nathan Huckleberry
eee1149800 Merge "Clean up potential busy files after key eviction." 2023-02-24 08:18:07 +00:00
Nathan Huckleberry
a21962b207 Clean up potential busy files after key eviction.
There is a race condition between key eviction and killing user
processes.  The race condition is difficult to properly fix without
significantly degrading UI performance.

If the race condition occurs, decrypted filesystem data is left in
various kernel caches.  To mitigate, we try to ensure the caches are
flushed by evicting the keys again in a worker thread.

Test: Checked that the correct log messages appear when evicting a
user's keys
Bug: 140762419

Change-Id: I9e39e5bb0f5190284552bcd252b6213a22a51e91
2023-02-23 21:44:24 +00:00
Treehugger Robot
a38a2fa330 Merge "MetadataCrypt: extend timeout for low performance device" am: c2b0578e19
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2422559

Change-Id: I0713915e7e5123269462fbff51c449910262fc56
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-02-17 17:37:51 +00:00
Treehugger Robot
c2b0578e19 Merge "MetadataCrypt: extend timeout for low performance device" 2023-02-17 16:50:01 +00:00
Pawan Wagh
7ea1ed3e05 Merge "Adding fuzzer for VoldNativeService" am: e0a722a05f
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2189528

Change-Id: I64436ad588d7d60b542089e3a6400c7545b0ab4a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-02-14 17:00:19 +00:00
Pawan Wagh
e0a722a05f Merge "Adding fuzzer for VoldNativeService" 2023-02-14 16:14:27 +00:00
Pawan
be70861242 Adding fuzzer for VoldNativeService
vold_native_service_fuzzer is added to fuzz VoldNativeService.

BUG: 232439428
Test: m vold_native_service_fuzzer
Test: adb sync && adb shell data/fuzz/x86_64/vold_native_service_fuzzer/vold_native_service_fuzzer
Change-Id: I2bf33f68e2a51b4ac390b5a5ad47d07260e94122
2023-02-13 19:01:09 +00:00
Masaya Takahashi
5ed64b246a MetadataCrypt: extend timeout for low performance device
Some devices isolate CPUs under low battery. It causes
low performance and 5 sec timeout is soemtimes too short
for dm device ready.

Bug: 267989884

Change-Id: I52e1140b961ac42401a409e3264a5facc0f60cc4
Signed-off-by: Masaya Takahashi <masaya.a.takahashi@sony.com>
2023-02-06 19:43:52 +09:00
Treehugger Robot
7ee09fb51b Merge "Revert "Add NTFS support in vold"" am: 9355e48aaa
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2418459

Change-Id: Iaf9c69e73db2eca74666ffd21dea7cd1ad8a8538
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-02-03 13:19:56 +00:00
Treehugger Robot
9355e48aaa Merge "Revert "Add NTFS support in vold"" 2023-02-03 12:34:55 +00:00
Alfred Piccioni
fc4934feb4 Revert "Add NTFS support in vold"
This reverts commit 564f6c649a.

Reason for revert: Un-backporting.

Note: This is not a direct revert. We should keep the minor refactoring
in PublicVolume.cpp; no point making the code worse.

Test: Revert.
Change-Id: Ic03ed25ad15a2da974921542a20cd27224347f68
2023-02-02 11:12:25 +01:00
Alfred Piccioni
8271b66244 Merge "Add NTFS support in vold" am: c9579dc1a6
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2398952

Change-Id: I8aeaf78c999ad69435c0b7815c05279e61dc420a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-01-24 10:27:13 +00:00
Alfred Piccioni
c9579dc1a6 Merge "Add NTFS support in vold" 2023-01-24 09:44:18 +00:00
Alfred Piccioni
564f6c649a Add NTFS support in vold
This CR, when paired with a functional NTFS implementation and the
corresponding SEPolicy updates, will allow NTFS USB drives to be mounted
on Android.

Bug: 254407246

Test: Extensive testing with an ADT-4 and NTFS USB drives.

Merged-In: If4197c4c588866c611cd6ba3483707d3cb0e0cf8
Change-Id: If4197c4c588866c611cd6ba3483707d3cb0e0cf8
2023-01-23 11:10:38 +01:00
Treehugger Robot
8e90f934f7 Merge "Do not delete all keys after creating a first crypt device" am: 9e3f17a57e
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2390132

Change-Id: I09055f2d3cf6e76017fe3c4616f610044a7add6e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-01-19 00:52:32 +00:00
Treehugger Robot
9e3f17a57e Merge "Do not delete all keys after creating a first crypt device" 2023-01-19 00:03:53 +00:00
Jaegeuk Kim
fb9aadaf48 Do not delete all keys after creating a first crypt device
We should not delete keys, once the first one was created.

Bug: 197782466
Change-Id: Ia895c140aa16553b422748531b01931737a0ea94
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
2023-01-18 14:56:46 -08:00
Xin Li
6ae8e3ae7b Merge tm-qpr-dev-plus-aosp-without-vendor@9467136
Bug: 264720040
Merged-In: I5105da1b8da411d3a4b968d69a547de9e70e66ee
Change-Id: Iff3a12dc06fcf042f62a468220abe9680e535abf
2023-01-12 09:36:30 -08:00
Treehugger Robot
843bda7ff7 Merge "Do not reboot with commit failure when ext4 userdata is wiped" am: 45a3d47fd5
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1770908

Change-Id: I4a41cf9e17224a2deb274b36ab763d2a656725af
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-01-08 21:57:40 +00:00
Treehugger Robot
45a3d47fd5 Merge "Do not reboot with commit failure when ext4 userdata is wiped" 2023-01-08 21:27:12 +00:00
Nikita Ioffe
3b432309ef Merge "Revert "vold: explicitly specify capabilities"" am: d0c81a283b am: 4a5304d225
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2377728

Change-Id: I5105da1b8da411d3a4b968d69a547de9e70e66ee
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-01-06 17:50:51 +00:00
Nikita Ioffe
4a5304d225 Merge "Revert "vold: explicitly specify capabilities"" am: d0c81a283b
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2377728

Change-Id: I3dada1b323d9361260353923af1da845fc04abcd
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-01-06 17:17:25 +00:00