Remove IgnoreEarlyBootEnded()

Now that FDE is no longer supported, this is no longer needed.

Bug: 191796797
Change-Id: I71fd98e66fd0998b78b8d56507cc62e1a112263a
This commit is contained in:
Eric Biggers 2021-11-10 13:52:14 -08:00
parent 230d664e08
commit 72ca0cf3f9

View file

@ -26,7 +26,6 @@
#include <utils/Trace.h>
#include <stdio.h>
#include <sys/vfs.h>
#include <fstream>
#include <thread>
@ -912,42 +911,10 @@ static void initializeIncFs() {
incfs::features();
}
// This is missing from the kernel UAPI headers.
#define ST_RDONLY 0x0001
// FDE devices run the post-fs-data trigger (and hence also earlyBootEnded)
// multiple times, sometimes prior to the real /data being mounted. That causes
// keystore2 to try to open a file in /data, causing it to panic or have to be
// killed by vold later, causing problems (vold failing to connect to keystore2,
// or keystore2 operations erroring out later). As a workaround to keep FDE
// working, ignore these too-early calls to earlyBootEnded.
//
// This can be removed when support for FDE is removed.
static bool IgnoreEarlyBootEnded() {
// The statfs("/data") below should be sufficient by itself, but to be safe
// we also explicitly return false on FBE devices. (This really should be
// ro.crypto.type != "block" for "non-FDE devices", but on FDE devices this
// is sometimes called before ro.crypto.type gets set.)
if (fscrypt_is_native()) return false;
struct statfs buf;
if (statfs(DATA_MNT_POINT, &buf) != 0) {
PLOG(ERROR) << "statfs(\"/data\") failed";
return false;
}
if (buf.f_type == TMPFS_MAGIC || (buf.f_flags & ST_RDONLY)) {
LOG(INFO) << "Ignoring earlyBootEnded since real /data isn't mounted yet";
return true;
}
return false;
}
binder::Status VoldNativeService::earlyBootEnded() {
ENFORCE_SYSTEM_OR_ROOT;
ACQUIRE_LOCK;
if (IgnoreEarlyBootEnded()) return Ok();
initializeIncFs();
Keystore::earlyBootEnded();
return Ok();