]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
KVM: x86: Check lapic_in_kernel() before attempting to set a SynIC irq
authorVitaly Kuznetsov <vkuznets@redhat.com>
Fri, 25 Mar 2022 13:21:38 +0000 (14:21 +0100)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 20 May 2022 12:40:07 +0000 (14:40 +0200)
commita2c6231c2cbab8672cee71880e1f2e963c3a27c3
tree965867fbbe9d7b34907794d82661cd36b09d0465
parent1732c5c53847eb0799967a2cf50bfc462439c325
KVM: x86: Check lapic_in_kernel() before attempting to set a SynIC irq

BugLink: https://bugs.launchpad.net/bugs/1969110
commit 7ec37d1cbe17d8189d9562178d8b29167fe1c31a upstream.

When KVM_CAP_HYPERV_SYNIC{,2} is activated, KVM already checks for
irqchip_in_kernel() so normally SynIC irqs should never be set. It is,
however,  possible for a misbehaving VMM to write to SYNIC/STIMER MSRs
causing erroneous behavior.

The immediate issue being fixed is that kvm_irq_delivery_to_apic()
(kvm_irq_delivery_to_apic_fast()) crashes when called with
'irq.shorthand = APIC_DEST_SELF' and 'src == NULL'.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Message-Id: <20220325132140.25650-2-vkuznets@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 569a229142e95610adc1041ae9ca1f417c4c6a3e)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
arch/x86/kvm/hyperv.c