]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: X86: Ensure that dirty PDPTRs are loaded
authorLai Jiangshan <laijs@linux.alibaba.com>
Mon, 8 Nov 2021 12:43:53 +0000 (20:43 +0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 8 Dec 2021 09:24:58 +0000 (04:24 -0500)
commitd2efb21062952404f661c16dd5d140d1ddd91c67
tree1bb5577e0dbea3f99c0ecf5ff63933b562d24207
parent2213c1056c85ce6df90f781f2f2c5bd842d1a050
KVM: X86: Ensure that dirty PDPTRs are loaded

For VMX with EPT, dirty PDPTRs need to be loaded before the next vmentry
via vmx_load_mmu_pgd()

But not all paths that call load_pdptrs() will cause vmx_load_mmu_pgd()
to be invoked.  Normally, kvm_mmu_reset_context() is used to cause
KVM_REQ_LOAD_MMU_PGD, but sometimes it is skipped:

* commit 004e6e4a6f53("KVM: x86: do not reset mmu if CR0.CD and
CR0.NW are changed") skips kvm_mmu_reset_context() after load_pdptrs()
when changing CR0.CD and CR0.NW.

* commit a2955d149b93("KVM: x86: Invalidate all PGDs for the current
PCID on MOV CR3 w/ flush") skips KVM_REQ_LOAD_MMU_PGD after
load_pdptrs() when rewriting the CR3 with the same value.

* commit 4182b566cf30("KVM: X86: Don't reset mmu context when
toggling X86_CR4_PGE") skips kvm_mmu_reset_context() after
load_pdptrs() when changing CR4.PGE.

Fixes: 004e6e4a6f53 ("KVM: x86: do not reset mmu if CR0.CD and CR0.NW are changed")
Fixes: a2955d149b93 ("KVM: x86: Invalidate all PGDs for the current PCID on MOV CR3 w/ flush")
Fixes: 4182b566cf30 ("KVM: X86: Don't reset mmu context when toggling X86_CR4_PGE")
Signed-off-by: Lai Jiangshan <laijs@linux.alibaba.com>
Message-Id: <20211108124407.12187-2-jiangshanlai@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/x86.c