On Thu, 2025-08-07 at 13:51 -0700, Chris Fenner wrote:
> Hi all,
> 
> I'm investigating an issue where the TPM driver breaks on the latest
> upstream kernel. I believe I've tracked it down to the HMAC session
> feature that primarily lives in drivers/char/tpm/tpm2-sessions.c.
> 
> Our TPM doesn't support TPM2_ContextSave. So we get the following
> call stack during initialization:

This problem isn't really a mainstream one, though, is it?  TPM2
requires save and load context.  Supporting these commands was the
reason the TPM2 volatile handle space was reduced to 3.  You can't
manage a standard TPM2 without doing resource management, which
requires context save and restore.

[...
> It's not clear to me that the HMAC session feature solves its own
> threat model. Reading through the documentation at the top of
> https://github.com/torvalds/linux/blob/master/drivers/char/tpm/tpm2-sessions.c
> , it seems like we assume that the adversary either isn't
> sophisticated enough to interpose the CreatePrimary command, or that
> userspace somehow recovers trust after the fact by attesting the null
> key with the EK. I'm not sure how this is expected to work, given
> this userspace wasn't correctly measured into the TPM (due to the
> interposer) and could therefore be malicious.

Not exactly.  The way it is supposed to work is that the system stores
(and validates if it can) the signing EK on install (this is constant
for the lifetime of the TPM).  This is a key that can be generated (and
validated against the stored name) and used to certify the NULL name on
each boot.  So the kernel doesn't know the primary isn't interposed on
boot.  However, the booted system can validate it after the fact and if
the validation passes we know the boot was good.  The point being that
all TPM operations build on trusting the initial primary, but that
primary is constant for the entire boot, so it can be validated at any
point up until the TPM gets shutdown, including after it has been used,
without losing the chain of trust (provided the validation passes).

Regards,

James


Reply via email to