Commit graph

4880 commits

Author SHA1 Message Date
Martijn Coenen
5adf92a988 Set a default ACL on /data/media/userId.
This directory is used as a root for external storage on adopted storage
devices. It needs to be writable by processes holding the AID_MEDIA_RW
GID permission; in particular, it should be writable by the FUSE daemon.

On devices with sdcardfs, this was ensured automatically, because
sdcardfs presented a view of this directory that was writable, that we
could use for the FUSE daemon. But on devices without sdcardfs, the FUSE
daemon sees the raw filesystem and its permissions. This also means that
files created by the FUSE daemon will have their uid/gid set to the uid
of the FUSE daemon; to ensure these files stay writable to other system
applications that have AID_MEDIA_RW, use a default ACL to make sure the
gid stays AID_MEDIA_RW.

In particular, this fixes an issue with app cloning, where we want the
FUSE daemon of user 0 to be able to access the files of the app clone
user, and vice versa.

Bug: 154057120
Test: inspect uid/gid of /data/media/0 and contents
Change-Id: Ic5d63457ec917ea407b900dbb7773d89311780c6
2021-02-24 12:45:09 +01:00
Kalesh Singh
98062dcd89 vold: Use Wakelock::tryGet()
Acquiring a wakelock can fail if the suspend service is unavailable.
Explicitly check that wakelock was acquired before performing
operations that require the device to stay on.

Bug: b/179229598
Test: Boot test on Pixel 4 device
Change-Id: If30087223e44098801a31d1bfd239ac22e891abe
2021-02-22 17:24:51 -05:00
Xin Li
10b95cfe5a [automerger skipped] Mark ab/7061308 as merged in stage. am: 0ee13dfc4f -s ours am: 9ee62187e7 -s ours
am skip reason: Change-Id I7124285f41c6a854ad5c86677bc94d78ddca5a97 with SHA-1 60537dad69 is in history

Original change: undetermined

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I2d2f9234a82f959148a047d2e6e91fd90182b96c
2021-02-20 13:38:43 +00:00
Xin Li
9ee62187e7 [automerger skipped] Mark ab/7061308 as merged in stage. am: 0ee13dfc4f -s ours
am skip reason: Change-Id I7124285f41c6a854ad5c86677bc94d78ddca5a97 with SHA-1 60537dad69 is in history

Original change: undetermined

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I50546bc29bc2fcd0dee816ded8d45d9b355c4eb1
2021-02-20 12:28:42 +00:00
Xin Li
0ee13dfc4f Mark ab/7061308 as merged in stage.
Bug: 180401296
Merged-In: I7124285f41c6a854ad5c86677bc94d78ddca5a97
Change-Id: Icf8db3d8557a3835e0834eec134bb4b111ec3af0
2021-02-20 00:24:42 -08:00
Treehugger Robot
3112ba572d Merge changes from topic "fsync-fixes" am: 6c36c6f421 am: 2a3e67a9e0 am: 85956f9525
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1590896

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I0d2bc6467b35b2df1aff79e4765bdd103c7b572a
2021-02-19 22:05:25 +00:00
Treehugger Robot
85956f9525 Merge changes from topic "fsync-fixes" am: 6c36c6f421 am: 2a3e67a9e0
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1590896

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ibf2e04c47b38e917bf58afcfbd78b7a0a395c141
2021-02-19 20:42:12 +00:00
Treehugger Robot
2a3e67a9e0 Merge changes from topic "fsync-fixes" am: 6c36c6f421
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1590896

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ifacc42ef9b4abe897a598e3cd8dcef4650b8f5ff
2021-02-19 19:54:09 +00:00
Treehugger Robot
6c36c6f421 Merge changes from topic "fsync-fixes"
* changes:
  Add syncs when creating parent directories
  Sync parent directory in storeKeyAtomically()
  Move pathExists() to Utils.cpp
