Commit 0ce74180 authored by Sean Christopherson's avatar Sean Christopherson Committed by Paolo Bonzini

KVM: selftests: Harden and comment XSS / KVM_SET_MSRS interaction

Assert that KVM_SET_MSRS returns '0' or '1' when setting XSS to a
non-zero value.  The ioctl() itself should "succeed", its only the
setting of the XSS MSR that should fail/fault.
Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent c095cb60
...@@ -53,7 +53,12 @@ int main(int argc, char *argv[]) ...@@ -53,7 +53,12 @@ int main(int argc, char *argv[])
for (i = 0; i < MSR_BITS; ++i) { for (i = 0; i < MSR_BITS; ++i) {
r = _vcpu_set_msr(vm, VCPU_ID, MSR_IA32_XSS, 1ull << i); r = _vcpu_set_msr(vm, VCPU_ID, MSR_IA32_XSS, 1ull << i);
TEST_ASSERT(r == 0 || xss_in_msr_list, /*
* Setting a list of MSRs returns the entry that "faulted", or
* the last entry +1 if all MSRs were successfully written.
*/
TEST_ASSERT(!r || r == 1, KVM_IOCTL_ERROR(KVM_SET_MSRS, r));
TEST_ASSERT(r != 1 || xss_in_msr_list,
"IA32_XSS was able to be set, but was not in save/restore list"); "IA32_XSS was able to be set, but was not in save/restore list");
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment