]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
KVM: nVMX: Don't clobber nested MMU's A/D status on EPTP switch
authorSean Christopherson <seanjc@google.com>
Wed, 9 Jun 2021 23:42:23 +0000 (16:42 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 14 Jul 2021 14:59:36 +0000 (16:59 +0200)
commit2e4093f2b730886c04ddc2707aa1ca428962aaf4
tree84e883ad220b31aa6184f92d7409277a0e569a00
parent6051edb62906b0a265bc0933667a16aa660e3cec
KVM: nVMX: Don't clobber nested MMU's A/D status on EPTP switch

[ Upstream commit 272b0a998d084e7667284bdd2d0c675c6a2d11de ]

Drop bogus logic that incorrectly clobbers the accessed/dirty enabling
status of the nested MMU on an EPTP switch.  When nested EPT is enabled,
walk_mmu points at L2's _legacy_ page tables, not L1's EPT for L2.

This is likely a benign bug, as mmu->ept_ad is never consumed (since the
MMU is not a nested EPT MMU), and stuffing mmu_role.base.ad_disabled will
never propagate into future shadow pages since the nested MMU isn't used
to map anything, just to walk L2's page tables.

Note, KVM also does a full MMU reload, i.e. the guest_mmu will be
recreated using the new EPTP, and thus any change in A/D enabling will be
properly recognized in the relevant MMU.

Fixes: 41ab93727467 ("KVM: nVMX: Emulate EPTP switching for the L1 hypervisor")
Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20210609234235.1244004-4-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/x86/kvm/vmx/nested.c