From a6ae84ec5a9e99e39c096fa095d4b5e38d1412f3 Mon Sep 17 00:00:00 2001 From: Alessandro Astone Date: Sun, 6 Oct 2019 23:52:16 +0200 Subject: [PATCH] fs_mgr: mount: don't set the block device as ro for recovery * In recovery we need to be able to edit the block device after it's been mounted. This allows, for example, to wipe system after mounting it Change-Id: Ie536d275643e9d6063bba789e4cd2fa2671fc8fa --- fs_mgr/Android.bp | 5 +++++ fs_mgr/fs_mgr.cpp | 2 ++ 2 files changed, 7 insertions(+) diff --git a/fs_mgr/Android.bp b/fs_mgr/Android.bp index 87db98b08..1ef6688fd 100644 --- a/fs_mgr/Android.bp +++ b/fs_mgr/Android.bp @@ -159,6 +159,11 @@ cc_library { srcs: [ ":libfiemap_passthrough_srcs", ], + target: { + recovery: { + cflags: ["-DSKIP_SET_BLK_RO"], + }, + }, } cc_library { diff --git a/fs_mgr/fs_mgr.cpp b/fs_mgr/fs_mgr.cpp index 7f41cea83..6fd59148b 100644 --- a/fs_mgr/fs_mgr.cpp +++ b/fs_mgr/fs_mgr.cpp @@ -880,9 +880,11 @@ static int __mount(const std::string& source, const std::string& target, const F } PINFO << __FUNCTION__ << "(source=" << source << source_missing << ",target=" << target << target_missing << ",type=" << entry.fs_type << ")=" << ret; +#ifndef SKIP_SET_BLK_RO if ((ret == 0) && (mountflags & MS_RDONLY) != 0) { fs_mgr_set_blk_ro(source); } +#endif if (ret == 0) { android::base::SetProperty("ro.boottime.init.mount." + Basename(target), std::to_string(t.duration().count()));