Re: [PATCH RFC 02/39] KVM: x86/xen: intercept xen hypercalls if enabled

From: David Woodhouse
Date: Wed Dec 02 2020 - 03:03:51 EST


On Tue, 2020-12-01 at 21:19 -0800, Ankur Arora wrote:
> > + for (i = 0; i < PAGE_SIZE / sizeof(instructions); i++) {
> > + *(u32 *)&instructions[1] = i;
> > + if (kvm_vcpu_write_guest(vcpu,
> > + page_addr + (i * sizeof(instructions)),
> > + instructions, sizeof(instructions)))
> > + return 1;
> > + }
>
> HYPERVISOR_iret isn't supported on 64bit so should be ud2 instead.

Yeah, I got part way through typing that part but concluded it probably
wasn't a fast path that absolutely needed to be emulated in the kernel.

The VMM can inject the UD# when it receives the hypercall.

I appreciate it *is* a guest-visible difference, if we're being really
pedantic, but I don't think we were even going to be able to 100% hide
the fact that it's not actually Xen.

Attachment: smime.p7s
Description: S/MIME cryptographic signature