Commit graph

6377 commits

Author SHA1 Message Date
Martijn Coenen
c7bed872c0 Merge "SM: Change volume mountUserId for new user" into main 2023-07-17 08:05:33 +00:00
Arnab Sen
f96d81f5cd SM: Change volume mountUserId for new user
When a volume is ejected from a user but not removed from the device
and mounted again by calling StorageManager#mount, the volume is
mounted for the user from which it was last ejected. This causes the
path of the mounted volume to be inaccessible to the current user.

Whenever StorageManager#mount is called, check if the
VolumeInfo#mountUserId is same as the current userId maintained by
StorageManagerService, if it is not, change the mountUserId for the
Volume to the current userId known to StorageManagerService if it
is not the primary volume and the volume is visible.
This change also fixes a bug where the volumes are unmounted for the
wrong user which causes StorageSessionController go out of sync
which would cause errors during mounting the volumes again as it
maintains sessions per user. The bug also caused volume event
broadcasts to be sent to wrong user handles. To solve the issue
add an extra paramter in IVoldListener#onVolumeStateChanged for userId
which will update the copy which is used for informing
StorageSessionController and also for sending broadcasts.

Test: Perform the following steps:
1. Format SD Card as portable storage in system user.
2. Eject the SD Card from Storage Settings.
3. Switch to a non-system user
4. Mount the SD Card again.
5. Check that the Storage Summary is shown correctly instead
   of 0B out of 0B.
Also, checked from the logs the volume state broadcasts are sent to
the correct user handles.

Change-Id: I60b8954cdaee4a54ea6a6299fe5ddda2006faf1c
2023-07-14 09:55:37 +00:00
Wen-Chih Lo
5b9fd68dfa Handle errors corrected exit status returned by fsck
Properly handle the exit status 1, which shows filesystem errors
corrected, returned by fsck.

Test: manually hot-plugs SD card and check logcat logs
Change-Id: Iacaa8b1d1a7b59931014c1ab6a4708ffc3cd0c06
2023-07-07 11:32:01 +08:00
Treehugger Robot
f8472908d6 Merge "Remove dead code from fs_mgr" am: 50d89e6351 am: 79fecb2f8d am: 66ac89b173 am: 8da4142839 am: a4b20ffedb am: 31f87b72f1
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2634990

Change-Id: Icf5ed9f89e16f6f11212776baff29901015a4201
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-24 02:28:39 +00:00
Treehugger Robot
31f87b72f1 Merge "Remove dead code from fs_mgr" am: 50d89e6351 am: 79fecb2f8d am: 66ac89b173 am: 8da4142839 am: a4b20ffedb
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2634990

Change-Id: Ied130273ddd2204d5718a5165a8e4b2f8bca17c5
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-24 01:17:39 +00:00
Treehugger Robot
a4b20ffedb Merge "Remove dead code from fs_mgr" am: 50d89e6351 am: 79fecb2f8d am: 66ac89b173 am: 8da4142839
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2634990

Change-Id: I992421fa9fa3b99b3dd653248d6ea75b9f150443
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-24 00:05:50 +00:00
Treehugger Robot
8da4142839 Merge "Remove dead code from fs_mgr" am: 50d89e6351 am: 79fecb2f8d am: 66ac89b173
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2634990

Change-Id: Iad699d0f41e221d53545d7a203bda87d54295635
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-23 23:17:16 +00:00
Treehugger Robot
66ac89b173 Merge "Remove dead code from fs_mgr" am: 50d89e6351 am: 79fecb2f8d
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2634990

Change-Id: I35fa71d4edee636cf0320e900a043fd5f2331b0a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-23 22:30:03 +00:00
Treehugger Robot
79fecb2f8d Merge "Remove dead code from fs_mgr" am: 50d89e6351
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2634990

Change-Id: Ia0904ec0d1b26cbaf65c8b43c29eecdbbcd07915
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-23 21:45:27 +00:00
Treehugger Robot
50d89e6351 Merge "Remove dead code from fs_mgr" 2023-06-23 20:07:09 +00:00
Paul Lawrence
997e9bbc18 Remove dead code from fs_mgr
Test: Compiles
Change-Id: I644cfe58fdf87fbb88a85953f1450efb8b99baab
2023-06-23 09:28:18 -07:00
Treehugger Robot
b806be3468 Merge "Don't Skip Checkpointing for F2fs" am: 4bc9e2517b am: 7045aeba50 am: 2f773b6ee0 am: 8da9e2efe7 am: c1fa4f7595 am: ed99c0bdbc
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2634095

Change-Id: I3af06152716cf780d45ba3ccc05f3b71c5bdfcb5
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-23 04:54:18 +00:00
Treehugger Robot
ed99c0bdbc Merge "Don't Skip Checkpointing for F2fs" am: 4bc9e2517b am: 7045aeba50 am: 2f773b6ee0 am: 8da9e2efe7 am: c1fa4f7595
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2634095

Change-Id: I7d8b1f5bc3869bf774ec847203fe3f6bfd7806d8
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-23 03:25:29 +00:00
Treehugger Robot
c1fa4f7595 Merge "Don't Skip Checkpointing for F2fs" am: 4bc9e2517b am: 7045aeba50 am: 2f773b6ee0 am: 8da9e2efe7
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2634095

