Merge "Pass wiped and fs_type to vold to format encrypted partition" am: 7ef01c913f
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1530481 MUST ONLY BE SUBMITTED BY AUTOMERGER Change-Id: I5cbc187c695039a36fad74de4fd5fdf318b87aff
This commit is contained in:
commit
73e781bb04
1 changed files with 25 additions and 2 deletions
|
|
@ -1324,6 +1324,7 @@ MountAllResult fs_mgr_mount_all(Fstab* fstab, int mount_mode) {
|
||||||
int error_count = 0;
|
int error_count = 0;
|
||||||
CheckpointManager checkpoint_manager;
|
CheckpointManager checkpoint_manager;
|
||||||
AvbUniquePtr avb_handle(nullptr);
|
AvbUniquePtr avb_handle(nullptr);
|
||||||
|
bool wiped = false;
|
||||||
|
|
||||||
bool userdata_mounted = false;
|
bool userdata_mounted = false;
|
||||||
if (fstab->empty()) {
|
if (fstab->empty()) {
|
||||||
|
|
@ -1457,7 +1458,8 @@ MountAllResult fs_mgr_mount_all(Fstab* fstab, int mount_mode) {
|
||||||
encryptable = status;
|
encryptable = status;
|
||||||
if (status == FS_MGR_MNTALL_DEV_NEEDS_METADATA_ENCRYPTION) {
|
if (status == FS_MGR_MNTALL_DEV_NEEDS_METADATA_ENCRYPTION) {
|
||||||
if (!call_vdc({"cryptfs", "encryptFstab", attempted_entry.blk_device,
|
if (!call_vdc({"cryptfs", "encryptFstab", attempted_entry.blk_device,
|
||||||
attempted_entry.mount_point},
|
attempted_entry.mount_point, wiped ? "true" : "false",
|
||||||
|
attempted_entry.fs_type},
|
||||||
nullptr)) {
|
nullptr)) {
|
||||||
LERROR << "Encryption failed";
|
LERROR << "Encryption failed";
|
||||||
set_type_property(encryptable);
|
set_type_property(encryptable);
|
||||||
|
|
@ -1474,7 +1476,7 @@ MountAllResult fs_mgr_mount_all(Fstab* fstab, int mount_mode) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mounting failed, understand why and retry.
|
// Mounting failed, understand why and retry.
|
||||||
bool wiped = partition_wiped(current_entry.blk_device.c_str());
|
wiped = partition_wiped(current_entry.blk_device.c_str());
|
||||||
bool crypt_footer = false;
|
bool crypt_footer = false;
|
||||||
if (mount_errno != EBUSY && mount_errno != EACCES &&
|
if (mount_errno != EBUSY && mount_errno != EACCES &&
|
||||||
current_entry.fs_mgr_flags.formattable && wiped) {
|
current_entry.fs_mgr_flags.formattable && wiped) {
|
||||||
|
|
@ -1499,6 +1501,27 @@ MountAllResult fs_mgr_mount_all(Fstab* fstab, int mount_mode) {
|
||||||
} else if (current_entry.is_encryptable() && current_entry.key_loc == KEY_IN_FOOTER) {
|
} else if (current_entry.is_encryptable() && current_entry.key_loc == KEY_IN_FOOTER) {
|
||||||
crypt_footer = true;
|
crypt_footer = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// EncryptInplace will be used when vdc gives an error or needs to format partitions
|
||||||
|
// other than /data
|
||||||
|
if (should_use_metadata_encryption(current_entry) &&
|
||||||
|
current_entry.mount_point == "/data") {
|
||||||
|
|
||||||
|
// vdc->Format requires "ro.crypto.type" to set an encryption flag
|
||||||
|
encryptable = FS_MGR_MNTALL_DEV_IS_METADATA_ENCRYPTED;
|
||||||
|
set_type_property(encryptable);
|
||||||
|
|
||||||
|
if (!call_vdc({"cryptfs", "encryptFstab", current_entry.blk_device,
|
||||||
|
current_entry.mount_point, "true" /* shouldFormat */,
|
||||||
|
current_entry.fs_type},
|
||||||
|
nullptr)) {
|
||||||
|
LERROR << "Encryption failed";
|
||||||
|
} else {
|
||||||
|
userdata_mounted = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (fs_mgr_do_format(current_entry, crypt_footer) == 0) {
|
if (fs_mgr_do_format(current_entry, crypt_footer) == 0) {
|
||||||
// Let's replay the mount actions.
|
// Let's replay the mount actions.
|
||||||
i = top_idx - 1;
|
i = top_idx - 1;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue