]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: x86/mmu: Set SPTE_AD_WRPROT_ONLY_MASK if and only if PML is enabled
authorSean Christopherson <seanjc@google.com>
Thu, 25 Feb 2021 20:47:26 +0000 (12:47 -0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 26 Feb 2021 09:43:29 +0000 (04:43 -0500)
commit73fc860009b868ad0de2e4aa73c4a8f369861f20
tree2f8364163fcf233b0db88166b961f7611dfe34bf
parent47eb7e2861af7d908eb1019a45eb3d802d6d9813
KVM: x86/mmu: Set SPTE_AD_WRPROT_ONLY_MASK if and only if PML is enabled

Check that PML is actually enabled before setting the mask to force a
SPTE to be write-protected.  The bits used for the !AD_ENABLED case are
in the upper half of the SPTE.  With 64-bit paging and EPT, these bits
are ignored, but with 32-bit PAE paging they are reserved.  Setting them
for L2 SPTEs without checking PML breaks NPT on 32-bit KVM.

Fixes: af84c08f4002 ("KVM: x86: fix nested guest live migration with PML")
Cc: stable@vger.kernel.org
Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20210225204749.1512652-2-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/mmu/mmu_internal.h