diff --git a/init/property_service.cpp b/init/property_service.cpp index 42dd5afcb2f0b1fffd61379d3d99ec9d055289e9..5f6c88dca6930864b0199169c6bf197c9cbf17e0 100644 --- a/init/property_service.cpp +++ b/init/property_service.cpp @@ -1064,6 +1064,13 @@ static void ProcessKernelCmdline() { } } +static void SetSafetyNetProps() { + InitPropertySet("ro.boot.flash.locked", "1"); + InitPropertySet("ro.boot.verifiedbootstate", "green"); + InitPropertySet("ro.boot.veritymode", "enforcing"); + InitPropertySet("ro.boot.vbmeta.device_state", "locked"); +} + void PropertyInit() { selinux_callback cb; cb.func_audit = PropertyAuditCallback; @@ -1078,6 +1085,12 @@ void PropertyInit() { LOG(FATAL) << "Failed to load serialized property info file"; } + // Report a valid verified boot chain to make Google SafetyNet integrity + // checks pass. This needs to be done before parsing the kernel cmdline as + // these properties are read-only and will be set to invalid values with + // androidboot cmdline arguments. + SetSafetyNetProps(); + // If arguments are passed both on the command line and in DT, // properties set in DT always have priority over the command-line ones. ProcessKernelDt();