From: Vitaly Kuznetsov <vkuznets@redhat.com>
To: David Woodhouse <dwmw2@infradead.org>, kvm@vger.kernel.org
Cc: Paolo Bonzini <pbonzini@redhat.com>,
Ankur Arora <ankur.a.arora@oracle.com>,
Joao Martins <joao.m.martins@oracle.com>,
Boris Ostrovsky <boris.ostrovsky@oracle.com>,
Sean Christopherson <seanjc@google.com>,
graf@amazon.com, iaslan@amazon.de, pdurrant@amazon.com,
aagch@amazon.com, fandree@amazon.com
Subject: Re: [PATCH v3 02/17] KVM: x86/xen: fix Xen hypercall page msr handling
Date: Tue, 15 Dec 2020 13:10:38 +0100 [thread overview]
Message-ID: <87r1nruv5t.fsf@vitty.brq.redhat.com> (raw)
In-Reply-To: <7fa66c23d2758860d6b8012014faf977d03b140b.camel@infradead.org>
David Woodhouse <dwmw2@infradead.org> writes:
> On Mon, 2020-12-14 at 23:22 +0100, Vitaly Kuznetsov wrote:
>> > Can you define kvm_hv_msr_enabled()?
>> >
>> > Note kvm_hv_hypercall_enabled() is based on a value that gets written
>> > through the MSR, so it can't be that.
>>
>> When Hyper-V emulation appeared in KVM we (unfortunately) didn't add a
>> capability to globaly enable and disable it so to be backwards
>> compatible we'll have to define kvm_emulating_hyperv() as 'true' for
>> now as that's how KVM behaves. This, however, doesn't mean we can't add
>> e.g. a module parameter to disable Hyper-V emulation. Also, we can
>> probably check guest CPUIDs and if Hyper-V's signature wasn't set we can
>> return 'false'.
>>
>> <rant>
>> Having Hyper-V emulation in KVM 'always enabled' may not be a big deal
>> from functional point of view but may not be ideal from security
>> standpoint as bugs in arch/x86/kvm/hyperv.c become exploitable even from
>> Linux guests.
>> </rant>
>
> Indeed. And yet it can coexist with Xen support too, so it isn't even
> as simple as turning it off when Xen is enabled.
>
> Which is why I ended up just using Joao's patch unchanged. Short of
> going back in time to make Hyper-V support conditional when it was
> first introduced, I couldn't see a better answer.
>
> And regardless of the Hyper-V mess, what this patch does for Xen is
> precisely what you suggest: handle it first, before the switch(), *if*
> the Xen MSR is enabled.
Functionally I have no complaints, even with the suggested
'generalization' we'll be handling MSRs in the exact same sequence. You
are, however, right calling Hyper-V mess 'mess' and if we want to make
things cleaner we should probably start there (goes to my to-do
list...).
--
Vitaly
next prev parent reply other threads:[~2020-12-15 12:12 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-14 8:38 [PATCH v3 00/17] KVM: Add minimal support for Xen HVM guests David Woodhouse
2020-12-14 8:38 ` [PATCH v3 01/17] KVM: Fix arguments to kvm_{un,}map_gfn() David Woodhouse
2020-12-14 21:13 ` Vitaly Kuznetsov
2020-12-14 21:21 ` David Woodhouse
2020-12-14 21:41 ` Vitaly Kuznetsov
2020-12-14 21:45 ` David Woodhouse
2020-12-15 12:07 ` Vitaly Kuznetsov
2020-12-15 12:45 ` David Woodhouse
2020-12-14 8:38 ` [PATCH v3 02/17] KVM: x86/xen: fix Xen hypercall page msr handling David Woodhouse
2020-12-14 21:27 ` Vitaly Kuznetsov
2020-12-14 21:35 ` David Woodhouse
2020-12-14 21:44 ` Vitaly Kuznetsov
2020-12-14 21:48 ` David Woodhouse
2020-12-14 22:22 ` Vitaly Kuznetsov
2020-12-14 22:41 ` David Woodhouse
2020-12-15 12:10 ` Vitaly Kuznetsov [this message]
2020-12-23 8:35 ` Christoph Hellwig
2020-12-14 8:38 ` [PATCH v3 03/17] KVM: x86/xen: intercept xen hypercalls if enabled David Woodhouse
2020-12-23 8:36 ` Christoph Hellwig
2020-12-23 10:51 ` David Woodhouse
2020-12-14 8:38 ` [PATCH v3 04/17] KVM: x86/xen: Fix coexistence of Xen and Hyper-V hypercalls David Woodhouse
2020-12-14 8:38 ` [PATCH v3 05/17] KVM: x86/xen: add KVM_XEN_HVM_SET_ATTR/KVM_XEN_HVM_GET_ATTR David Woodhouse
2020-12-14 8:38 ` [PATCH v3 06/17] KVM: x86/xen: latch long_mode when hypercall page is set up David Woodhouse
2020-12-14 8:38 ` [PATCH v3 07/17] KVM: x86/xen: add definitions of compat_shared_info, compat_vcpu_info David Woodhouse
2020-12-14 8:38 ` [PATCH v3 08/17] KVM: x86/xen: register shared_info page David Woodhouse
2020-12-14 10:45 ` Joao Martins
2020-12-14 11:30 ` Joao Martins
2020-12-14 12:04 ` David Woodhouse
2020-12-14 12:02 ` David Woodhouse
2020-12-14 12:53 ` Joao Martins
2020-12-14 15:05 ` David Woodhouse
2020-12-14 8:38 ` [PATCH v3 09/17] xen: add wc_sec_hi to struct shared_info David Woodhouse
2020-12-14 8:38 ` [PATCH v3 10/17] KVM: x86/xen: update wallclock region David Woodhouse
2020-12-14 8:38 ` [PATCH v3 11/17] KVM: x86/xen: register vcpu info David Woodhouse
2020-12-14 10:48 ` Joao Martins
2020-12-14 8:39 ` [PATCH v3 12/17] KVM: x86/xen: setup pvclock updates David Woodhouse
2020-12-14 13:29 ` Joao Martins
2020-12-14 14:58 ` David Woodhouse
2020-12-14 15:20 ` Joao Martins
2020-12-14 15:40 ` David Woodhouse
2020-12-14 8:39 ` [PATCH v3 13/17] KVM: x86/xen: register vcpu time info region David Woodhouse
2020-12-14 10:55 ` Joao Martins
2020-12-14 12:03 ` David Woodhouse
2020-12-14 8:39 ` [PATCH v3 14/17] KVM: x86/xen: register runstate info David Woodhouse
2020-12-14 11:10 ` Joao Martins
2020-12-14 15:47 ` David Woodhouse
2020-12-14 8:39 ` [PATCH v3 15/17] KVM: x86: declare Xen HVM shared info capability and add test case David Woodhouse
2020-12-14 8:39 ` [PATCH v3 16/17] KVM: Add documentation for Xen hypercall and shared_info updates David Woodhouse
2020-12-14 8:39 ` [PATCH v3 17/17] KVM: x86/xen: Add event channel interrupt vector upcall David Woodhouse
2020-12-14 13:19 ` Joao Martins
2020-12-14 13:32 ` Durrant, Paul
2020-12-14 14:57 ` David Woodhouse
2020-12-14 15:13 ` Joao Martins
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87r1nruv5t.fsf@vitty.brq.redhat.com \
--to=vkuznets@redhat.com \
--cc=aagch@amazon.com \
--cc=ankur.a.arora@oracle.com \
--cc=boris.ostrovsky@oracle.com \
--cc=dwmw2@infradead.org \
--cc=fandree@amazon.com \
--cc=graf@amazon.com \
--cc=iaslan@amazon.de \
--cc=joao.m.martins@oracle.com \
--cc=kvm@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=pdurrant@amazon.com \
--cc=seanjc@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox