summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/kvm/x86_64/xen_vmcall_test.c
diff options
context:
space:
mode:
authorVitaly Kuznetsov <vkuznets@redhat.com>2021-01-26 16:48:14 +0300
committerPaolo Bonzini <pbonzini@redhat.com>2021-02-09 16:39:56 +0300
commit8f014550dfb114cc7f42a517d20d2cf887a0b771 (patch)
treeb18a8f8c96c597d215d831207472d07508e1395b /tools/testing/selftests/kvm/x86_64/xen_vmcall_test.c
parent4592b7eaa87d3525825d4ab2a35308bcec9e5ff9 (diff)
downloadlinux-8f014550dfb114cc7f42a517d20d2cf887a0b771.tar.xz
KVM: x86: hyper-v: Make Hyper-V emulation enablement conditional
Hyper-V emulation is enabled in KVM unconditionally. This is bad at least from security standpoint as it is an extra attack surface. Ideally, there should be a per-VM capability explicitly enabled by VMM but currently it is not the case and we can't mandate one without breaking backwards compatibility. We can, however, check guest visible CPUIDs and only enable Hyper-V emulation when "Hv#1" interface was exposed in HYPERV_CPUID_INTERFACE. Note, VMMs are free to act in any sequence they like, e.g. they can try to set MSRs first and CPUIDs later so we still need to allow the host to read/write Hyper-V specific MSRs unconditionally. Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com> Message-Id: <20210126134816.1880136-14-vkuznets@redhat.com> [Add selftest vcpu_set_hv_cpuid API to avoid breaking xen_vmcall_test. - Paolo] Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'tools/testing/selftests/kvm/x86_64/xen_vmcall_test.c')
-rw-r--r--tools/testing/selftests/kvm/x86_64/xen_vmcall_test.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/testing/selftests/kvm/x86_64/xen_vmcall_test.c b/tools/testing/selftests/kvm/x86_64/xen_vmcall_test.c
index 6e7b069322fd..86653361c695 100644
--- a/tools/testing/selftests/kvm/x86_64/xen_vmcall_test.c
+++ b/tools/testing/selftests/kvm/x86_64/xen_vmcall_test.c
@@ -92,7 +92,7 @@ int main(int argc, char *argv[])
}
vm = vm_create_default(VCPU_ID, 0, (void *) guest_code);
- vcpu_set_cpuid(vm, VCPU_ID, kvm_get_supported_cpuid());
+ vcpu_set_hv_cpuid(vm, VCPU_ID);
struct kvm_xen_hvm_config hvmc = {
.flags = KVM_XEN_HVM_CONFIG_INTERCEPT_HCALL,