If a VM exits in the middle of an exclusive operation (ldrex/strex), it leaves the exclusive monitor in a state that can influence the host (specially if they all run the same kernel or userspace, as all the virtual addresses will be the same). Conversly, the host state can influence the guest in the same way. This has been observed on TC2 running two VMs with the same kernel as the host, and seeing deadlocks (or lockdep moaning about locks being already taken by another CPU). The fix is to clear the exclusive monitor on both exception return paths (which is consistent with what the kernel is doing for userspace) so that the different worlds are properly isolated. Signed-off-by: Marc Zyngier <marc.zyngier@xxxxxxx> --- arch/arm/kvm/interrupts.S | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/kvm/interrupts.S b/arch/arm/kvm/interrupts.S index 696d539..16ad354 100644 --- a/arch/arm/kvm/interrupts.S +++ b/arch/arm/kvm/interrupts.S @@ -565,6 +565,7 @@ ENTRY(__kvm_vcpu_run) @ Load remaining registers and do the switch sub r0, r0, #(VCPU_PC - VCPU_USR_REGS) ldmia r0, {r0-r12} + clrex @ Clear exclusive monitor eret __kvm_vcpu_return: @@ -641,6 +642,7 @@ after_vfp_restore: hvc #0 @ switch back to svc-mode, see hyp_svc + clrex @ Clear exclusive monitor bx lr @ return to IOCTL @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ -- 1.7.10.3 _______________________________________________ kvmarm mailing list kvmarm@xxxxxxxxxxxxxxxxxxxxx https://lists.cs.columbia.edu/cucslists/listinfo/kvmarm