• Sean Christopherson's avatar
    KVM: x86: Suppress failures on userspace access to advertised, unsupported MSRs · 64a5d7a1
    Sean Christopherson authored
    Extend KVM's suppression of failures due to a userspace access to an
    unsupported, but advertised as a "to save" MSR to all MSRs, not just those
    that happen to reach the default case statements in kvm_get_msr_common()
    and kvm_set_msr_common().  KVM's soon-to-be-established ABI is that if an
    MSR is advertised to userspace, then userspace is allowed to read the MSR,
    and write back the value that was read, i.e. why an MSR is unsupported
    doesn't change KVM's ABI.
    
    Practically speaking, this is very nearly a nop, as the only other paths
    that return KVM_MSR_RET_UNSUPPORTED are {svm,vmx}_get_feature_msr(), and
    it's unlikely, though not impossible, that userspace is using KVM_GET_MSRS
    on unsupported MSRs.
    
    The primary goal of moving the suppression to common code is to allow
    returning KVM_MSR_RET_UNSUPPORTED as appropriate throughout KVM, without
    having to manually handle the "is userspace accessing an advertised"
    waiver.  I.e. this will allow formalizing KVM's ABI without incurring a
    high maintenance cost.
    
    Link: https://lore.kernel.org/r/20240802181935.292540-10-seanjc@google.comSigned-off-by: default avatarSean Christopherson <seanjc@google.com>
    64a5d7a1
x86.c 374 KB