Re: [PATCH 18/21] KVM: x86: Emulator mis-decodes VEX instructions on real-mode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 02/11/2014 10:54, Nadav Amit wrote:
> Commit 7fe864dc942c ("KVM: x86: Emulator considers imm as memory operand")
> marked VEX instructions as such in protected mode.  VEX-prefix instructions are
> not supported relevant on real-mode and VM86, but should cause #UD instead of
> being decoded as LES/LDS.
> 
> Fix this behaviour to be consistent with real hardware.
> 
> Signed-off-by: Nadav Amit <namit@xxxxxxxxxxxxxxxxx>
> ---
>  arch/x86/kvm/emulate.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
> index db8cb4d6..24b0df7 100644
> --- a/arch/x86/kvm/emulate.c
> +++ b/arch/x86/kvm/emulate.c
> @@ -4505,8 +4505,7 @@ done_prefixes:
>  
>  	/* vex-prefix instructions are not implemented */
>  	if (ctxt->opcode_len == 1 && (ctxt->b == 0xc5 || ctxt->b == 0xc4) &&
> -	    (mode == X86EMUL_MODE_PROT64 ||
> -	    (mode >= X86EMUL_MODE_PROT16 && (ctxt->modrm & 0x80)))) {
> +	    (mode == X86EMUL_MODE_PROT64 || (ctxt->modrm & 0x80))) {

This should also check for (ctxt->modrm & 0xc0) == 0xc0 instead of just
ctxt->modrm & 0x80.  Otherwise, installation of Windows XP and 2003 is
broken on pre-Westmere system, because they execute LDS in the process
of transitioning from 16- to 32-bit protected mode.

This was not visible before because at this point CS is already 32-bit;
I fixed the patch.

Paolo

>  		ctxt->d = NotImpl;
>  	}
>  
> 
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux