Re: [PATCH] KVM: X86: Fix the decoding of segment overrides in 64bit mode

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

 



On 22/03/2018 09:34, Wanpeng Li wrote:
> From: Wanpeng Li <wanpengli@xxxxxxxxxxx>
> 
> Explicit segment overides other than %fs and %gs are documented as ignored by
> both Intel and AMD.
> 
> In practice, this means that:
> 
>  * Explicit uses of %ss don't actually yield #SS[0] for non-canonical
>    memory references.
>  * Explicit uses of %{e,c,d}s don't override %rbp/%rsp-based memory references
>    to yield #GP[0] for non-canonical memory references.
> 
> Cc: Paolo Bonzini <pbonzini@xxxxxxxxxx>
> Cc: Radim Krčmář <rkrcmar@xxxxxxxxxx>
> Signed-off-by: Wanpeng Li <wanpengli@xxxxxxxxxxx>
> ---
>  arch/x86/kvm/emulate.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
> index dd88158..5091255 100644
> --- a/arch/x86/kvm/emulate.c
> +++ b/arch/x86/kvm/emulate.c
> @@ -5148,8 +5148,10 @@ int x86_decode_insn(struct x86_emulate_ctxt *ctxt, void *insn, int insn_len)
>  		case 0x2e:	/* CS override */
>  		case 0x36:	/* SS override */
>  		case 0x3e:	/* DS override */
> -			has_seg_override = true;
> -			ctxt->seg_override = (ctxt->b >> 3) & 3;
> +			if (mode != X86EMUL_MODE_PROT64) {
> +				has_seg_override = true;
> +				ctxt->seg_override = (ctxt->b >> 3) & 3;
> +			}
>  			break;
>  		case 0x64:	/* FS override */
>  		case 0x65:	/* GS override */
> 

Testcase, please...

Paolo



[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