On Wed, 02 Nov 2022 16:23:16 +0000, Peter Xu <peterx@xxxxxxxxxx> wrote: > > Might be slightly off-topic: I didn't quickly spot how do we guarantee two > threads doing KVM_RUN ioctl on the same vcpu fd concurrently. I know > that's insane and could have corrupted things, but I just want to make sure > e.g. even a malicious guest app won't be able to trigger host warnings. In kvm_vcpu_ioctl(): if (mutex_lock_killable(&vcpu->mutex)) <----- this return -EINTR; switch (ioctl) { case KVM_RUN: { struct pid *oldpid; r = -EINVAL; if (arg) We simply don't allow two concurrent ioctls to the same vcpu, let alone two KVM_RUN. M. -- Without deviation from the norm, progress is not possible.