Skip to content

Commit ca26337

Browse files
mydongistinyersascape
authored andcommitted
fastbootd: Allow using kernel commits to pass SafetyNet
When using kernel commits to pass SafetyNet and CTS like: proc: Remove verifiedbootstate flag from /proc/cmdline proc: Set androidboot.verifiedbootstate=green fastbootd returns the device as locked when flashing images or resizing partitions when flashing because it can't find androidboot.verifiedbootstate=orange in the kernel command line letting it know it's safe to flash. So if androidboot.verifiedbootstate is missing from the kernel command line or if is returning verifiedbootstate=green report the device as unlocked. PS2: Add support for androidboot.verifiedbootstate=green Change-Id: I56712f374ea26397ea5a183cfe100cf92e21d531 Signed-off-by: Jason Edson <jaysonedson@gmail.com>
1 parent 4ba6769 commit ca26337

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

fastboot/device/utility.cpp

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,24 @@ bool GetDeviceLockStatus() {
209209
if (!android::base::ReadFileToString("/proc/cmdline", &cmdline)) {
210210
return true;
211211
}
212-
return cmdline.find("androidboot.verifiedbootstate=orange") == std::string::npos;
212+
// Always return unlocked if androidboot.verifiedbootstate is missing
213+
// from the userspace kernel command line so kernel commits like:
214+
// proc: Remove verifiedbootstate flag from /proc/cmdline
215+
// can be used to pass the SafetyNet CTS check.
216+
//
217+
// Otherwise when using fastbootd the device will think it's locked
218+
// because androidboot.verifiedbootstate=orange isn't there.
219+
bool noverifiedbootstate =
220+
cmdline.find("androidboot.verifiedbootstate") == std::string::npos;
221+
bool verifiedbootstategreen =
222+
cmdline.find("androidboot.verifiedbootstate=green") != std::string::npos;
223+
if (noverifiedbootstate) {
224+
return false;
225+
} else if (verifiedbootstategreen) {
226+
return false;
227+
} else {
228+
return cmdline.find("androidboot.verifiedbootstate=orange") == std::string::npos;
229+
}
213230
}
214231

215232
bool UpdateAllPartitionMetadata(FastbootDevice* device, const std::string& super_name,

0 commit comments

Comments
 (0)