• Maxim Levitsky's avatar
    KVM: x86: use positive error values for msr emulation that causes #GP · cc4cb017
    Maxim Levitsky authored
    Recent introduction of the userspace msr filtering added code that uses
    negative error codes for cases that result in either #GP delivery to
    the guest, or handled by the userspace msr filtering.
    
    This breaks an assumption that a negative error code returned from the
    msr emulation code is a semi-fatal error which should be returned
    to userspace via KVM_RUN ioctl and usually kill the guest.
    
    Fix this by reusing the already existing KVM_MSR_RET_INVALID error code,
    and by adding a new KVM_MSR_RET_FILTERED error code for the
    userspace filtered msrs.
    
    Fixes: 291f35fb2c1d1 ("KVM: x86: report negative values from wrmsr emulation to userspace")
    Reported-by: default avatarQian Cai <cai@redhat.com>
    Signed-off-by: default avatarMaxim Levitsky <mlevitsk@redhat.com>
    Message-Id: <20201101115523.115780-1-mlevitsk@redhat.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    cc4cb017
x86.h 10.7 KB