Re: [RFC PATCH 06/15] virt: tdx-guest: Support TDI bind and unbind operations

From: Xu Yilun

Date: Tue Nov 17 2026 - 05:45:43 EST


On Mon, Nov 16, 2026 at 11:57:23PM +0000, Edgecombe, Rick P wrote:
> On Thu, 2026-11-12 at 20:56 +0800, Xu Yilun wrote:
> > > > >
> > > > > For errors that indicate uncooperative or buggy host, we elsewhere warn
> > > > > in
> > > > the
> > > > > TDX wrappers. But in coco, not handling an error in the caller can be an
> > > > avenue
> > > > > to attack the guest. So I guess we would commonly need to handle these
> >
> > The secure firmware should guarantee the attack can't impact TSM
> > security.
>
> We had some issues in core TDX guest where if the VMM lied to the guest it could
> cause shared pages to be returned page allocator. Due to an error not getting
> handled properly in many callers. This led to a debate about whether we should
> even handle the error, or just panic the guest if we see weird responses from
> the VMM. Ultimately we settled on a warn, due to the face that panic_on_warn
> should be set. For x86 code at least, we should be consistent.

I see. IIUC the problem is not the VMM lies or not, it is the guest
itself not be consistent about the page attribute: The caller ignores
the error and see the page private, but the guest PTE maps it share.

Actually the guest can't tell if the VMM lies by GHCI return code,
success or failure. The guest could alternatively ignore the return
code, update its PTE and return success, later the HW can guard the
inconsistency between the guest's view and the physical state when
accessing the page.

Of course the GHCI error detecting is useful to keep system stable when
working with benigh VMM. So I agree that we propagate errors and handle
in the caller for TDI LOCK/ATTESTATION/ACCEPT phase. But I also feel OK
to treat UNLOCK as always success - the kernel rarely fails on exit.
As long as the guest doesn't mess its own TDI state tracking, we are safe.

>
> So it was more about exposure to bugs then higher level issues.
>
> > For DDOS attack, the guest could always move the device to
> > untrusted mode.
>
> DDOS attack?

Sorry for the typo, DoS (Denial of Service).