]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: x86: Blindly get current x2APIC reg value on "nodecode write" traps
authorSean Christopherson <seanjc@google.com>
Fri, 6 Jan 2023 01:12:34 +0000 (01:12 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 10 Mar 2023 08:34:11 +0000 (09:34 +0100)
commit8b023f8ba500a6ba01a10b68bdf830cca57a095e
treeb96b02114b267e2a2deb5805a12155af64960e80
parent55d1c50599cecb3222d3e2307e670baede716b9a
KVM: x86: Blindly get current x2APIC reg value on "nodecode write" traps

commit e2636e57a9c4db63f34189e02167c6e7c7b8b7ad upstream.

When emulating a x2APIC write in response to an APICv/AVIC trap, get the
the written value from the vAPIC page without checking that reads are
allowed for the target register.  AVIC can generate trap-like VM-Exits on
writes to EOI, and so KVM needs to get the written value from the backing
page without running afoul of EOI's write-only behavior.

Alternatively, EOI could be special cased to always write '0', e.g. so
that the sanity check could be preserved, but x2APIC on AMD is actually
supposed to disallow non-zero writes (not emulated by KVM), and the
sanity check was a byproduct of how the KVM code was written, i.e. wasn't
added to guard against anything in particular.

Fixes: 6252aff91ca5 ("KVM: x86: Bug the VM if an accelerated x2APIC trap occurs on a "bad" reg")
Fixes: 13fd57cb3992 ("KVM: x86: Do not block APIC write for non ICR registers")
Reported-by: Alejandro Jimenez <alejandro.j.jimenez@oracle.com>
Cc: stable@vger.kernel.org
Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20230106011306.85230-2-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/kvm/lapic.c