On Fri, Apr 15, 2022 at 6:33 PM Lai Jiangshan <jiangshanlai@xxxxxxxxx> wrote: > > From: Lai Jiangshan <jiangshan.ljs@xxxxxxxxxxxx> > > When NPT enabled L1 is PAE paging, vcpu->arch.mmu->get_pdptrs() which > is nested_svm_get_tdp_pdptr() reads the guest NPT's PDPTE from memroy > unconditionally for each call. > > The guest PAE root page is not write-protected. > > The mmu->get_pdptrs() in FNAME(walk_addr_generic) might get different > values every time or it is different from the return value of > mmu->get_pdptrs() in mmu_alloc_shadow_roots(). > > And it will cause FNAME(fetch) installs the spte in a wrong sp > or links a sp to a wrong parent since FNAME(gpte_changed) can't > check these kind of changes. > > Cache the PDPTEs and the problem is resolved. The guest is responsible > to info the host if its PAE root page is updated which will cause > nested vmexit and the host updates the cache when next nested run. > > The commit e4e517b4be01 ("KVM: MMU: Do not unconditionally read PDPTE > from guest memory") fixs the same problem for non-nested case. > > Fixes: e4e517b4be01 ("KVM: MMU: Do not unconditionally read PDPTE from guest memory") > Signed-off-by: Lai Jiangshan <jiangshan.ljs@xxxxxxxxxxxx> Ping