TDX/non-ACT: failed TDH.PHYMEM.PAGE.WBINVD after successful page remove can leave a page unreset

From: 裴辰举

Date: Wed Apr 01 2026 - 08:17:39 EST



On non-ACT platforms, TDH.MEM.PAGE.REMOVE does not flush cachelines or initialize the removed page. KVM handles that by calling TDH.PHYMEM.PAGE.WBINVD
after a private page is removed.
The problem is the failure path after a successful remove:
KVM drops a private page.
TDH.MEM.PAGE.REMOVE succeeds, so the page is no longer assigned to the TD.
KVM then calls TDH.PHYMEM.PAGE.WBINVD.
If TDH.PHYMEM.PAGE.WBINVD fails, KVM marks the VM/TD dead and teardown follows.
At that point, TDH.PHYMEM.PAGE.RECLAIM will not process the page that hit the WBINVD failure, because that page has already been removed from the TD. Normally TDH.PHYMEM.PAGE.RECLAIM clears/reinitializes TD pages during teardown, but this page is no longer in that set. This seems to create a state hole: the page has been
removed from the TD, but it may never be fully reset/cleared for safe host reuse if the WBINVD step failed. Depending on later host-side handling, this can become
either a leaked page or an unsafe page reuse issue.