linux/arch/x86/kvm
Paolo Bonzini 44d5271707 KVM: LAPIC: ensure APIC map is up to date on concurrent update requests
The following race can cause lost map update events:

         cpu1                            cpu2

                                apic_map_dirty = true
  ------------------------------------------------------------
                                kvm_recalculate_apic_map:
                                     pass check
                                         mutex_lock(&kvm->arch.apic_map_lock);
                                         if (!kvm->arch.apic_map_dirty)
                                     and in process of updating map
  -------------------------------------------------------------
    other calls to
       apic_map_dirty = true         might be too late for affected cpu
  -------------------------------------------------------------
                                     apic_map_dirty = false
  -------------------------------------------------------------
    kvm_recalculate_apic_map:
    bail out on
      if (!kvm->arch.apic_map_dirty)

To fix it, record the beginning of an update of the APIC map in
apic_map_dirty.  If another APIC map change switches apic_map_dirty
back to DIRTY during the update, kvm_recalculate_apic_map should not
make it CLEAN, and the other caller will go through the slow path.

Reported-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-06-22 13:37:30 -04:00
..
mmu mmap locking API: convert mmap_sem call sites missed by coccinelle 2020-06-09 09:39:14 -07:00
svm kvm/svm: disable KCSAN for svm_vcpu_run() 2020-06-15 09:32:58 -04:00
vmx Revert "KVM: VMX: Micro-optimize vmexit time when not exposing PMU" 2020-06-19 08:13:40 -04:00
cpuid.c KVM: Use vmemdup_user() 2020-06-04 14:41:05 -04:00
cpuid.h KVM: nSVM: implement KVM_GET_NESTED_STATE and KVM_SET_NESTED_STATE 2020-06-01 04:26:05 -04:00
debugfs.c KVM: let kvm_destroy_vm_debugfs clean up vCPU debugfs directories 2020-06-04 11:00:54 -04:00
emulate.c KVM: x86: emulate reserved nops from 0f/18 to 0f/1f 2020-06-05 11:16:15 -04:00
hyperv.c Merge branch 'uaccess.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2020-06-10 16:02:54 -07:00
hyperv.h x86/kvm/hyper-v: Add support for synthetic debugger interface 2020-06-01 04:26:11 -04:00
i8254.c kvm: i8254: remove redundant assignment to pointer s 2020-06-11 12:35:18 -04:00
i8254.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
i8259.c KVM: x86: Refactor picdev_write() to prevent Spectre-v1/L1TF attacks 2020-01-27 19:59:37 +01:00
ioapic.c kvm: ioapic: Restrict lazy EOI update to edge-triggered interrupts 2020-05-04 12:29:05 -04:00
ioapic.h kvm/x86: Remove redundant function implementations 2020-05-27 13:11:10 -04:00
irq_comm.c KVM: x86: don't notify userspace IOAPIC on edge-triggered interrupt EOI 2020-02-21 18:04:57 +01:00
irq.c KVM: nSVM: extract svm_set_gif 2020-06-01 04:26:01 -04:00
irq.h kvm/x86: Remove redundant function implementations 2020-05-27 13:11:10 -04:00
Kconfig treewide: replace '---help---' in Kconfig files with 'help' 2020-06-14 01:57:21 +09:00
kvm_cache_regs.h KVM: VMX: Add proper cache tracking for CR0 2020-05-13 12:15:12 -04:00
kvm_emulate.h ARM: 2020-04-02 15:13:15 -07:00
lapic.c KVM: LAPIC: ensure APIC map is up to date on concurrent update requests 2020-06-22 13:37:30 -04:00
lapic.h KVM: x86: introduce kvm_can_use_hv_timer 2020-05-15 12:26:21 -04:00
Makefile kvm: Disable objtool frame pointer checking for vmenter.S 2020-04-20 17:11:19 -04:00
mmu_audit.c KVM: x86/mmu: Drop KVM's hugepage enums in favor of the kernel's enums 2020-05-15 12:26:11 -04:00
mmu.h KVM: MMU: pass arbitrary CR0/CR4/EFER to kvm_init_shadow_mmu 2020-06-01 04:26:03 -04:00
mmutrace.h KVM: x86: fix incorrect comparison in trace event 2020-02-20 18:13:44 +01:00
mtrr.c KVM: x86: Protect MSR-based index computations in fixed_msr_to_seg_unit() from Spectre-v1/L1TF attacks 2020-01-27 19:59:39 +01:00
pmu.c KVM: x86/pmu: Tweak kvm_pmu_get_msr to pass 'struct msr_data' in 2020-06-01 04:26:08 -04:00
pmu.h KVM: x86/pmu: Tweak kvm_pmu_get_msr to pass 'struct msr_data' in 2020-06-01 04:26:08 -04:00
trace.h x86/kvm/hyper-v: Add support for synthetic debugger interface 2020-06-01 04:26:11 -04:00
tss.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
x86.c KVM: x86: do not pass poisoned hva to __kvm_set_memory_region 2020-06-11 14:02:02 -04:00
x86.h KVM: X86: Introduce more exit_fastpath_completion enum values 2020-05-15 12:26:19 -04:00