Skip to content

KVM: x86 SRCU bug fix and SRCU hardening

Sean Christopherson kvm kvm-riscv linux-riscv linuxppc-dev lkml 1 version Applied

Status from this message: Queued, thanks.

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 6 repliesApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/3KVM: x86: Don't re-acquire SRCU lock in complete_emulated_io()arch/x86/kvm/x86.c+1 -61 reply
2/3KVM: RISC-V: Use kvm_vcpu.srcu_idx, drop RISC-V's unnecessary copyarch/riscv/include/asm/kvm_host.h arch/riscv/kvm/vcpu.c arch/riscv/kvm/vcpu_exit.c+10 -130 replies
3/3KVM: Add helpers to wrap vcpu->srcu_idx and yell if it's abusedarch/powerpc/kvm/book3s_64_mmu_radix.c arch/powerpc/kvm/book3s_hv_nested.c arch/powerpc/kvm/book3s_rtas.c +8 more+71 -504 replies

Reviews trailers per patch

1 of 3 patches has a Reviewed-by or Acked-by.

PatchMaxim LevitskyFabiano Rosas
1/3R-b
2/3
3/3T-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/3] KVM: x86 SRCU bug fix and SRCU hardening

Fix an x86 bug where KVM overwrites vcpu->srcu_idx and can leak an SRCU lock due to unlocking the wrong index, ultimately causing a hang if/when KVM attempts to synchronize.

Switch RISC-V to the generic vcpu->srcu_idx, for reasons unknown it has its own copy and ignores the generic one.

Add helpers with rudimentary detection of illegal vcpu->srcu_idx usage, the x86 bug would have been incredibly painful to debug had I not known what to look for (found by a selftest with very specific behavior... that we recently modified with respect to SRCU).

Non-x86 changes are compile tested only.

Sean Christopherson (3):
KVM: x86: Don't re-acquire SRCU lock in complete_emulated_io()
KVM: RISC-V: Use kvm_vcpu.srcu_idx, drop RISC-V's unnecessary copy
KVM: Add helpers to wrap vcpu->srcu_idx and yell if it's abused

 arch/powerpc/kvm/book3s_64_mmu_radix.c |  9 ++++---
 arch/powerpc/kvm/book3s_hv_nested.c    | 16 ++++++------
 arch/powerpc/kvm/book3s_rtas.c         |  4 +--
 arch/powerpc/kvm/powerpc.c             |  4 +--
 arch/riscv/include/asm/kvm_host.h      |  3 ---
 arch/riscv/kvm/vcpu.c                  | 16 ++++++------
 arch/riscv/kvm/vcpu_exit.c             |  4 +--
 arch/s390/kvm/interrupt.c              |  4 +--
 arch/s390/kvm/kvm-s390.c               |  8 +++---
 arch/s390/kvm/vsie.c                   |  4 +--
 arch/x86/kvm/x86.c                     | 35 +++++++++++---------------
 include/linux/kvm_host.h               | 24 +++++++++++++++++-
 12 files changed, 72 insertions(+), 59 deletions(-)

base-commit: 150866cd0ec871c765181d145aa0912628289c8a

Signature · 1 line
2.36.0.rc0.470.gd361397f0d-goog