Messages in this thread | | | Date | Wed, 28 Sep 2022 14:59:27 +0000 | From | Sean Christopherson <> | Subject | Re: [PATCH] KVM: allow compiling out SMM support |
| |
On Wed, Sep 28, 2022, Paolo Bonzini wrote: > On 9/27/22 19:59, Sean Christopherson wrote: > > > static int kvm_vcpu_ioctl_smi(struct kvm_vcpu *vcpu) > > > { > > > - kvm_make_request(KVM_REQ_SMI, vcpu); > > > - > > > + if (IS_ENABLED(CONFIG_KVM_SMM)) > > > + kvm_make_request(KVM_REQ_SMI, vcpu); > > > return 0; > > > > This should return -EINVAL, not 0. > > I'm a bit wary of changing this in case userspace is relying on it not > failing, because the paths that lead to the failing ioctl are most likely > controlled by the guest.
But with CONFIG_KVM_SMM=n, KVM is now reporting that KVM_CAP_X86_SMM is unsupported, so it's firmly a VMM bug if userspace is blindly firing KVM_SMI. As long as the Kconfig is on by default, I don't see any reason to fudge KVM's ABI to try to avoid breaking buggy userspace.
/* Available with KVM_CAP_X86_SMM */ #define KVM_SMI _IO(KVMIO, 0xb7)
| |