Re: [PATCH 6.1.y 2/2] KVM: x86: Check for invalid/obsolete root *after* making MMU pages available
Sean Christopherson <[email protected]>
| Newsgroups | org.kernel.vger.stable |
|---|---|
| Message-ID | <[email protected]> |
On Thu, Jul 30, 2026, Sasha Levin wrote: > From: Sean Christopherson <[email protected]> > > [ Upstream commit 2abd5287f08319fa35764566b15c6e22cb1068db ] > > Check for a "stale" page fault, i.e. for an invalid and/or obsolete root, > after making MMU pages available for the shadow MMU. If reclaiming shadow > pages zaps an in-use root, i.e. marks it invalid, then KVM will attempt to > map memory into an invalid root. On its own, populating an invalid root is > "fine", but because child shadow pages inherit their parent's role, any > children created during the map/fetch will be created as invalid pages, > thus violating KVM's invariant that invalid pages are never on the list of > active MMU pages. > > Note, the underlying flaw has existed since KVM first started tracking > invalid roots in 2008 (commit 2e53d63acba7, "KVM: MMU: ignore zapped root > pagetables"), but the true badness only came along in 2020 (Linux 5.9) > with the invariant that invalid shadow pages can't be on the list of > active pages. > > Note #2, inheriting role.invalid when creating child shadow pages is also > far from ideal; that flaw will be addressed separately. > > Reported-by: Hyunwoo Kim <[email protected]> > Fixes: f95eec9bed76 ("KVM: x86/mmu: Don't put invalid SPs back on the list of active pages") > Cc: [email protected] > Signed-off-by: Sean Christopherson <[email protected]> > Signed-off-by: Paolo Bonzini <[email protected]> > Signed-off-by: Sasha Levin <[email protected]> > --- Acked-by: Sean Christopherson <[email protected]>