2021-02-19 19:23:47 +00:00
Dhiraj Jadhav
177281b007 Merge "Revert "Revert "Revert "Set a default ACL on /data/media/userId."""" am: a98846d8d5 am: 375884bd0a am: e5d8fe2474
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1592902

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ia0b6cab9e43d08c5d5e1f6f37a9ce3f7fee35e0e
2021-02-18 19:33:21 +00:00
Dhiraj Jadhav
e5d8fe2474 Merge "Revert "Revert "Revert "Set a default ACL on /data/media/userId."""" am: a98846d8d5 am: 375884bd0a
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1592902

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I38ed5d51a2f7712bf6a72b01f35e4c99a4edb43f
2021-02-18 19:13:34 +00:00
Dhiraj Jadhav
375884bd0a Merge "Revert "Revert "Revert "Set a default ACL on /data/media/userId."""" am: a98846d8d5
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1592902

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I7c3c8bd230bcc14471d127ddc2276634cd2b2a43
2021-02-18 18:45:58 +00:00
Dhiraj Jadhav
a98846d8d5 Merge "Revert "Revert "Revert "Set a default ACL on /data/media/userId."""" 2021-02-18 17:38:20 +00:00
Dhiraj Jadhav
72005fd1e6 Revert "Revert "Revert "Set a default ACL on /data/media/userId."""
This reverts commit ea9681e4cd.

Reason for revert: storage Permission causing b/179362637 adb push to fail

Change-Id: Ibc1d8b5b685c22545b7e2d15de58059960b87e14
2021-02-18 04:57:03 +00:00
Eric Biggers
fec0c0e472 Add syncs when creating parent directories
vold creates some directories for storing encryption keys if they don't
already exist, potentially including parent directories:

    /metadata/vold/metadata_encryption
    /data/misc/vold/volume_keys/$volume_uuid
    /data/misc_de/$user/vold/volume_keys/$volume_uuid
    /data/misc_ce/$user/vold/volume_keys/$volume_uuid

Currently fs_mkdirs() is used for this.  However, fs_mkdirs() doesn't
include the fsync()s of the parent directories that are needed to ensure
that the new directories are persisted to disk right away -- which is
important for encryption keys.

Add a utility function MkdirsSync() which does what is needed, and make
the appropriate places call it.

Test: Booted and checked log for "Created directory" message.
      Also ran 'atest vold_tests' to run the new unit test.
Change-Id: Ie9917b616433080139b8db3fd6877203ee6faf77
2021-02-16 16:18:53 -08:00
Eric Biggers
3345a2a98c Sync parent directory in storeKeyAtomically()
When an FBE or metadata encryption key is created, it's important that
it be persisted to disk right away; otherwise the device may fail to
boot after an unclean shutdown.  storeKey() has the needed fsync()s.
However, storeKeyAtomically() doesn't, as it doesn't fsync() the parent
directory of key_path after it renames tmp_path to it.

Two callers do fsync() the parent directory themselves, but others
don't.  E.g., the metadata encryption key doesn't get properly synced.

Therefore, add the needed fsync() to storeKeyAtomically() so that it
gets done for everyone.

Also remove the now-unneeded fsync()s from the two callers that did it
themselves.

Change-Id: I342ebd94f0a3d2bf3a7a443c35b6bda0f12e1ab2
2021-02-16 16:05:38 -08:00
Eric Biggers
bd138dd08a Move pathExists() to Utils.cpp
This is useful as a general utility function.

Change-Id: Id43fc106dc6c544c6e4ce65f10c7d4246b99e54a
2021-02-16 16:05:38 -08:00
Treehugger Robot
7adfeab6a4 Merge "[LSC] Add LOCAL_LICENSE_KINDS to system/vold" am: 810bcca4d0 am: c7c9cfbf9f am: 64d5e281ad
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1589008

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ib75d7199304e2ed5da6d6145d8be1ce1f06e3327
2021-02-16 01:02:04 +00:00
Treehugger Robot
64d5e281ad Merge "[LSC] Add LOCAL_LICENSE_KINDS to system/vold" am: 810bcca4d0 am: c7c9cfbf9f
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1589008

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ib8dbb252b72c8c7c102ed39747be613d16707121
2021-02-16 00:31:33 +00:00
Treehugger Robot
c7c9cfbf9f Merge "[LSC] Add LOCAL_LICENSE_KINDS to system/vold" am: 810bcca4d0
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1589008

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: If9313dcc2a75e117374543fb9050aa1a7e0410f4
2021-02-15 23:48:04 +00:00
Treehugger Robot
810bcca4d0 Merge "[LSC] Add LOCAL_LICENSE_KINDS to system/vold" 2021-02-15 23:21:47 +00:00
Bob Badour
8eb43ae497 [LSC] Add LOCAL_LICENSE_KINDS to system/vold
Added SPDX-license-identifier-Apache-2.0 to:
  Android.bp
  bench/inodeop_bench/Android.bp
  tests/Android.bp

