Re: [PATCH RFC 00/20] attestation: Add a common subsystem and TDX support

From: Jason Gunthorpe

Date: Thu Oct 29 2026 - 10:10:11 EST


On Wed, Oct 28, 2026 at 12:16:01PM -0700, Dave Jiang wrote:
>
>
> On 10/27/26 4:46 PM, Jason Gunthorpe wrote:
> > On Tue, Oct 27, 2026 at 04:09:19PM -0700, Dave Jiang wrote:
> >
> >> There are two issues for TDX Connect. One, the device info is collected at
> >> SPDM connect (TDH.SPDM.CONNECT), not at lock. TDH.TDI.BIND only returns the
> >> interface report. So the measurements a TD sees at lock can be from well
> >> before the lock. To get measurements taken after the bind, the TD has to
> >> ask the VMM for a recollection with its own nonce.
> >
> > IMHO measurements taken before lock must never be made visible through
> > this interface, it defeats the security property of evidence within
> > the locked session. I would expect the guest kernel TDX driver to
> > prevent this.
>
> Agreed. I'll change the guest driver so the lock asks the VMM for a
> recollection with a nonce the driver picks. Each lock then costs one
> recollection.

I do not understand why cached evidence exists in the host. What
reason is there to ever provide a stale signed evidence? None.

Other things may make more sense to capture once and are not permitted
to change, but evidence is not one of them.

> >> The empty challenge in my provider means something else though: don't
> >> recollect, return the evidence collected earlier. So it's less "omit the
> >> nonce" and more "no new collection". Maybe that's better as an explicit flag
> >> than an empty challenge?
> >
> > I'm not sure 'no new collection' is an especially useful thing. Since
> > the kernel won't be validating the signature you still need to pass
> > the expected nonce from the prior collection back to userspace so it
> > can check it.
> >
> > Is there some specific use case for this?
>
> Getting the lock event's evidence. With the suggested lock change
> above, the guest driver collects it during the lock. But the lock is
> a sysfs write and returns nothing. Userspace still has to read the
> evidence to appraise it before run. The device was already locked
> when it was collected, so the read needs no new collection.

Why collect evidence during lock with a useless kernel made up nonce?
What is that even for?

Signed evidence must always be collected with a userspace provided
nonce. Any path that doesn't do that is pointless and I wonder why it
exists at all.

I imagine lock should only put the TDI into the locked
state. Attestation should later collect the evidence with a user
provide nonce.

Do not collect evidence during locked. Do not hold stale signed
evidence in the kernel for later retrieval.

Again, we need a flow where we get into locked and know we are
continuously in the same locked session until we reach run and dma
enable. That should not be done with evidence or evidence generations,
it must be some contract inside the TDX driver to provide a locked
session generation.

Under these rules it does not matter when we collect the evidence. Any
time during the session is sufficient, it does not have to be done
instantly during locked.

How TDX does this is up to its spec, if TDX has to capture evidence
and do evidence compares internally thats awful, but has to be hidden
in TDX and not leak to userspace in any way.

ARM should do it with the sequence numbers I mentioned earlier.

> The guest driver picks the nonce for the lock's collection and
> checks it before publishing. If userspace sends a challenge instead,
> that nonce is its own. The collection's nonce is in the evidence in
> the GET_MEASUREMENTS request that asked for the signature.

Unless the kernel is decoding the evidence to check the nonce this is
security broken. I'd rather not have the kernel decode the evidence
like this, so the nonce should always be known to userspace and
userspace/verifier should be checking the signature covers the
expected nonce.

Jason