KVM: generalize "bugged" VM to "dead" VM
Generalize KVM_REQ_VM_BUGGED so that it can be called even in cases where it is by design that the VM cannot be operated upon. In this case any KVM_BUG_ON should still warn, so introduce a new flag kvm->vm_dead that is separate from kvm->vm_bugged. Suggested-by: Sean Christopherson <seanjc@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
@@ -3747,7 +3747,7 @@ static long kvm_vcpu_ioctl(struct file *filp,
|
||||
struct kvm_fpu *fpu = NULL;
|
||||
struct kvm_sregs *kvm_sregs = NULL;
|
||||
|
||||
if (vcpu->kvm->mm != current->mm || vcpu->kvm->vm_bugged)
|
||||
if (vcpu->kvm->mm != current->mm || vcpu->kvm->vm_dead)
|
||||
return -EIO;
|
||||
|
||||
if (unlikely(_IOC_TYPE(ioctl) != KVMIO))
|
||||
@@ -3957,7 +3957,7 @@ static long kvm_vcpu_compat_ioctl(struct file *filp,
|
||||
void __user *argp = compat_ptr(arg);
|
||||
int r;
|
||||
|
||||
if (vcpu->kvm->mm != current->mm || vcpu->kvm->vm_bugged)
|
||||
if (vcpu->kvm->mm != current->mm || vcpu->kvm->vm_dead)
|
||||
return -EIO;
|
||||
|
||||
switch (ioctl) {
|
||||
@@ -4023,7 +4023,7 @@ static long kvm_device_ioctl(struct file *filp, unsigned int ioctl,
|
||||
{
|
||||
struct kvm_device *dev = filp->private_data;
|
||||
|
||||
if (dev->kvm->mm != current->mm || dev->kvm->vm_bugged)
|
||||
if (dev->kvm->mm != current->mm || dev->kvm->vm_dead)
|
||||
return -EIO;
|
||||
|
||||
switch (ioctl) {
|
||||
@@ -4345,7 +4345,7 @@ static long kvm_vm_ioctl(struct file *filp,
|
||||
void __user *argp = (void __user *)arg;
|
||||
int r;
|
||||
|
||||
if (kvm->mm != current->mm || kvm->vm_bugged)
|
||||
if (kvm->mm != current->mm || kvm->vm_dead)
|
||||
return -EIO;
|
||||
switch (ioctl) {
|
||||
case KVM_CREATE_VCPU:
|
||||
@@ -4556,7 +4556,7 @@ static long kvm_vm_compat_ioctl(struct file *filp,
|
||||
struct kvm *kvm = filp->private_data;
|
||||
int r;
|
||||
|
||||
if (kvm->mm != current->mm || kvm->vm_bugged)
|
||||
if (kvm->mm != current->mm || kvm->vm_dead)
|
||||
return -EIO;
|
||||
switch (ioctl) {
|
||||
#ifdef CONFIG_KVM_GENERIC_DIRTYLOG_READ_PROTECT
|
||||
|
||||
Reference in New Issue
Block a user