Commit 8d334b8e authored by Andrey Pronin's avatar Andrey Pronin Committed by Commit Bot

Re-issue TpmCanAttemptOwnership on each boot if needed

If owning a tpm was interrupted after TpmCanAttemptOwnership was
issued but before the tpm was owned, the tpm could forever remain
uninitialized. Re-issue the command on each boot if cryptohomed
does not report that the tpm is ready to make sure the signal is
not missed. The command is relatively cheap in any case - it launches
an async thread that checks if all initializations are done, and
performs only the missing stages.

R=alemate@chromium.org

Bug: b/66923649
Change-Id: I3be0c4c8ee8fd2c21ddab930346c1a1deb069135
Reviewed-on: https://chromium-review.googlesource.com/688763Reviewed-by: default avatarDarren Krahn <dkrahn@chromium.org>
Reviewed-by: default avatarAlexander Alekseev <alemate@chromium.org>
Reviewed-by: default avatarMattias Nissler <mnissler@chromium.org>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Andrey Pronin <apronin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#510111}
parent 160e435e
......@@ -252,6 +252,18 @@ void GetSystemSlotOnIOThread(
}
}
// Verifies if shall signal to the platform that it can attempt owning
// the tpm. This signal is sent on every boot after it has been initially
// allowed by accepting EULA to make sure we are not stuck in interrupted
// tpm initialization state.
bool ShallAttemptTpmOwnership() {
#if defined(GOOGLE_CHROME_BUILD)
return StartupUtils::IsEulaAccepted();
#else
return true;
#endif
}
} // namespace
namespace internal {
......@@ -535,6 +547,16 @@ class SystemTokenCertDBInitializer {
if (!tpm_is_ready.has_value() || !tpm_is_ready.value()) {
VLOG(1) << "SystemTokenCertDBInitializer: TPM is not ready - not loading "
"system token.";
if (ShallAttemptTpmOwnership()) {
// Signal to cryptohome that it can attempt TPM ownership, if it
// haven't done that yet. The previous signal from EULA dialogue could
// have been lost if initialization was interrupted.
// We don't care about the result, and don't block waiting for it.
LOG(WARNING) << "Request attempting TPM ownership.";
DBusThreadManager::Get()->GetCryptohomeClient()->TpmCanAttemptOwnership(
EmptyVoidDBusMethodCallback());
}
return;
}
VLOG(1)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment