Re: [PATCH v2 12/49] KVM: x86: Reject disabling of MWAIT/HLT interception when not allowed

From: Sean Christopherson
Date: Fri Jul 12 2024 - 09:32:30 EST


On Fri, Jul 12, 2024, Xiaoyao Li wrote:
> On 5/18/2024 1:38 AM, Sean Christopherson wrote:
> > @@ -6565,33 +6571,29 @@ int kvm_vm_ioctl_enable_cap(struct kvm *kvm,
> > break;
> > case KVM_CAP_X86_DISABLE_EXITS:
> > r = -EINVAL;
> > - if (cap->args[0] & ~KVM_X86_DISABLE_VALID_EXITS)
> > + if (cap->args[0] & ~kvm_get_allowed_disable_exits())
>
> sigh.
>
> KVM_X86_DISABLE_VALID_EXITS has no user now. But we cannot remove it since
> it's in uapi header, right?

We can, actually. Forcing userspace to make changes when userspace updates their
copy of the headers is ok (building directly against kernel headers is discouraged).