Commit graph

5724 commits

Author SHA1 Message Date
Eric Biggers
14ac67efab Merge "Add and use prepare_dir_with_policy() helper function" 2022-05-13 03:04:50 +00:00
Eric Biggers
91180c5aeb Merge changes from topic "deny-create-user-dirs" am: 9fb8825578 am: 65f0713d14 am: cf8713daf4 am: 896625bc6d
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2095484

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

Change-Id: I6796d564a245da1008532df086c6dbcf41b7bab3
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-12 20:33:32 +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
896625bc6d Merge changes from topic "deny-create-user-dirs" am: 9fb8825578 am: 65f0713d14 am: cf8713daf4
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2095484

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

Change-Id: Ia19d6556ce520e0a8364001de8bb4314f339241e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-12 20:16:34 +00:00
Eric Biggers
cf8713daf4 Merge changes from topic "deny-create-user-dirs" am: 9fb8825578 am: 65f0713d14
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2095484

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

Change-Id: I49b25ca9d4666edeee056588b24f4528a495af32
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-12 19:57:48 +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
5fb7959397 [automerger skipped] Enforce that internal storage is prepared first am: c193c3fbb8 -s ours am: 6e62eb2100 -s ours am: 3ff1aa1b0d -s ours
am skip reason: Merged-In Ib26cc1bd46ffa2578f6f0156dfacc5496dae3178 with SHA-1 c66c2e306d is already in history

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

Change-Id: Id34986c0b00dd041c05ebe6a0f8b21de97c5953b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-11 22:19:13 +00:00
Eric Biggers
5b04932ea1 [automerger skipped] Enforce that internal storage is prepared first am: c193c3fbb8 am: 449ac4d8ff -s ours am: cac2ea1a11 -s ours
am skip reason: Merged-In Ib26cc1bd46ffa2578f6f0156dfacc5496dae3178 with SHA-1 c66c2e306d is already in history

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

Change-Id: I6477caef0b435dc1426d58a0a0f420b5132e553d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-11 22:11:47 +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
352411a591 [automerger skipped] Enforce that internal storage is prepared first am: c193c3fbb8 am: 449ac4d8ff am: e358ce1a50 -s ours
am skip reason: Merged-In Ib26cc1bd46ffa2578f6f0156dfacc5496dae3178 with SHA-1 c66c2e306d is already in history

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

Change-Id: I503dcd26faa2de70a865e9e19383bd0f27b6a27c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-11 21:54:29 +00:00
Eric Biggers
3ff1aa1b0d [automerger skipped] Enforce that internal storage is prepared first am: c193c3fbb8 -s ours am: 6e62eb2100 -s ours
am skip reason: Merged-In Ib26cc1bd46ffa2578f6f0156dfacc5496dae3178 with SHA-1 c66c2e306d is already in history

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

Change-Id: I39f93e7e2c13242195524abeb712e6248530fd0a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-11 21:31:34 +00:00
Eric Biggers
cac2ea1a11 [automerger skipped] Enforce that internal storage is prepared first am: c193c3fbb8 am: 449ac4d8ff -s ours
am skip reason: Merged-In Ib26cc1bd46ffa2578f6f0156dfacc5496dae3178 with SHA-1 c66c2e306d is already in history

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

Change-Id: If3f6ec126e7d92865bae3c733b414047e5fdbaa3
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-11 21:24:37 +00:00
Eric Biggers
e358ce1a50 Enforce that internal storage is prepared first am: c193c3fbb8 am: 449ac4d8ff
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/vold/+/18163020

Change-Id: I230fdf8a3a4e38dcaf303c41867fdf924a3eae03
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-11 21:24:28 +00:00
Eric Biggers
6e62eb2100 [automerger skipped] Enforce that internal storage is prepared first am: c193c3fbb8 -s ours
am skip reason: Merged-In Ib26cc1bd46ffa2578f6f0156dfacc5496dae3178 with SHA-1 c66c2e306d is already in history

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

Change-Id: I5166e083498635a96526d45c6470884ea4adf0a9
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-11 21:09:44 +00:00
Eric Biggers
449ac4d8ff Enforce that internal storage is prepared first am: c193c3fbb8
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/vold/+/18163020

Change-Id: Ide14963edb87119fa4c7b06cee5a2d01eb1fe8dc
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-11 21:08:54 +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
2b9a70103b Merge "Set correct SELinux labels on new user directories" am: ff12485899 am: 855a86f6e7 am: 4792b2ff3a am: 844620ed8e
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2086313

