linux/arch/x86/kvm
Sean Christopherson f7782bb8d8 KVM: nVMX: Unconditionally clear nested.pi_pending on nested VM-Enter
Clear nested.pi_pending on nested VM-Enter even if L2 will run without
posted interrupts enabled.  If nested.pi_pending is left set from a
previous L2, vmx_complete_nested_posted_interrupt() will pick up the
stale flag and exit to userspace with an "internal emulation error" due
the new L2 not having a valid nested.pi_desc.

Arguably, vmx_complete_nested_posted_interrupt() should first check for
posted interrupts being enabled, but it's also completely reasonable that
KVM wouldn't screw up a fundamental flag.  Not to mention that the mere
existence of nested.pi_pending is a long-standing bug as KVM shouldn't
move the posted interrupt out of the IRR until it's actually processed,
e.g. KVM effectively drops an interrupt when it performs a nested VM-Exit
with a "pending" posted interrupt.  Fixing the mess is a future problem.

Prior to vmx_complete_nested_posted_interrupt() interpreting a null PI
descriptor as an error, this was a benign bug as the null PI descriptor
effectively served as a check on PI not being enabled.  Even then, the
new flow did not become problematic until KVM started checking the result
of kvm_check_nested_events().

Fixes: 705699a139 ("KVM: nVMX: Enable nested posted interrupt processing")
Fixes: 966eefb896 ("KVM: nVMX: Disable vmcs02 posted interrupts if vmcs12 PID isn't mappable")
Fixes: 47d3530f86c0 ("KVM: x86: Exit to userspace when kvm_check_nested_events fails")
Cc: stable@vger.kernel.org
Cc: Jim Mattson <jmattson@google.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20210810144526.2662272-1-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-08-13 03:35:17 -04:00
..
mmu Merge branch 'kvm-tdpmmu-fixes' into HEAD 2021-08-13 03:35:01 -04:00
svm KVM: x86: Move declaration of kvm_spurious_fault() to x86.h 2021-08-13 03:35:16 -04:00
vmx KVM: nVMX: Unconditionally clear nested.pi_pending on nested VM-Enter 2021-08-13 03:35:17 -04:00
cpuid.c KVM: x86/pmu: Clear anythread deprecated bit when 0xa leaf is unsupported on the SVM 2021-07-14 12:17:56 -04:00
cpuid.h KVM: x86: Move reverse CPUID helpers to separate header file 2021-04-26 05:27:13 -04:00
debugfs.c KVM: nVMX: nSVM: Add a new VCPU statistic to show if VCPU is in guest mode 2021-06-17 13:09:36 -04:00
emulate.c KVM: x86: Drop "pre_" from enter/leave_smm() helpers 2021-06-17 13:09:35 -04:00
fpu.h KVM: x86: Move FPU register accessors into fpu.h 2021-06-17 13:09:24 -04:00
hyperv.c KVM: x86: hyper-v: Check if guest is allowed to use XMM registers for hypercall input 2021-08-03 06:16:40 -04:00
hyperv.h KVM: x86: hyper-v: Introduce KVM_CAP_HYPERV_ENFORCE_CPUID 2021-06-17 13:09:38 -04:00
i8254.c KVM: x86: Migrate the PIT only if vcpu0 is migrated, not any BSP 2021-08-02 11:01:51 -04:00
i8254.h
i8259.c KVM: x86: Refactor picdev_write() to prevent Spectre-v1/L1TF attacks 2020-01-27 19:59:37 +01:00
ioapic.c x86/kvm: fix vcpu-id indexed array sizes 2021-07-27 16:58:59 -04:00
ioapic.h x86/kvm: remove non-x86 stuff from arch/x86/kvm/ioapic.h 2021-08-02 11:01:46 -04:00
irq_comm.c x86: Fix various typos in comments 2021-03-18 15:31:53 +01:00
irq.c KVM: x86/xen: Add event channel interrupt vector upcall 2021-02-04 14:19:39 +00:00
irq.h kvm/x86: Remove redundant function implementations 2020-05-27 13:11:10 -04:00
Kconfig ARM: 2021-06-28 15:40:51 -07:00
kvm_cache_regs.h KVM: x86: Introduce KVM_GET_SREGS2 / KVM_SET_SREGS2 2021-06-17 13:09:47 -04:00
kvm_emulate.h KVM: x86: Drop "pre_" from enter/leave_smm() helpers 2021-06-17 13:09:35 -04:00
kvm_onhyperv.c KVM: x86: hyper-v: Move the remote TLB flush logic out of vmx 2021-06-17 13:09:36 -04:00
kvm_onhyperv.h KVM: x86: hyper-v: Move the remote TLB flush logic out of vmx 2021-06-17 13:09:36 -04:00
lapic.c KVM: x86: Consolidate APIC base RESET initialization code 2021-08-02 11:01:52 -04:00
lapic.h KVM: x86: Add a return code to kvm_apic_accept_events 2021-06-17 13:09:31 -04:00
Makefile KVM: stats: Add fd-based API to read binary stats data 2021-06-24 11:47:57 -04:00
mmu.h KVM: x86/mmu: Get CR0.WP from MMU, not vCPU, in shadow page fault 2021-06-24 18:00:47 -04:00
mtrr.c KVM: x86: Add helper to consolidate "raw" reserved GPA mask calculations 2021-02-04 09:27:30 -05:00
pmu.c KVM: x86/pmu: Introduce pmc->is_paused to reduce the call time of perf interfaces 2021-08-04 05:55:56 -04:00
pmu.h KVM: x86/pmu: Introduce pmc->is_paused to reduce the call time of perf interfaces 2021-08-04 05:55:56 -04:00
reverse_cpuid.h KVM: SEV: Mask CPUID[0x8000001F].eax according to supported features 2021-04-26 05:27:15 -04:00
trace.h KVM: x86: Introduce trace_kvm_hv_hypercall_done() 2021-08-03 06:16:40 -04:00
tss.h
x86.c KVM: x86: Kill off __ex() and __kvm_handle_fault_on_reboot() 2021-08-13 03:35:16 -04:00
x86.h KVM: x86: Move declaration of kvm_spurious_fault() to x86.h 2021-08-13 03:35:16 -04:00
xen.c KVM: xen: do not use struct gfn_to_hva_cache 2021-08-05 03:31:40 -04:00
xen.h KVM: xen: do not use struct gfn_to_hva_cache 2021-08-05 03:31:40 -04:00