KVM: x86: do not allow re-enabling quirks
authorPaolo Bonzini <pbonzini@redhat.com>
Mon, 3 Mar 2025 14:09:37 +0000 (09:09 -0500)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 14 Mar 2025 18:20:58 +0000 (14:20 -0400)
Allowing arbitrary re-enabling of quirks puts a limit on what the
quirks themselves can do, since you cannot assume that the quirk
prevents a particular state.  More important, it also prevents
KVM from disabling a quirk at VM creation time, because userspace
can always go back and re-enable that.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/x86.c

index df2da8b..cdc9c7b 100644 (file)
@@ -6533,7 +6533,7 @@ int kvm_vm_ioctl_enable_cap(struct kvm *kvm,
                        break;
                fallthrough;
        case KVM_CAP_DISABLE_QUIRKS:
-               kvm->arch.disabled_quirks = cap->args[0];
+               kvm->arch.disabled_quirks |= cap->args[0];
                r = 0;
                break;
        case KVM_CAP_SPLIT_IRQCHIP: {