Bug: 68860345
Bug: 151177513
Bug: 151953481

Test: m all

Exempt-From-Owner-Approval: janitorial work
Change-Id: I91823c7097d7bee39a363a0c0cc30de13e4d7539
2021-02-14 10:37:25 -08:00
Treehugger Robot
f26b013a19 Merge "Obtain incfs features early in the booting sequence." am: 915f6227a7 am: a9838cc3d3 am: ef885d3deb
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1585413

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I1af24c06a0fa58f11a754bfc22b43f0a7837e12b
2021-02-13 10:16:50 +00:00
Treehugger Robot
ef885d3deb Merge "Obtain incfs features early in the booting sequence." am: 915f6227a7 am: a9838cc3d3
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1585413

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I04cd9b63a12e5ca9eacf2cb26be83a903893e1d5
2021-02-13 09:44:00 +00:00
Treehugger Robot
a9838cc3d3 Merge "Obtain incfs features early in the booting sequence." am: 915f6227a7
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1585413

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I695d55952de65a940602efd2387611e00bbde0ec
2021-02-13 09:09:08 +00:00
Treehugger Robot
915f6227a7 Merge "Obtain incfs features early in the booting sequence." 2021-02-13 06:32:14 +00:00
Alex Buynytskyy
b02e7b698e Obtain incfs features early in the booting sequence.
Has to be done before SystemConfig initialization to set correct
Incremental version feature.

Bug: 180010901
Test: atest PackageManagerShellCommandTest PackageManagerShellCommandIncrementalTest IncrementalServiceTest PackageManagerServiceTest ChecksumsTest
Change-Id: I262d1f06aecb481f37bf82005c85fed02c476510
2021-02-12 08:39:13 -08:00
Ricky Wai
61d1e01375 Change mounting storage data and obb to on by default
Bug: 148049767
Test: atest AdoptableHostTest
Test: pass cts/cts_postsubmit_cf_stable-cloud-tf
Ignore-AOSP-First: Another CL on same topic has merge conflict from aosp to internal master
Change-Id: I46a0954489816df3651f2fc90d85b389fc38087f
2021-02-03 10:00:05 +00:00
Martijn Coenen
4b3897bbdf Merge "Revert "Revert "Set a default ACL on /data/media/userId.""" am: 2e8f0d438b am: 62ed9d52db am: dd6ebf8878
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1566179

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Id79ce8f618bf52e166cb0d0dbec0856c1435581e
2021-02-01 14:51:31 +00:00
Martijn Coenen
dd6ebf8878 Merge "Revert "Revert "Set a default ACL on /data/media/userId.""" am: 2e8f0d438b am: 62ed9d52db
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1566179

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I6f8b60b5d0345ae7563446d90125bfbbc7b93371
2021-02-01 14:06:58 +00:00
Martijn Coenen
62ed9d52db Merge "Revert "Revert "Set a default ACL on /data/media/userId.""" am: 2e8f0d438b
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1566179

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I4464d2bcb23434832a7448ef59d079079a5c809d
2021-02-01 13:47:40 +00:00
Martijn Coenen
2e8f0d438b Merge "Revert "Revert "Set a default ACL on /data/media/userId.""" 2021-02-01 13:30:04 +00:00
Martijn Coenen
ea9681e4cd Revert "Revert "Set a default ACL on /data/media/userId.""
This reverts commit b276e80aec.

Reason for revert: b/177926359 is now fixed

