KVM: x86: Reinitialize context if host userspace toggles EFER.LME
authorPaolo Bonzini <pbonzini@redhat.com>
Wed, 9 Feb 2022 09:56:05 +0000 (04:56 -0500)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 25 Feb 2022 13:20:15 +0000 (08:20 -0500)
commitd6174299365ddbbf491620c0b8c5ca1a6ef2eea5
treea97f8e14dd4c248e9ab8b645e8d12d8602778e07
parent20e416720e7448425c421f1a59b07ff574f8b1e1
KVM: x86: Reinitialize context if host userspace toggles EFER.LME

While the guest runs, EFER.LME cannot change unless CR0.PG is clear, and
therefore EFER.NX is the only bit that can affect the MMU role.  However,
set_efer accepts a host-initiated change to EFER.LME even with CR0.PG=1.
In that case, the MMU has to be reset.

Fixes: 11988499e62b ("KVM: x86: Skip EFER vs. guest CPUID checks for host-initiated writes")
Cc: stable@vger.kernel.org
Reviewed-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/mmu.h
arch/x86/kvm/x86.c