adb: early-mount: fix verity toggle through adb for early mount

verity toggle through adb failed to work for early mount due to fstab
entries being moved into kernel/dt. This change fixes that by using the
new fs_mgr_read_fstab_default() api that will make sure all fstab
entries (from dt as well as from /fstab.{ro.hardware}) are combined
before returning the fstab object.

b/27805372

Test: early mount /system and /vendor on angler.
- test adb disable-verity && adb root to ensure rebooted instance
doesn't have 'partition.system.verified' property set. i.e. verity is
indeed disabled.

- test adb enable-verity && adb root to ensure rebooted instance does
have 'partition.system.verified' property set, i.e. verity is enabled.
also verified by trying to do 'adb remount' which correctly warns about
verity

Change-Id: Iffdcc0a0b959a65c326219bd4e9e41cba9ec7c88
Signed-off-by: Sandeep Patil <sspatil@google.com>
This commit is contained in:
Sandeep Patil 2017-02-23 16:26:21 -08:00
parent c20c0c2cdd
commit f134fe07b8

View file

@ -108,11 +108,10 @@ void set_verity_enabled_state_service(int fd, void* cookie) {
return;
}
std::string fstab_filename = "/fstab." + android::base::GetProperty("ro.hardware", "");
fstab = fs_mgr_read_fstab(fstab_filename.c_str());
// read all fstab entries at once from all sources
fstab = fs_mgr_read_fstab_default();
if (!fstab) {
WriteFdFmt(fd, "Failed to open %s\nMaybe run adb root?\n", fstab_filename.c_str());
WriteFdFmt(fd, "Failed to read fstab\nMaybe run adb root?\n");
return;
}