2018-02-01 14:05+0100, David Hildenbrand: > > @@ -7351,6 +7363,17 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) > > goto out; > > } > > > > + if (vcpu->run->kvm_valid_regs) { > > You can check directly, without this if. (and not sure if the extra > function is needed here). Right, it's unlikely that we'll be doing more checks on kvm_valid_regs, so I've moved it here and replaced the block with if (vcpu->run->kvm_valid_regs & ~KVM_SYNC_X86_VALID_FIELDS) { r = -EINVAL; goto out; } You can see the result in kvm/queue. Btw. the userspace doesn't know what the next userspace exit is going to be, so it the purpose of kvm_valid_regs to avoid needless writes of registers on old userspaces? Thanks. > > + r = check_valid_regs(vcpu); > > + if (r != 0) > > + goto out; > > + }