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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 8 Apr 2022 12:24:03 +0000 (14:24 +0200)
commit48306afcac2a027163c6a8d10bd7a1d9d10efe37
treee0b2b03d01119421e280e9028a746e87e4fbe822
parent273ad0cf568493f11f5401422b8943d6c79773c6
KVM: x86: Reinitialize context if host userspace toggles EFER.LME

commit d6174299365ddbbf491620c0b8c5ca1a6ef2eea5 upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/kvm/mmu.h
arch/x86/kvm/x86.c