Loading adb/daemon/usb.cpp +36 −12 Original line number Diff line number Diff line Loading @@ -304,33 +304,57 @@ struct UsbFfsConnection : public Connection { switch (event.type) { case FUNCTIONFS_BIND: CHECK(!bound) << "received FUNCTIONFS_BIND while already bound?"; CHECK(!enabled) << "received FUNCTIONFS_BIND while already enabled?"; bound = true; if (bound) { LOG(WARNING) << "received FUNCTIONFS_BIND while already bound?"; running = false; } if (enabled) { LOG(WARNING) << "received FUNCTIONFS_BIND while already enabled?"; running = false; } bound = true; break; case FUNCTIONFS_ENABLE: CHECK(bound) << "received FUNCTIONFS_ENABLE while not bound?"; CHECK(!enabled) << "received FUNCTIONFS_ENABLE while already enabled?"; enabled = true; if (!bound) { LOG(WARNING) << "received FUNCTIONFS_ENABLE while not bound?"; running = false; } if (enabled) { LOG(WARNING) << "received FUNCTIONFS_ENABLE while already enabled?"; running = false; } enabled = true; StartWorker(); break; case FUNCTIONFS_DISABLE: CHECK(bound) << "received FUNCTIONFS_DISABLE while not bound?"; CHECK(enabled) << "received FUNCTIONFS_DISABLE while not enabled?"; enabled = false; if (!bound) { LOG(WARNING) << "received FUNCTIONFS_DISABLE while not bound?"; } if (!enabled) { LOG(WARNING) << "received FUNCTIONFS_DISABLE while not enabled?"; } enabled = false; running = false; break; case FUNCTIONFS_UNBIND: CHECK(!enabled) << "received FUNCTIONFS_UNBIND while still enabled?"; CHECK(bound) << "received FUNCTIONFS_UNBIND when not bound?"; bound = false; if (enabled) { LOG(WARNING) << "received FUNCTIONFS_UNBIND while still enabled?"; } if (!bound) { LOG(WARNING) << "received FUNCTIONFS_UNBIND when not bound?"; } bound = false; running = false; break; } Loading fs_mgr/fs_mgr.cpp +2 −10 Original line number Diff line number Diff line Loading @@ -1602,14 +1602,6 @@ bool fs_mgr_load_verity_state(int* mode) { return true; } std::string fs_mgr_get_verity_device_name(const FstabEntry& entry) { if (entry.mount_point == "/") { // In AVB, the dm device name is vroot instead of system. return entry.fs_mgr_flags.avb ? "vroot" : "system"; } return Basename(entry.mount_point); } bool fs_mgr_is_verity_enabled(const FstabEntry& entry) { if (!entry.fs_mgr_flags.verify && !entry.fs_mgr_flags.avb) { return false; Loading @@ -1617,7 +1609,7 @@ bool fs_mgr_is_verity_enabled(const FstabEntry& entry) { DeviceMapper& dm = DeviceMapper::Instance(); std::string mount_point = fs_mgr_get_verity_device_name(entry); std::string mount_point = GetVerityDeviceName(entry); if (dm.GetState(mount_point) == DmDeviceState::INVALID) { return false; } Loading Loading @@ -1646,7 +1638,7 @@ bool fs_mgr_verity_is_check_at_most_once(const android::fs_mgr::FstabEntry& entr } DeviceMapper& dm = DeviceMapper::Instance(); std::string device = fs_mgr_get_verity_device_name(entry); std::string device = GetVerityDeviceName(entry); std::vector<DeviceMapper::TargetInfo> table; if (dm.GetState(device) == DmDeviceState::INVALID || !dm.GetTableInfo(device, &table)) { Loading fs_mgr/fs_mgr_fstab.cpp +11 −0 Original line number Diff line number Diff line Loading @@ -768,6 +768,17 @@ FstabEntry BuildGsiSystemFstabEntry() { return system; } std::string GetVerityDeviceName(const FstabEntry& entry) { std::string base_device; if (entry.mount_point == "/") { // In AVB, the dm device name is vroot instead of system. base_device = entry.fs_mgr_flags.avb ? "vroot" : "system"; } else { base_device = android::base::Basename(entry.mount_point); } return base_device + "-verity"; } } // namespace fs_mgr } // namespace android Loading fs_mgr/fs_mgr_remount.cpp +7 −0 Original line number Diff line number Diff line Loading @@ -340,6 +340,7 @@ int main(int argc, char* argv[]) { blk_device = rentry.blk_device; break; } // Find overlayfs mount point? if ((mount_point == "/") && (rentry.mount_point == "/system")) { blk_device = rentry.blk_device; mount_point = "/system"; Loading @@ -352,6 +353,12 @@ int main(int argc, char* argv[]) { } fs_mgr_set_blk_ro(blk_device, false); // Find system-as-root mount point? if ((mount_point == "/system") && !GetEntryForMountPoint(&mounts, mount_point) && GetEntryForMountPoint(&mounts, "/")) { mount_point = "/"; } // Now remount! if (::mount(blk_device.c_str(), mount_point.c_str(), entry.fs_type.c_str(), MS_REMOUNT, nullptr) == 0) { Loading fs_mgr/include_fstab/fstab/fstab.h +5 −0 Original line number Diff line number Diff line Loading @@ -107,5 +107,10 @@ FstabEntry BuildGsiSystemFstabEntry(); std::set<std::string> GetBootDevices(); // Return the name of the dm-verity device for the given fstab entry. This does // not check whether the device is valid or exists; it merely returns the // expected name. std::string GetVerityDeviceName(const FstabEntry& entry); } // namespace fs_mgr } // namespace android Loading
adb/daemon/usb.cpp +36 −12 Original line number Diff line number Diff line Loading @@ -304,33 +304,57 @@ struct UsbFfsConnection : public Connection { switch (event.type) { case FUNCTIONFS_BIND: CHECK(!bound) << "received FUNCTIONFS_BIND while already bound?"; CHECK(!enabled) << "received FUNCTIONFS_BIND while already enabled?"; bound = true; if (bound) { LOG(WARNING) << "received FUNCTIONFS_BIND while already bound?"; running = false; } if (enabled) { LOG(WARNING) << "received FUNCTIONFS_BIND while already enabled?"; running = false; } bound = true; break; case FUNCTIONFS_ENABLE: CHECK(bound) << "received FUNCTIONFS_ENABLE while not bound?"; CHECK(!enabled) << "received FUNCTIONFS_ENABLE while already enabled?"; enabled = true; if (!bound) { LOG(WARNING) << "received FUNCTIONFS_ENABLE while not bound?"; running = false; } if (enabled) { LOG(WARNING) << "received FUNCTIONFS_ENABLE while already enabled?"; running = false; } enabled = true; StartWorker(); break; case FUNCTIONFS_DISABLE: CHECK(bound) << "received FUNCTIONFS_DISABLE while not bound?"; CHECK(enabled) << "received FUNCTIONFS_DISABLE while not enabled?"; enabled = false; if (!bound) { LOG(WARNING) << "received FUNCTIONFS_DISABLE while not bound?"; } if (!enabled) { LOG(WARNING) << "received FUNCTIONFS_DISABLE while not enabled?"; } enabled = false; running = false; break; case FUNCTIONFS_UNBIND: CHECK(!enabled) << "received FUNCTIONFS_UNBIND while still enabled?"; CHECK(bound) << "received FUNCTIONFS_UNBIND when not bound?"; bound = false; if (enabled) { LOG(WARNING) << "received FUNCTIONFS_UNBIND while still enabled?"; } if (!bound) { LOG(WARNING) << "received FUNCTIONFS_UNBIND when not bound?"; } bound = false; running = false; break; } Loading
fs_mgr/fs_mgr.cpp +2 −10 Original line number Diff line number Diff line Loading @@ -1602,14 +1602,6 @@ bool fs_mgr_load_verity_state(int* mode) { return true; } std::string fs_mgr_get_verity_device_name(const FstabEntry& entry) { if (entry.mount_point == "/") { // In AVB, the dm device name is vroot instead of system. return entry.fs_mgr_flags.avb ? "vroot" : "system"; } return Basename(entry.mount_point); } bool fs_mgr_is_verity_enabled(const FstabEntry& entry) { if (!entry.fs_mgr_flags.verify && !entry.fs_mgr_flags.avb) { return false; Loading @@ -1617,7 +1609,7 @@ bool fs_mgr_is_verity_enabled(const FstabEntry& entry) { DeviceMapper& dm = DeviceMapper::Instance(); std::string mount_point = fs_mgr_get_verity_device_name(entry); std::string mount_point = GetVerityDeviceName(entry); if (dm.GetState(mount_point) == DmDeviceState::INVALID) { return false; } Loading Loading @@ -1646,7 +1638,7 @@ bool fs_mgr_verity_is_check_at_most_once(const android::fs_mgr::FstabEntry& entr } DeviceMapper& dm = DeviceMapper::Instance(); std::string device = fs_mgr_get_verity_device_name(entry); std::string device = GetVerityDeviceName(entry); std::vector<DeviceMapper::TargetInfo> table; if (dm.GetState(device) == DmDeviceState::INVALID || !dm.GetTableInfo(device, &table)) { Loading
fs_mgr/fs_mgr_fstab.cpp +11 −0 Original line number Diff line number Diff line Loading @@ -768,6 +768,17 @@ FstabEntry BuildGsiSystemFstabEntry() { return system; } std::string GetVerityDeviceName(const FstabEntry& entry) { std::string base_device; if (entry.mount_point == "/") { // In AVB, the dm device name is vroot instead of system. base_device = entry.fs_mgr_flags.avb ? "vroot" : "system"; } else { base_device = android::base::Basename(entry.mount_point); } return base_device + "-verity"; } } // namespace fs_mgr } // namespace android Loading
fs_mgr/fs_mgr_remount.cpp +7 −0 Original line number Diff line number Diff line Loading @@ -340,6 +340,7 @@ int main(int argc, char* argv[]) { blk_device = rentry.blk_device; break; } // Find overlayfs mount point? if ((mount_point == "/") && (rentry.mount_point == "/system")) { blk_device = rentry.blk_device; mount_point = "/system"; Loading @@ -352,6 +353,12 @@ int main(int argc, char* argv[]) { } fs_mgr_set_blk_ro(blk_device, false); // Find system-as-root mount point? if ((mount_point == "/system") && !GetEntryForMountPoint(&mounts, mount_point) && GetEntryForMountPoint(&mounts, "/")) { mount_point = "/"; } // Now remount! if (::mount(blk_device.c_str(), mount_point.c_str(), entry.fs_type.c_str(), MS_REMOUNT, nullptr) == 0) { Loading
fs_mgr/include_fstab/fstab/fstab.h +5 −0 Original line number Diff line number Diff line Loading @@ -107,5 +107,10 @@ FstabEntry BuildGsiSystemFstabEntry(); std::set<std::string> GetBootDevices(); // Return the name of the dm-verity device for the given fstab entry. This does // not check whether the device is valid or exists; it merely returns the // expected name. std::string GetVerityDeviceName(const FstabEntry& entry); } // namespace fs_mgr } // namespace android