All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marcelo Tosatti <mtosatti@redhat.com>
To: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
Cc: avi@redhat.com, kvm@vger.kernel.org
Subject: Re: [PATCH 3/5] KVM: Restrict rc values in x86_emulate_insn to X86EMUL_* values
Date: Fri, 29 Jan 2010 19:21:37 -0200	[thread overview]
Message-ID: <20100129212137.GC18360@amt.cnet> (raw)
In-Reply-To: <20100128225929.a3915d88.yoshikawa.takuya@oss.ntt.co.jp>

On Thu, Jan 28, 2010 at 10:59:29PM +0900, Takuya Yoshikawa wrote:
> This patch differentiate the X86EMUL_* values returned from
> X86EMUL_* type functions.
> 
> Note: During this work, we noticed some buggy return value
>   checks in x86_emulate_insn(). See FIXME in this patch.
> 
> Signed-off-by: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
> ---
>  arch/x86/kvm/emulate.c |   73 +++++++++++++++++++++++++++++-------------------
>  1 files changed, 44 insertions(+), 29 deletions(-)
> 
> diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
> index 9953f5b..d49e9de 100644
> --- a/arch/x86/kvm/emulate.c
> +++ b/arch/x86/kvm/emulate.c
>  
>  	/* Commit shadow register state. */
> @@ -2263,8 +2263,18 @@ twobyte_insn:
>  			if (c->modrm_mod != 3 || c->modrm_rm != 1)
>  				goto cannot_emulate;
>  
> -			rc = kvm_fix_hypercall(ctxt->vcpu);
> -			if (rc)
> +			/* FIXME:
> +			 * kvm_fix_hypercall() calls emulator_write_emulated()
> +			 * and if the return value is not X86EMUL_CONTINUE then
> +			 * returns -EFAULT, otherwise returns X86EMUL_CONTINUE.
> +			 *
> +			 * To handle the former case, original code just did
> +			 * goto done with rc = -EFAULT and passed the
> +			 * if (X86EMUL_UNHANDLEABLE) check.
> +			 * Instead of this, we just set rc to X86EMUL_CONTINUE.
> +			 */
> +			rc = X86EMUL_CONTINUE;
> +			if (kvm_fix_hypercall(ctxt->vcpu))
>  				goto done;

Should fix kvm_fix_hypercall to return X86EMUL_ codes, and send macro
updates separately from logic changes.


  reply	other threads:[~2010-01-29 21:40 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-28 13:51 [PATCH 0/5] KVM: Cleanups: X86EMUL_* related Takuya Yoshikawa
2010-01-28 13:54 ` [PATCH 1/5] KVM: Use X86EMUL_* to check the return value from read_std Takuya Yoshikawa
2010-01-29 20:46   ` Marcelo Tosatti
2010-01-28 13:56 ` [PATCH 2/5] KVM: These functions should return X86EMUL_* not 0 or 1 or Takuya Yoshikawa
2010-01-29 21:18   ` Marcelo Tosatti
2010-01-28 13:59 ` [PATCH 3/5] KVM: Restrict rc values in x86_emulate_insn to X86EMUL_* values Takuya Yoshikawa
2010-01-29 21:21   ` Marcelo Tosatti [this message]
2010-01-28 14:01 ` [PATCH 4/5] KVM: load|save_guest_segment_descriptor() should return " Takuya Yoshikawa
2010-01-29 21:30   ` Marcelo Tosatti
2010-01-28 14:03 ` [PATCH 5/5] KVM: Fix the usage of X86EMUL_* values in x86.c Takuya Yoshikawa
2010-01-29 21:39   ` Marcelo Tosatti

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=20100129212137.GC18360@amt.cnet \
    --to=mtosatti@redhat.com \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=yoshikawa.takuya@oss.ntt.co.jp \
    /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.