From efe209352edc4d5bf856d9de2bd1b0f382eba4c5 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Fri, 12 Nov 2021 13:07:04 -0800 Subject: [PATCH] fs_mgr: allow FDE options in recovery mode Unfortunately, some recovery fstabs still specify the FDE options, where they never really did anything anyway. Allow them for now, since it seems preferable to restrict any breakage to the case that really matters (devices actually configured to use FDE in their main fstab). Bug: 191796797 Bug: 206025578 Change-Id: I85e35af8f42d2aef91f08816a67a71bbf756b211 --- fs_mgr/fs_mgr_fstab.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/fs_mgr/fs_mgr_fstab.cpp b/fs_mgr/fs_mgr_fstab.cpp index 2f335af65..30d77b5d7 100644 --- a/fs_mgr/fs_mgr_fstab.cpp +++ b/fs_mgr/fs_mgr_fstab.cpp @@ -306,7 +306,13 @@ bool ParseFsMgrFlags(const std::string& flags, FstabEntry* entry) { } } - if (entry->fs_mgr_flags.crypt && !entry->fs_mgr_flags.vold_managed) { + // FDE is no longer supported, so reject "encryptable" when used without + // "vold_managed". For now skip this check when in recovery mode, since + // some recovery fstabs still contain the FDE options since they didn't do + // anything in recovery mode anyway (except possibly to cause the + // reservation of a crypto footer) and thus never got removed. + if (entry->fs_mgr_flags.crypt && !entry->fs_mgr_flags.vold_managed && + access("/system/bin/recovery", F_OK) != 0) { LERROR << "FDE is no longer supported; 'encryptable' can only be used for adoptable " "storage"; return false;