All of lore.kernel.org
 help / color / mirror / Atom feed
* Should we handle TPM_RC_RETRY internally?
@ 2018-03-15 18:02 James Bottomley
  2018-03-16 10:36 ` Javier Martinez Canillas
  2018-03-16 14:29 ` Jarkko Sakkinen
  0 siblings, 2 replies; 10+ messages in thread
From: James Bottomley @ 2018-03-15 18:02 UTC (permalink / raw)
  To: linux-integrity; +Cc: Jarkko Sakkinen

I was investigating an apparent bug in the trusted keys implementation
where periodically the key operation barfs and returns an error to
userspace.  It turns out this error is because the TPM returns
TPM_RC_RETRY to an operation.

The TPM spec is a bit unclear why the TPM would return TPM_RC_RETRY,
but it is clear that it may happen on a lot of operations.  I checked
with the microsoft reference implementation:

https://github.com/Microsoft/ms-tpm-20-ref/

Which implies it's only set if the lockout check is invoked by the
command and the previous TPM shutdown wasn't orderly.  It does seem to
me that I've only seen it involving objects with DA implications, which
explains why it's seen in trusted keys.

If I read the UEFI TPM API, it does automatic retries.  This is the
note:

    The firmware SHALL not return TPM2_RC_RETRY prior to the completion
    of the call to ExitBootServices().

    Implementer's Note: the implementation of this function should check
    the return value in the TPM response and, if it is TPM2_RC_RETRY,
    resend the command. The implementation may abort if a sufficient
    number of retries has been done.

I really think if UEFI does it, we should do it too (and it will fix my
trusted key bug).

What does everyone else think?  If it's agreed, I'll code up the patch.

James

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2018-03-20  6:06 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-15 18:02 Should we handle TPM_RC_RETRY internally? James Bottomley
2018-03-16 10:36 ` Javier Martinez Canillas
2018-03-16 14:31   ` Jarkko Sakkinen
2018-03-19  4:40   ` Philip Tricca
2018-03-19 21:35     ` Jarkko Sakkinen
2018-03-16 14:29 ` Jarkko Sakkinen
2018-03-16 15:48   ` James Bottomley
2018-03-19 21:26     ` Jarkko Sakkinen
     [not found]     ` <CAP7wa8Kq_++HasQY6bZ9idJ_TDOyXhnRAmyUY6t1B+HZWKF8ig@mail.gmail.com>
2018-03-19 21:34       ` Jarkko Sakkinen
2018-03-20  6:06       ` James Bottomley

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.