Commit graph

5235 commits

Author SHA1 Message Date
Daeho Jeong
d7237292e3 Merge "vold: fix the range of stopped state of idleMaint" am: 289bcb5305
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2100921

Change-Id: I3fc7979d0d5bd5da8fe49ffd1da3589a7df2db5d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-19 00:53:22 +00:00
Daeho Jeong
289bcb5305 Merge "vold: fix the range of stopped state of idleMaint" 2022-05-18 23:27:40 +00:00
Daeho Jeong
372b3510b5 vold: fix the range of stopped state of idleMaint
When it is stuck in runDevGC() for an unexpected reason, now it cannot
prevent the other callers from entering into it again. Fix it.

Bug: 232297944
Test: run "sm idle-maint run" twice & check whether they are overlapped
Signed-off-by: Daeho Jeong <daehojeong@google.com>
Change-Id: I785c8aeebd8fcf58c34d9be9968d99634d0b420a
2022-05-18 09:03:15 -07:00
Eric Biggers
b0aec67fab Merge "Add and use prepare_dir_with_policy() helper function" am: 14ac67efab
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2097184

Change-Id: I2d4d4a5832d66ded83e7f2effe14d34728d0db5d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-13 03:53:23 +00:00
Eric Biggers
14ac67efab Merge "Add and use prepare_dir_with_policy() helper function" 2022-05-13 03:04:50 +00:00
Eric Biggers
ca9a97ed6c Add and use prepare_dir_with_policy() helper function
Having prepare_dir() and EnsurePolicy() be separate operations is
error-prone; it lengthens the window of time that files could
accidentally be created in new directories before they are encrypted,
and it makes it easier to accidentally never encrypt a directory.

To partially address this, add a function prepare_dir_with_policy() that
combines the two steps, and use it everywhere possible.  This function
is now the only place in vold that calls EnsurePolicy().

As a follow-up change, we could go a bit further and make this helper
function create the directory under a temporary name and move it into
place already-encrypted.  This change just focuses on getting the helper
function in place, without changing the behavior too much.

Change-Id: I98ab345df235120db6727f7dbe0da6a8b6ef2579
2022-05-12 20:21:33 +00:00
Eric Biggers
65f0713d14 Merge changes from topic "deny-create-user-dirs" am: 9fb8825578
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2095484

Change-Id: I89516d7b997e2b48e1767e895c797eec349ffa17
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-12 19:38:52 +00:00
Eric Biggers
50cfdadab0 Don't return /data/data from BuildDataUserCePath() am: aafc1bfb73
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2095483

Change-Id: Ib1953e89a41e68f845e33878b0cb7728b06a9e8e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-12 19:38:51 +00:00
Eric Biggers
9fb8825578 Merge changes from topic "deny-create-user-dirs"
* changes:
  Prepare /data/user/0 and /data/media/obb during initUser0
  Don't return /data/data from BuildDataUserCePath()
2022-05-12 18:41:21 +00:00
Eric Biggers
9ea5344daf Prepare /data/user/0 and /data/media/obb during initUser0
Prepare these directories during initUser0.  This greatly shortens the
gap between the creation and encryption of /data/user/0, and this makes
it possible to remove init's write access to all directories containing
per-user encrypted directories.

Bug: 156305599
Change-Id: Ibf3d25356e8f0bca70da078c5d2428ae8615240e
2022-05-11 21:56:01 +00:00
Eric Biggers
aafc1bfb73 Don't return /data/data from BuildDataUserCePath()
There is no reason for this function to sometimes return the legacy
alias "/data/data" for /data/user/0.  Just use /data/user/0 instead.

Bug: 156305599
Change-Id: I305a9463c1bf0a59495c34ef33430f92257c2f0d
2022-05-11 05:33:25 +00:00
Eric Biggers
855a86f6e7 Merge "Set correct SELinux labels on new user directories" am: ff12485899
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2086313

