]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
KVM: x86/mmu: Check for present SPTE when clearing dirty bit in TDP MMU
authorSean Christopherson <seanjc@google.com>
Sat, 26 Feb 2022 00:15:20 +0000 (00:15 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 8 Apr 2022 12:06:42 +0000 (14:06 +0200)
commitc252274fffcfb3bc2d585965cb3a6054e55823da
treee0a09b0c7d4c09afb07487d0bcac6d6fe339d378
parent0c8a8da182d4333d9bbb9131d765145568c847b2
KVM: x86/mmu: Check for present SPTE when clearing dirty bit in TDP MMU

commit 3354ef5a592d219364cf442c2f784ce7ad7629fd upstream.

Explicitly check for present SPTEs when clearing dirty bits in the TDP
MMU.  This isn't strictly required for correctness, as setting the dirty
bit in a defunct SPTE will not change the SPTE from !PRESENT to PRESENT.
However, the guarded MMU_WARN_ON() in spte_ad_need_write_protect() would
complain if anyone actually turned on KVM's MMU debugging.

Fixes: a6a0b05da9f3 ("kvm: x86/mmu: Support dirty logging for the TDP MMU")
Cc: Ben Gardon <bgardon@google.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Reviewed-by: Ben Gardon <bgardon@google.com>
Message-Id: <20220226001546.360188-3-seanjc@google.com>
Cc: stable@vger.kernel.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/kvm/mmu/tdp_mmu.c