On 12/08/2016 20:30, Jim Mattson wrote: > kvm_arch_vcpu_ioctl_set_sregs() has the following code to read the > PDPTEs from CR3: > > if (!is_long_mode(vcpu) && is_pae(vcpu)) { > load_pdptrs(vcpu, vcpu->arch.walk_mmu, kvm_read_cr3(vcpu)); > mmu_reset_needed = 1; > } > > This is incorrect if kvm_arch_vcpu_ioctl_set_sregs() is used to > restore checkpointed CPU state. The guest may have changed the > in-memory PDPTEs after they were cached by the CPU at CR3-load. There > should be a mechanism to save/restore the Guest PDPTE[0-3] fields from > the VMCS. > > Are we cutting corners here because SVM does? Or because no guest OS > is known to behave this way? A mix of both. There was no reason _not_ to pass PDPTRs around before SVM NPT was introduced (the first versions of KVM of course used shadow paging only), but no guest OS treats PDPTRs in a different way than other non-leaf entries of the page tables. Nowadays, the lack of PDPTR fields in the SVM VMCB is not a great incentive for implementing this... Paolo -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html