]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: x86: Fix handling of APIC LVT updates when userspace changes MCG_CAP
authorSean Christopherson <seanjc@google.com>
Fri, 8 Jul 2022 22:48:10 +0000 (15:48 -0700)
committerSean Christopherson <seanjc@google.com>
Fri, 8 Jul 2022 22:58:16 +0000 (15:58 -0700)
commita1b31f659fa8448b3afcb9f80d276a73c4cda9de
tree32da1e5dc0c630afb77a239d695eb52966c67f3a
parentd7edb22163d276c52a9da932fa5ba07e123742c3
KVM: x86: Fix handling of APIC LVT updates when userspace changes MCG_CAP

Add a helper to update KVM's in-kernel local APIC in response to MCG_CAP
being changed by userspace to fix multiple bugs.  First and foremost,
KVM needs to check that there's an in-kernel APIC prior to dereferencing
vcpu->arch.apic.  Beyond that, any "new" LVT entries need to be masked,
and the APIC version register needs to be updated as it reports out the
number of LVT entries.

Fixes: 7dbdcb4e6022 ("KVM: x86: Add Corrected Machine Check Interrupt (CMCI) emulation to lapic.")
Reported-by: syzbot+8cdad6430c24f396f158@syzkaller.appspotmail.com
Cc: Siddh Raman Pant <code@siddh.me>
Cc: Jue Wang <juew@google.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/kvm/lapic.c
arch/x86/kvm/lapic.h
arch/x86/kvm/x86.c