All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Nadav Amit <namit@cs.technion.ac.il>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH] KVM: x86: Revert "check CS.DPL against RPL during task switch"
Date: Sun, 17 Aug 2014 23:13:27 +0200	[thread overview]
Message-ID: <53F11AF7.7080706@redhat.com> (raw)
In-Reply-To: <53F11A21.2040406@redhat.com>

Il 17/08/2014 23:09, Paolo Bonzini ha scritto:
> Il 17/08/2014 21:32, Nadav Amit ha scritto:
>> This reverts commit 5045b468037dfe1c848827ce10e99d87f5669160.  Although the
>> cs.dpl=cs.rpl check is mentioned in table 7-1 of the SDM as causing a #TSS
>> exception, it is not mentioned in table 6-6 that lists "invalid TSS conditions"
>> which cause #TSS exceptions. As it causes some tests, which pass on bare-metal,
>> to fail - it should be reverted.
> 
> Right.  However, I think reverting the patch is too big a hammer.  We 
> still need in_task_switch to raise TS_VECTOR instead of GP_VECTOR, so I 
> propose instead something like:
> 
> diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
> index 56657b0bb3bb..cd230b035514 100644
> --- a/arch/x86/kvm/emulate.c
> +++ b/arch/x86/kvm/emulate.c
> @@ -1468,7 +1468,7 @@ static int __load_segment_descriptor(struct x86_emulate_ctxt *ctxt,
>  		return ret;
>  
>  	err_code = selector & 0xfffc;
> -	err_vec = GP_VECTOR;
> +	err_vec = in_task_switch ? TS_VECTOR : GP_VECTOR;
>  
>  	/* can't load system descriptor into segment selector */
>  	if (seg <= VCPU_SREG_GS && !seg_desc.s)
> @@ -1491,9 +1491,6 @@ static int __load_segment_descriptor(struct x86_emulate_ctxt *ctxt,
>  			goto exception;
>  		break;
>  	case VCPU_SREG_CS:
> -		if (in_task_switch && rpl != dpl)
> -			goto exception;
> -
>  		if (!(seg_desc.type & 8))
>  			goto exception;
>  

Also, what about the rpl > cpl test below, for non-conforming code
segments?  It is not mentioned in table 6-6 either.

Paolo


  reply	other threads:[~2014-08-17 21:13 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-13 17:14 Regression problem with commit 5045b46803 Nadav Amit
2014-08-17  6:17 ` Paolo Bonzini
2014-08-17  6:23   ` Nadav Amit
2014-08-17  6:28     ` Paolo Bonzini
2014-08-17  7:19       ` Nadav Amit
2014-08-17  9:35         ` Paolo Bonzini
2014-08-17 19:32           ` [PATCH] KVM: x86: Revert "check CS.DPL against RPL during task switch" Nadav Amit
2014-08-17 19:34             ` [PATCH kvm-unit-tests] x86: Test task-switch with cs.rpl != cs.dpl Nadav Amit
2014-08-19 10:27               ` Paolo Bonzini
2014-08-19 13:04                 ` [PATCH kvm-unit-tests v2] " Nadav Amit
2014-08-19 13:28                   ` Paolo Bonzini
2014-08-19 13:34                     ` Nadav Amit
2014-08-19 13:37                       ` Paolo Bonzini
2014-08-17 21:09             ` [PATCH] KVM: x86: Revert "check CS.DPL against RPL during task switch" Paolo Bonzini
2014-08-17 21:13               ` Paolo Bonzini [this message]
2014-08-17 21:33                 ` Nadav Amit
2014-08-17 21:52                   ` Paolo Bonzini
2014-08-17 21:39               ` Nadav Amit
2014-08-17 21:52                 ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53F11AF7.7080706@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=namit@cs.technion.ac.il \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.