Change-Id: I70ca9625908b62c2b316bd2b7158cb19cf93167c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-23 02:45:08 +00:00
Treehugger Robot
8da9e2efe7 Merge "Don't Skip Checkpointing for F2fs" am: 4bc9e2517b am: 7045aeba50 am: 2f773b6ee0
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2634095

Change-Id: I9efc54b3b4cc1a7acdcac58b06e887475177c25b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-23 01:39:51 +00:00
Treehugger Robot
2f773b6ee0 Merge "Don't Skip Checkpointing for F2fs" am: 4bc9e2517b am: 7045aeba50
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2634095

Change-Id: Icb2a5b6ae1cb1a00b82ab49594256b5db90fb45d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-23 00:53:27 +00:00
Treehugger Robot
7045aeba50 Merge "Don't Skip Checkpointing for F2fs" am: 4bc9e2517b
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2634095

Change-Id: I87bf9187bae9484d6a3f0b0f374bee18e5734434
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-23 00:10:20 +00:00
Treehugger Robot
4bc9e2517b Merge "Don't Skip Checkpointing for F2fs" 2023-06-22 23:28:01 +00:00
Daniel Rosenberg
5d1d945b56 Don't Skip Checkpointing for F2fs
"Do not reboot with commit failure when ext4 userdata is wiped" has
caused a regression in cuttlefish on f2fs. Overlay.img rapidly grows to
the full userdata size. This updates that CL to only affect partitions
marked for block based checkpointing.

Test: Boot Cuttlefish, monitor overlay.img for 5 minutes
Bug: 285019395
Change-Id: I8aa37a97e847960afe8b368090a86c8835e6ca9e
2023-06-21 18:56:29 -07:00
Eric Biggers
6721705b63 Merge "Remove write permission from file mode of top-level user dirs" am: c73150307a am: 55593258ac am: 0f7c1825b1 am: 4801c65d8e am: d1cf82849a am: a9fa33852a
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2617599

Change-Id: Idf6b509874905d1a74d2fc2c591b0614ee9595db
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-21 07:42:06 +00:00
Eric Biggers
a9fa33852a Merge "Remove write permission from file mode of top-level user dirs" am: c73150307a am: 55593258ac am: 0f7c1825b1 am: 4801c65d8e am: d1cf82849a
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2617599

Change-Id: I3f84115327e9508b3bf4f1d9356d0493e0059666
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-20 21:29:27 +00:00
Eric Biggers
d1cf82849a Merge "Remove write permission from file mode of top-level user dirs" am: c73150307a am: 55593258ac am: 0f7c1825b1 am: 4801c65d8e
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2617599

Change-Id: I039c2599039c8c46326c0c5c311b8cb4580292db
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-20 20:46:30 +00:00
Eric Biggers
4801c65d8e Merge "Remove write permission from file mode of top-level user dirs" am: c73150307a am: 55593258ac am: 0f7c1825b1
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2617599

Change-Id: Idda5d816c2a012afa35658f1b2d86ae2787c1faf
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-20 20:01:03 +00:00
Eric Biggers
0f7c1825b1 Merge "Remove write permission from file mode of top-level user dirs" am: c73150307a am: 55593258ac
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2617599

Change-Id: I81dbb99fb7641e27cfb49c97525e045bf5968692
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-20 18:35:50 +00:00
Eric Biggers
55593258ac Merge "Remove write permission from file mode of top-level user dirs" am: c73150307a
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2617599

Change-Id: I05ddef6a233b326b44d1de36c1a3aeecba1c7b67
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-20 17:54:45 +00:00
Eric Biggers
c73150307a Merge "Remove write permission from file mode of top-level user dirs" 2023-06-20 17:15:24 +00:00
Eric Biggers
4a5f7ce36f Merge "Move encrypted directories into place already-encrypted" am: ec6e52aadc am: 01ca68c4f8 am: 8e38d39179 am: 29b381b796 am: dd605339aa am: 8b09d9aba1
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2620092

Change-Id: I858816e982df16be3d2d64f14f9370d34eccd3be
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-14 02:08:35 +00:00
Eric Biggers
8b09d9aba1 Merge "Move encrypted directories into place already-encrypted" am: ec6e52aadc am: 01ca68c4f8 am: 8e38d39179 am: 29b381b796 am: dd605339aa
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2620092

Change-Id: I398213056b551d8519ed166817ae0bc348c92488
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-14 01:22:47 +00:00
Eric Biggers
dd605339aa Merge "Move encrypted directories into place already-encrypted" am: ec6e52aadc am: 01ca68c4f8 am: 8e38d39179 am: 29b381b796
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2620092

Change-Id: I0b2710999d858e989ee8d495feb1298b66db396e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-14 00:54:24 +00:00
Eric Biggers
29b381b796 Merge "Move encrypted directories into place already-encrypted" am: ec6e52aadc am: 01ca68c4f8 am: 8e38d39179
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2620092

