Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e33c0e54 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Mark fs-verity support for /metadata if first_api_level >= R"

parents 04eecd44 eb749382
Loading
Loading
Loading
Loading
+10 −2
Original line number Original line Diff line number Diff line
@@ -666,9 +666,11 @@ void TransformFstabForDsu(Fstab* fstab, const std::string& dsu_slot,
}
}


void EnableMandatoryFlags(Fstab* fstab) {
void EnableMandatoryFlags(Fstab* fstab) {
    // Devices launched in R and after should enable fs_verity on userdata. The flag causes tune2fs
    // Devices launched in R and after must support fs_verity. Set flag to cause tune2fs
    // to enable the feature. A better alternative would be to enable on mkfs at the beginning.
    // to enable the feature on userdata and metadata partitions.
    if (android::base::GetIntProperty("ro.product.first_api_level", 0) >= 30) {
    if (android::base::GetIntProperty("ro.product.first_api_level", 0) >= 30) {
        // Devices launched in R and after should enable fs_verity on userdata.
        // A better alternative would be to enable on mkfs at the beginning.
        std::vector<FstabEntry*> data_entries = GetEntriesForMountPoint(fstab, "/data");
        std::vector<FstabEntry*> data_entries = GetEntriesForMountPoint(fstab, "/data");
        for (auto&& entry : data_entries) {
        for (auto&& entry : data_entries) {
            // Besides ext4, f2fs is also supported. But the image is already created with verity
            // Besides ext4, f2fs is also supported. But the image is already created with verity
@@ -677,6 +679,12 @@ void EnableMandatoryFlags(Fstab* fstab) {
                entry->fs_mgr_flags.fs_verity = true;
                entry->fs_mgr_flags.fs_verity = true;
            }
            }
        }
        }
        // Devices shipping with S and earlier likely do not already have fs_verity enabled via
        // mkfs, so enable it here.
        std::vector<FstabEntry*> metadata_entries = GetEntriesForMountPoint(fstab, "/metadata");
        for (auto&& entry : metadata_entries) {
            entry->fs_mgr_flags.fs_verity = true;
        }
    }
    }
}
}