1. 24 Oct, 2020 3 commits
    • Vitaly Kuznetsov's avatar
      KVM: ioapic: break infinite recursion on lazy EOI · 77377064
      Vitaly Kuznetsov authored
      During shutdown the IOAPIC trigger mode is reset to edge triggered
      while the vfio-pci INTx is still registered with a resampler.
      This allows us to get into an infinite loop:
      
      ioapic_set_irq
        -> ioapic_lazy_update_eoi
        -> kvm_ioapic_update_eoi_one
        -> kvm_notify_acked_irq
        -> kvm_notify_acked_gsi
        -> (via irq_acked fn ptr) irqfd_resampler_ack
        -> kvm_set_irq
        -> (via set fn ptr) kvm_set_ioapic_irq
        -> kvm_ioapic_set_irq
        -> ioapic_set_irq
      
      Commit 8be8f932 ("kvm: ioapic: Restrict lazy EOI update to
      edge-triggered interrupts", 2020-05-04) acknowledges that this recursion
      loop exists and tries to avoid it at the call to ioapic_lazy_update_eoi,
      but at this point the scenario is already set, we have an edge interrupt
      with resampler on the same gsi.
      
      Fortunately, the only user of irq ack notifiers (in addition to resamplefd)
      is i8254 timer interrupt reinjection.  These are edge-triggered, so in
      principle they would need the call to kvm_ioapic_update_eoi_one from
      ioapic_lazy_update_eoi, but they already disable AVIC(*), so they don't
      need the lazy EOI behavior.  Therefore, remove the call to
      kvm_ioapic_update_eoi_one from ioapic_lazy_update_eoi.
      
      This fixes CVE-2020-27152.  Note that this issue cannot happen with
      SR-IOV assigned devices because virtual functions do not have INTx,
      only MSI.
      
      Fixes: f458d039 ("kvm: ioapic: Lazy update IOAPIC EOI")
      Suggested-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Tested-by: default avatarAlex Williamson <alex.williamson@redhat.com>
      Signed-off-by: default avatarVitaly Kuznetsov <vkuznets@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      77377064
    • Paolo Bonzini's avatar
      KVM: vmx: rename pi_init to avoid conflict with paride · a3ff25fc
      Paolo Bonzini authored
      allyesconfig results in:
      
      ld: drivers/block/paride/paride.o: in function `pi_init':
      (.text+0x1340): multiple definition of `pi_init'; arch/x86/kvm/vmx/posted_intr.o:posted_intr.c:(.init.text+0x0): first defined here
      make: *** [Makefile:1164: vmlinux] Error 1
      
      because commit:
      
      commit 8888cdd0
      Author: Xiaoyao Li <xiaoyao.li@intel.com>
      Date:   Wed Sep 23 11:31:11 2020 -0700
      
          KVM: VMX: Extract posted interrupt support to separate files
      
      added another pi_init(), though one already existed in the paride code.
      Reported-by: default avatarJens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      a3ff25fc
    • Sean Christopherson's avatar
      KVM: x86/mmu: Avoid modulo operator on 64-bit value to fix i386 build · 764388ce
      Sean Christopherson authored
      Replace a modulo operator with the more common pattern for computing the
      gfn "offset" of a huge page to fix an i386 build error.
      
        arch/x86/kvm/mmu/tdp_mmu.c:212: undefined reference to `__umoddi3'
      
      In fact, almost all of tdp_mmu.c can be elided on 32-bit builds, but
      that is a much larger patch.
      
      Fixes: 2f2fad08 ("kvm: x86/mmu: Add functions to handle changed TDP SPTEs")
      Reported-by: default avatarDaniel Díaz <daniel.diaz@linaro.org>
      Signed-off-by: default avatarSean Christopherson <sean.j.christopherson@intel.com>
      Message-Id: <20201024031150.9318-1-sean.j.christopherson@intel.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      764388ce
  2. 23 Oct, 2020 11 commits
  3. 21 Oct, 2020 26 commits