Change-Id: Ibcd6b8c81e7ad86923f3c340d7af5c60d33d2498
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-09 18:17:52 +00:00
Eric Biggers
844620ed8e Merge "Set correct SELinux labels on new user directories" am: ff12485899 am: 855a86f6e7 am: 4792b2ff3a
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2086313

Change-Id: I5dfb47519402a0c60999d2ee16b9f3d14821da62
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-09 17:32:43 +00:00
Eric Biggers
4792b2ff3a Merge "Set correct SELinux labels on new user directories" am: ff12485899 am: 855a86f6e7
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2086313

Change-Id: I966c9dabd925b058e53dfcafac5564b270856329
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-09 15:47:52 +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
661aec02f2 Merge "Enforce that internal storage is prepared first" am: 1093934040 am: 4f4e999ec0 am: 7f925c79be am: 27c39e5a9c
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2085659

Change-Id: I7fd0d64e8705035ce061f0f204c4f53a9708275e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-04 20:33:06 +00:00
Eric Biggers
27c39e5a9c Merge "Enforce that internal storage is prepared first" am: 1093934040 am: 4f4e999ec0 am: 7f925c79be
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2085659

Change-Id: Idecae496287dbd22fa6e0c065314aebbd5e07f69
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-04 20:24:50 +00:00
Eric Biggers
7f925c79be Merge "Enforce that internal storage is prepared first" am: 1093934040 am: 4f4e999ec0
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2085659

Change-Id: Iabd7700ed3eb10439b7f9d92cfb006ae6b280558
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-04 20:12:39 +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
c193c3fbb8 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
(cherry picked from commit c66c2e306d)
Merged-In: Ib26cc1bd46ffa2578f6f0156dfacc5496dae3178
2022-05-04 19:01:45 +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
1f6ff59ae4 Merge "Use tidy_checks_as_errors not -warnings-as-errors" am: 56ee1a0ca7 am: 39b2e0423b am: 4858522869 am: 6aba3d31e4
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2078678

Change-Id: I060fde72dfe5b517f0cbb1a0a4225c7fe2b6326d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-02 23:02:54 +00:00
Chih-hung Hsieh
6aba3d31e4 Merge "Use tidy_checks_as_errors not -warnings-as-errors" am: 56ee1a0ca7 am: 39b2e0423b am: 4858522869
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2078678

Change-Id: Ie50301218bf00eb937b445ede9442a4a45a498ce
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-02 22:39:14 +00:00
Chih-hung Hsieh
4858522869 Merge "Use tidy_checks_as_errors not -warnings-as-errors" am: 56ee1a0ca7 am: 39b2e0423b
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2078678

Change-Id: I1fb02daed88158f4b1b4d0f7f4125b12c21400a2
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-02 22:10:48 +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
10027c5c03 Merge "Deleted clang property in Android.bp files" am: df7ac92d33 am: 42c961198f am: cf6eb0e5e7 am: e07afb81e2 am: 3a424cfc9a
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2066564

Change-Id: Ifbaa384fe71520d3e9099fdd2ddc1788da5096b7
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-20 22:42:22 +00:00
Alix Espino
3a424cfc9a Merge "Deleted clang property in Android.bp files" am: df7ac92d33 am: 42c961198f am: cf6eb0e5e7 am: e07afb81e2
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2066564

Change-Id: Icf37540ba5f6d37b6eafef14473d1746f6700cba
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-20 22:23:29 +00:00
Alix Espino
e07afb81e2 Merge "Deleted clang property in Android.bp files" am: df7ac92d33 am: 42c961198f am: cf6eb0e5e7
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2066564

Change-Id: I9e1928a7aaf6c549e553bb480aaec605c5495aea
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-20 21:54:31 +00:00
Alix Espino
cf6eb0e5e7 Merge "Deleted clang property in Android.bp files" am: df7ac92d33 am: 42c961198f
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2066564

Change-Id: Ifb57301330cd2bec3c0cfed95e0e60206573b022
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-20 21:38:24 +00: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
5891d7e486 Merge changes from topic "change_period" am: c0de6d8184 am: 3d81e0ba06 am: aa259e7ee0
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2043104

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

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

Change-Id: Iea633da99a06911d93c52c77949758b1ec78849b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-03-29 14:19:21 +00:00