Change-Id: Ice304428e084b2d4ce2ef2e1904b0fb2b57a5261
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-14 00:08:32 +00:00
Eric Biggers
8e38d39179 Merge "Move encrypted directories into place already-encrypted" am: ec6e52aadc am: 01ca68c4f8
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2620092

Change-Id: Ib6627057ba9d1a11fc3ca2f7dbdc53254a4bf35f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-13 23:21:11 +00:00
Eric Biggers
01ca68c4f8 Merge "Move encrypted directories into place already-encrypted" am: ec6e52aadc
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2620092

Change-Id: I0937a39d1b09ef4201b9c194543890685784fc77
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-13 22:40:35 +00:00
Eric Biggers
ec6e52aadc Merge "Move encrypted directories into place already-encrypted" 2023-06-13 22:11:39 +00:00
Eric Biggers
714b99d9da Remove write permission from file mode of top-level user dirs
https://r.android.com/2620458 is removing the write mode bit from the
top-level user directories on internal storage, in order to make the DAC
consistent with the SELinux policy.

This commit makes the corresponding change to adoptable storage.

Bug: 285239971
Test: sm set-virtual-disk true; sm partition disk:7,392 private
Change-Id: I17dfbe10909b34c2046a4d5b4ffd7764d5ae083b
2023-06-08 22:16:25 +00:00
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
2b7dc4e6d6 Merge "vold: move some libs from shared to static" am: 39f11368a5 am: f4ae30da97 am: f042721b4d am: 38f9593a28 am: 8ff1f1f7c9 am: efaa5b0e21
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2598907

Change-Id: I119081a55530446195faf5b507dfed0aac809ccd
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-05-23 20:39:44 +00:00
Treehugger Robot
efaa5b0e21 Merge "vold: move some libs from shared to static" am: 39f11368a5 am: f4ae30da97 am: f042721b4d am: 38f9593a28 am: 8ff1f1f7c9
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2598907

Change-Id: Ic47c0f4c2aa5729e371755ad4744e7b982421b1c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-05-23 19:57:02 +00:00
Treehugger Robot
8ff1f1f7c9 Merge "vold: move some libs from shared to static" am: 39f11368a5 am: f4ae30da97 am: f042721b4d am: 38f9593a28
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2598907

Change-Id: I17327ff5fbdbdda7085bdf5f718da26e65e9d8ec
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-05-23 19:00:10 +00:00
Treehugger Robot
38f9593a28 Merge "vold: move some libs from shared to static" am: 39f11368a5 am: f4ae30da97 am: f042721b4d
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2598907

Change-Id: Idcfda60f4e545c6b274e12ced27a628a0307f6f3
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-05-23 18:16:34 +00:00
Treehugger Robot
f042721b4d Merge "vold: move some libs from shared to static" am: 39f11368a5 am: f4ae30da97
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2598907

Change-Id: I926f4b96d2a4b6d57f606afec1384c779d82990a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-05-23 17:33:57 +00:00
Treehugger Robot
f4ae30da97 Merge "vold: move some libs from shared to static" am: 39f11368a5
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2598907

Change-Id: I237a3145216534a9c2e601e5c5606bbc87ea68eb
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-05-23 17:11:46 +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
473860edb4 Merge "Disable leak detection in vold fuzzer" am: a3e128a868 am: b7792484f1 am: c25a1e04f3 am: ef0d064fa2 am: 27865ac964 am: 73838d8ac7
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2577820

Change-Id: I4036a597ca2a1e4181845479695e93214bb799f8
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-05-09 04:07:51 +00:00
Pawan Wagh
73838d8ac7 Merge "Disable leak detection in vold fuzzer" am: a3e128a868 am: b7792484f1 am: c25a1e04f3 am: ef0d064fa2 am: 27865ac964
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2577820

Change-Id: I3536286b46ecf8f545cafa70bb87af00ccb20776
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-05-09 03:25:07 +00:00
Pawan Wagh
27865ac964 Merge "Disable leak detection in vold fuzzer" am: a3e128a868 am: b7792484f1 am: c25a1e04f3 am: ef0d064fa2
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2577820

Change-Id: I07a9af0b9c56c7da6f57ce7208d41d14c1933567
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-05-09 01:46:50 +00:00
Pawan Wagh
ef0d064fa2 Merge "Disable leak detection in vold fuzzer" am: a3e128a868 am: b7792484f1 am: c25a1e04f3
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2577820

Change-Id: I5c289e5f81ca9addac64650ca5384c6502da251e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-05-09 00:16:39 +00:00
Pawan Wagh
c25a1e04f3 Merge "Disable leak detection in vold fuzzer" am: a3e128a868 am: b7792484f1
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2577820

Change-Id: Ic5d49ddcf0345af10042ea606db625f905b6e001
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-05-08 23:29:17 +00:00
Pawan Wagh
b7792484f1 Merge "Disable leak detection in vold fuzzer" am: a3e128a868
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2577820

Change-Id: I6d93f475f686d817fc847cced4e8164a921bf32c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-05-08 23:06:22 +00:00
Pawan Wagh
a3e128a868 Merge "Disable leak detection in vold fuzzer" 2023-05-08 22:53:03 +00:00