]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commit
KVM: x86/mmu: Treat NX as used (not reserved) for all !TDP shadow MMUs
authorSean Christopherson <seanjc@google.com>
Tue, 22 Jun 2021 17:56:47 +0000 (10:56 -0700)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 1 Oct 2021 09:31:09 +0000 (11:31 +0200)
commitdeee0ba1bf746d51d446b24a00d5cfdc6c5ec8e6
treee6bf008dc7ad88a0e127288c1cd75abafe4d652e
parentc2a50df0c94601adbfb4e0a1c9132f921bcc436f
KVM: x86/mmu: Treat NX as used (not reserved) for all !TDP shadow MMUs

BugLink: https://bugs.launchpad.net/bugs/1944756
commit 112022bdb5bc372e00e6e43cb88ee38ea67b97bd upstream

Mark NX as being used for all non-nested shadow MMUs, as KVM will set the
NX bit for huge SPTEs if the iTLB mutli-hit mitigation is enabled.
Checking the mitigation itself is not sufficient as it can be toggled on
at any time and KVM doesn't reset MMU contexts when that happens.  KVM
could reset the contexts, but that would require purging all SPTEs in all
MMUs, for no real benefit.  And, KVM already forces EFER.NX=1 when TDP is
disabled (for WP=0, SMEP=1, NX=0), so technically NX is never reserved
for shadow MMUs.

Fixes: b8e8c8303ff2 ("kvm: mmu: ITLB_MULTIHIT mitigation")
Cc: stable@vger.kernel.org
Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20210622175739.3610207-3-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
[sudip: use old path]
Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
arch/x86/kvm/mmu.c