Re: [PATCH] KVM: x86: Inject #UD on "unsupported" hypercall if patching fails

From: Vitaly Kuznetsov
Date: Mon Dec 13 2021 - 11:53:17 EST


Sean Christopherson <seanjc@xxxxxxxxxx> writes:

> Ideally, KVM wouldn't patch at all; it's the guest's responsibility to
> identify and use the correct hypercall instruction (VMCALL vs. VMMCALL).
> Sadly, older Linux kernels prior to commit c1118b3602c2 ("x86: kvm: use
> alternatives for VMCALL vs. VMMCALL if kernel text is read-only") do the
> wrong thing and blindly use VMCALL, i.e. removing the patching would
> break running VMs with older kernels.
>

FWIW, we also use hypercall patching for Hyper-V emulation (when
HV_X64_MSR_HYPERCALL is written) and this complies with TLFS, we can't
get rid of this. It's a different 'patching' though...

--
Vitaly