Change-Id: Iecee4b11b0b89a2d4c5657e099daf0ce2525382c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-09 15:18:59 +00:00
Eric Biggers
ff12485899 Merge "Set correct SELinux labels on new user directories" 2022-05-09 14:45:11 +00:00
Eric Biggers
39704e777a Set correct SELinux labels on new user directories
Make vold explicitly set the appropriate fscreate SELinux context when
creating per-user subdirectories such as /data/user/$userId.  This is
needed for these subdirectories to get the correct SELinux labels after
the sepolicy change https://r.android.com/2078213 changes their parent
directories to have different labels.

Note: the helper function being changed is also used for some other
directories, such as subdirectories of /data/misc/vold.  But this is
fine since they still get the same labels as before.

Test: see https://r.android.com/2078213
Bug: 156305599
Change-Id: Id61c2d985144007059c563cec91b1355176e915c
2022-05-04 22:17:54 +00:00
Eric Biggers
4f4e999ec0 Merge "Enforce that internal storage is prepared first" am: 1093934040
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2085659

Change-Id: I30eaba96a192c2ce32aa16c60ffe1ac39194d639
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-04 19:54:18 +00:00
Eric Biggers
1093934040 Merge "Enforce that internal storage is prepared first" 2022-05-04 18:56:17 +00:00
Eric Biggers
c66c2e306d Enforce that internal storage is prepared first
Before doing anything else in fscrypt_prepare_user_storage(), error out
if adoptable storage is being prepared before internal storage.  Without
this explicit check, making this mistake results in a sequence of weird
errors that is hard to trace back to the actual problem.

Bug: 231387956
Change-Id: Ib26cc1bd46ffa2578f6f0156dfacc5496dae3178
2022-05-04 06:47:44 +00:00
Chih-hung Hsieh
39b2e0423b Merge "Use tidy_checks_as_errors not -warnings-as-errors" am: 56ee1a0ca7
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2078678

Change-Id: I343bac88d299cc3382143b89a37e95a3dd18a5c0
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-02 21:31:50 +00:00
Chih-hung Hsieh
56ee1a0ca7 Merge "Use tidy_checks_as_errors not -warnings-as-errors" 2022-04-29 00:15:40 +00:00
Chih-Hung Hsieh
1ab55a5060 Use tidy_checks_as_errors not -warnings-as-errors
The flag -warnings-as-errors embedded in tidy_flags
is difficult to process and error-prone.
They should be replaced with the new tidy_checks_as_errors list.

Bug: 229801437
Test: make tidy-system-vold
Change-Id: I801e73dce5f08fe1ca5bc49de633706ad2cdf986
2022-04-27 15:54:25 -07:00
Alix Espino
42c961198f Merge "Deleted clang property in Android.bp files" am: df7ac92d33
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2066564

Change-Id: I1ca5175a4409124414c70f158e6df4b994b17d36
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-20 21:18:53 +00:00
Alix Espino
df7ac92d33 Merge "Deleted clang property in Android.bp files" 2022-04-20 20:58:30 +00:00
Alix
347786970f Deleted clang property in Android.bp files
Deleted deprecated clang property in Android.bp files using bpmodify.

Bug: 208980553
Test: treehugger
Change-Id: Ia20c730fefe4ebb2268780260f5756dcf687ccc5
2022-04-18 04:00:10 +00:00
Daeho Jeong
aa259e7ee0 Merge changes from topic "change_period" am: c0de6d8184 am: 3d81e0ba06
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2043104

Change-Id: I473b88c8b3b1e8dd6ee80fe56f513269fd997a4c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-03-25 23:10:14 +00:00
Daeho Jeong
529d797f58 vold: do not set gc sleep time with zero dirty segments am: 0b5f397e2b am: f605ac329b
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2033123

Change-Id: I8c2ba8b86059a78b65094aa013e249c80f901a7f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-03-25 23:10:12 +00:00
Daeho Jeong
a644d5c642 vold: add gc period in setGCUrgentPace am: 7c788fc3e9 am: 81ba5bcf1c
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2032446

Change-Id: I2ec34972e89ecf6872dece12b0ab05bc9a07511c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-03-25 23:10:11 +00:00
Daeho Jeong
3d81e0ba06 Merge changes from topic "change_period" am: c0de6d8184
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2043104