Change-Id: I8ec5d80a44fc9e491ab3430592e17d10a82f40ea
2021-02-01 07:57:02 +00:00
Seth Moore
e6ed5c0b7d Merge "Add support for binding storage encryption to a seed" am: 6207c9cde4 am: 4c110af013 am: 0bdfada404
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1553317

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I496422108eedcb352d2fb45181ba4fc035c59e19
2021-01-27 04:19:46 +00:00
Treehugger Robot
b9fdf8987d Merge "Specify version for aidl_interface explicitly" am: 8e10f698ef am: 5f6d86597e am: 97bc46aabd
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1560413

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I667a54723d93a39150bd9044c6d4306942a63ea2
2021-01-27 04:16:35 +00:00
Seth Moore
0bdfada404 Merge "Add support for binding storage encryption to a seed" am: 6207c9cde4 am: 4c110af013
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1553317

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ib2d7a8c3538ab8c43e1fe4d783bf2b5d83c826ca
2021-01-27 01:36:30 +00:00
Seth Moore
4c110af013 Merge "Add support for binding storage encryption to a seed" am: 6207c9cde4
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1553317

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I0d60971d77f26bb43a73938895f9e343ced7081a
2021-01-27 01:16:34 +00:00
Seth Moore
6207c9cde4 Merge "Add support for binding storage encryption to a seed" 2021-01-27 00:40:35 +00:00
Treehugger Robot
97bc46aabd Merge "Specify version for aidl_interface explicitly" am: 8e10f698ef am: 5f6d86597e
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1560413

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I5bd8294901a465547eca3bac81359d892cfef94c
2021-01-26 23:52:09 +00:00
Treehugger Robot
5f6d86597e Merge "Specify version for aidl_interface explicitly" am: 8e10f698ef
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1560413

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I3038929c8745731c9292540e846d6ca34de7cdb7
2021-01-26 23:29:27 +00:00
Treehugger Robot
8e10f698ef Merge "Specify version for aidl_interface explicitly" 2021-01-26 22:28:23 +00:00
Seth Moore
5a43d61e66 Add support for binding storage encryption to a seed
With this change, vold exposes an API that may be used to bind key
storage encryption keys to a given seed value. The seed value passed to
vold must be consistent across reboots, or key storage keys will not be
derived consistently. The seed is expected to be set very early in boot,
prior to the use of any key storage encryption keys.

This feature is intended to be used for embedded applications such as
in autos, where the seed may be provided by some other component of the
system. In such systems, there is a default user that is automatically
signed in without a PIN or other credentials. By binding the file
encryption to a platform-provided seed, the default user's data gains
additional protection against removal of the Android embedded device
from the integrated system.

Bug: 157501579
Test: Set seed at startup via init.rc. Seed changes fail as expected.
Change-Id: I9b048ec5e045b84c45883724ace2356d4ef6244d
2021-01-26 21:30:19 +00:00
Jeongik Cha
89253240ec Specify version for aidl_interface explicitly
Bug: 150578172
Test: m
Change-Id: Ie51caa503b6b1e5c29372b85d0357be292144126
2021-01-26 22:35:14 +09:00
Yurii Zubrytskyi
a4b424ef64 Merge "IncFS: pass over the new .blocks_written IncFS control file" 2021-01-25 16:47:23 +00:00
Martijn Coenen
1366d7be21 Merge "Revert "Set a default ACL on /data/media/userId."" am: d9cf8590cb am: 42c41b5b47 am: 90dbb464fe
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1555317

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I04519a7ceef5d44ebb73b0f4dcb3025f3a26ad6c
2021-01-21 10:29:41 +00:00
Martijn Coenen
90dbb464fe Merge "Revert "Set a default ACL on /data/media/userId."" am: d9cf8590cb am: 42c41b5b47
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1555317

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I2bf3ef0ce4d2c0fd5c50a84c3116949cf1c79893
2021-01-21 10:00:20 +00:00
Martijn Coenen
42c41b5b47 Merge "Revert "Set a default ACL on /data/media/userId."" am: d9cf8590cb
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1555317

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I7b2a139c70a8eb29ade6afed2f89cc9141ff149b
2021-01-21 09:40:48 +00:00
Martijn Coenen
d9cf8590cb Merge "Revert "Set a default ACL on /data/media/userId."" 2021-01-21 08:19:20 +00:00
Yifan Hong
f0699c6e20 Merge changes from topic "health_storage_aidl" am: 3355ff7790 am: 92e9e5d1ad am: f74c9a8a5b
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1550388

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I090449d360264c4388c4ef4cae7f6b0a90d90053
2021-01-20 20:49:06 +00:00
Yifan Hong
943b290209 Refactor HIDL HAL Dev GC invocation am: 8f0d45441c am: b586527450 am: c4f67a28f3
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1550387

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I70a8269151232c2faf07b5c06598bad5e7e79108
2021-01-20 20:49:05 +00:00