From f134fe07b842e4bd4fb9194a5806b19417ceaeef Mon Sep 17 00:00:00 2001 From: Sandeep Patil Date: Thu, 23 Feb 2017 16:26:21 -0800 Subject: [PATCH] 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 --- adb/set_verity_enable_state_service.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/adb/set_verity_enable_state_service.cpp b/adb/set_verity_enable_state_service.cpp index f9e028b8d..76b156d66 100644 --- a/adb/set_verity_enable_state_service.cpp +++ b/adb/set_verity_enable_state_service.cpp @@ -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; }