Change-Id: I5f33ee1baa66c6278139ca9e17a7ef4c5836e674
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-03-25 22:47:20 +00:00
Daeho Jeong
f605ac329b vold: do not set gc sleep time with zero dirty segments am: 0b5f397e2b
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2033123

Change-Id: I30d462858c6b3acc8e7aebc9bed55deb4716db14
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-03-25 22:47:19 +00:00
Daeho Jeong
81ba5bcf1c vold: add gc period in setGCUrgentPace am: 7c788fc3e9
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2032446

Change-Id: I691c355f6eb91f83af0b4bbdade10bd67ceb62a3
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-03-25 22:47:17 +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
eb22f77c92 Merge "Add vold to hwasan-postsubmit" am: 203ad70aa2 am: 3b35b2fcc5
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2032447

Change-Id: I8eb7cf3fb00ba28afbe0d075d2104d8f06aeffc2
2022-03-24 10:58:40 +00:00
Treehugger Robot
3b35b2fcc5 Merge "Add vold to hwasan-postsubmit" am: 203ad70aa2
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2032447

Change-Id: I046fd17ddeaeee61cdc107c57e00a70739bd0232
2022-03-24 10:21:04 +00:00
Treehugger Robot
203ad70aa2 Merge "Add vold to hwasan-postsubmit" 2022-03-24 09:56:09 +00:00
Treehugger Robot
7f635c0bb1 Merge "Use make_f2fs -g android by default" am: fa9165f07b am: eb51baf132
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2037166

Change-Id: Ie4b8fa23a8804261ef7c182296fe96262cc16c4a
2022-03-23 21:16:34 +00:00
Treehugger Robot
eb51baf132 Merge "Use make_f2fs -g android by default" am: fa9165f07b
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2037166

Change-Id: I0760bc2019fa5f5ce88b549092f984fd60c59ed7
2022-03-23 20:56:37 +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
4d18a98dfd Merge "Increase early boot logging to kernel log" am: d420cae64e am: 576df715e8
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2035283

Change-Id: Ia16889f8d52f809fe8bcac33a1bd4b8fc0066b5a
2022-03-22 18:03:31 +00:00
Eric Biggers
576df715e8 Merge "Increase early boot logging to kernel log" am: d420cae64e
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2035283

Change-Id: Ie27bab8ce4e8dda149e7581906bec925d54df139
2022-03-22 17:56:19 +00:00
Eric Biggers
3fd082a2a5 Merge "Remove FDE methods from binder interface" am: 66d13bd28c am: 3d380e1f12
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2030592

Change-Id: I13009af00a3893bacf9b994b32673cb9d3139cb1
2022-03-22 17:47:03 +00:00
Eric Biggers
3d380e1f12 Merge "Remove FDE methods from binder interface" am: 66d13bd28c
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2030592

Change-Id: Ie9f4cdf360d666aa2125318f83ace70fc2f1b382
2022-03-22 17:46:14 +00: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
e2d020d12f Merge "Enable ProjectID for the file systems by default." am: 8acf8298f9 am: 2727ad7d1a
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1967545

Change-Id: I3c6c22f3b074131caf0e174230727f18548a2778
2022-03-22 17:04:53 +00:00
Shikha Malhotra
2727ad7d1a Merge "Enable ProjectID for the file systems by default." am: 8acf8298f9
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1967545

Change-Id: I6c451355f6aad20f549ee6fdb98b1c33b4df1a54
2022-03-22 16:49:23 +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
15a316dbd2 Merge "Create misc_ce and misc_de directories on /mnt/expand" am: fda93c9f31 am: a9c554bd05
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2030127

Change-Id: I60368dea371d31cf5a7354807822ef566a7da793
2022-03-21 13:11:41 +00:00
Samiul Islam
a9c554bd05 Merge "Create misc_ce and misc_de directories on /mnt/expand" am: fda93c9f31
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2030127

Change-Id: I844d48df7e587693791a17a23cc14d87a358fa5e
2022-03-21 12:37:19 +00:00