|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH] x86: always supply .cpuid() handler to x86_emulate()
On 10/11/16 12:30, Jan Beulich wrote:
> --- a/xen/arch/x86/traps.c
> +++ b/xen/arch/x86/traps.c
> @@ -2755,6 +2755,24 @@ static int priv_op_write_msr(unsigned in
> return X86EMUL_UNHANDLEABLE;
> }
>
> +int pv_emul_cpuid(unsigned int *eax, unsigned int *ebx, unsigned int *ecx,
> + unsigned int *edx, struct x86_emulate_ctxt *ctxt)
> +{
> + struct cpu_user_regs regs = *ctxt->regs;
You need a CPUID faulting check here, matching the hvm side of things,
or you will leave a latent bug which gets exposed when switching to
using full x86_emulate() for PV guests.
Would it be wise to add a fail_if(!ops->cpuid) to x86_emulate() to catch
other misuses?
~Andrew
> +
> + regs._eax = *eax;
> + regs._ecx = *ecx;
> +
> + pv_cpuid(®s);
> +
> + *eax = regs._eax;
> + *ebx = regs._ebx;
> + *ecx = regs._ecx;
> + *edx = regs._edx;
> +
> + return X86EMUL_OKAY;
> +}
> +
> /* Instruction fetch with error handling. */
> #define insn_fetch(type, base, eip, limit) \
> ({ unsigned long _rc, _ptr = (base) + (eip); \
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |