1. 12 8月, 2018 7 次提交
  2. 31 7月, 2018 2 次提交
    • C
      KVM: arm/arm64: Fix lost IRQs from emulated physcial timer when blocked · 245715cb
      Christoffer Dall 提交于
      When the VCPU is blocked (for example from WFI) we don't inject the
      physical timer interrupt if it should fire while the CPU is blocked, but
      instead we just wake up the VCPU and expect kvm_timer_vcpu_load to take
      care of injecting the interrupt.
      
      Unfortunately, kvm_timer_vcpu_load() doesn't actually do that, it only
      has support to schedule a soft timer if the emulated phys timer is
      expected to fire in the future.
      
      Follow the same pattern as kvm_timer_update_state() and update the irq
      state after potentially scheduling a soft timer.
      Reported-by: NAndre Przywara <andre.przywara@arm.com>
      Cc: Stable <stable@vger.kernel.org> # 4.15+
      Fixes: bbdd52cf ("KVM: arm/arm64: Avoid phys timer emulation in vcpu entry/exit")
      Signed-off-by: NChristoffer Dall <christoffer.dall@arm.com>
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      245715cb
    • C
      KVM: arm/arm64: Fix potential loss of ptimer interrupts · 7afc4ddb
      Christoffer Dall 提交于
      kvm_timer_update_state() is called when changing the phys timer
      configuration registers, either via vcpu reset, as a result of a trap
      from the guest, or when userspace programs the registers.
      
      phys_timer_emulate() is in turn called by kvm_timer_update_state() to
      either cancel an existing software timer, or program a new software
      timer, to emulate the behavior of a real phys timer, based on the change
      in configuration registers.
      
      Unfortunately, the interaction between these two functions left a small
      race; if the conceptual emulated phys timer should actually fire, but
      the soft timer hasn't executed its callback yet, we cancel the timer in
      phys_timer_emulate without injecting an irq.  This only happens if the
      check in kvm_timer_update_state is called before the timer should fire,
      which is relatively unlikely, but possible.
      
      The solution is to update the state of the phys timer after calling
      phys_timer_emulate, which will pick up the pending timer state and
      update the interrupt value.
      
      Note that this leaves the opportunity of raising the interrupt twice,
      once in the just-programmed soft timer, and once in
      kvm_timer_update_state.  Since this always happens synchronously with
      the VCPU execution, there is no harm in this, and the guest ever only
      sees a single timer interrupt.
      
      Cc: Stable <stable@vger.kernel.org> # 4.15+
      Signed-off-by: NChristoffer Dall <christoffer.dall@arm.com>
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      7afc4ddb
  3. 24 7月, 2018 1 次提交
    • M
      KVM: arm/arm64: vgic: Fix possible spectre-v1 write in vgic_mmio_write_apr() · 6b8b9a48
      Mark Rutland 提交于
      It's possible for userspace to control n. Sanitize n when using it as an
      array index, to inhibit the potential spectre-v1 write gadget.
      
      Note that while it appears that n must be bound to the interval [0,3]
      due to the way it is extracted from addr, we cannot guarantee that
      compiler transformations (and/or future refactoring) will ensure this is
      the case, and given this is a slow path it's better to always perform
      the masking.
      
      Found by smatch.
      Signed-off-by: NMark Rutland <mark.rutland@arm.com>
      Cc: Christoffer Dall <christoffer.dall@arm.com>
      Cc: Marc Zyngier <marc.zyngier@arm.com>
      Cc: kvmarm@lists.cs.columbia.edu
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      6b8b9a48
  4. 21 7月, 2018 18 次提交
  5. 09 7月, 2018 12 次提交