From 9e21700282e1ad6ad3c89177d6bfcf6e1bc2fcee Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Fri, 12 Nov 2021 12:13:30 -0800 Subject: [PATCH] fs_mgr: allow any argument to encryptable There are some fstab files that specify "encryptable=footer" for adoptable storage volumes, which contradicts the documentation which says that it should be "encryptable=userdata". However, the argument was previously being ignored anyway. To avoid unnecessarily breaking such devices, ignore the argument to "encryptable". Note that we continue to only allow "encryptable" in combination with "voldmanaged". So, fstabs that use "encryptable" for FDE (rather than for adoptable storage) should continue to be rejected. Bug: 191796797 Change-Id: Idc4d5f9c01098f997e12be0022bea992439cec9c --- fs_mgr/fs_mgr_fstab.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/fs_mgr/fs_mgr_fstab.cpp b/fs_mgr/fs_mgr_fstab.cpp index 159be6772..2f335af65 100644 --- a/fs_mgr/fs_mgr_fstab.cpp +++ b/fs_mgr/fs_mgr_fstab.cpp @@ -188,9 +188,9 @@ bool ParseFsMgrFlags(const std::string& flags, FstabEntry* entry) { #undef CheckFlag // Then handle flags that take an argument. - if (flag == "encryptable=userdata") { + if (StartsWith(flag, "encryptable=")) { // The "encryptable" flag identifies adoptable storage volumes. The - // argument to this flag must be "userdata". + // argument to this flag is ignored, but it should be "userdata". // // Historical note: this flag was originally meant just for /data, // to indicate that FDE (full disk encryption) can be enabled. @@ -198,8 +198,7 @@ bool ParseFsMgrFlags(const std::string& flags, FstabEntry* entry) { // storage volumes. Today, FDE is no longer supported, leaving only // the adoptable storage volume meaning for this flag. entry->fs_mgr_flags.crypt = true; - } else if (StartsWith(flag, "encryptable=") || StartsWith(flag, "forceencrypt=") || - StartsWith(flag, "forcefdeorfbe=")) { + } else if (StartsWith(flag, "forceencrypt=") || StartsWith(flag, "forcefdeorfbe=")) { LERROR << "flag no longer supported: " << flag; return false; } else if (StartsWith(flag, "voldmanaged=")) {