From: Paolo Bonzini <pbonzini@redhat.com>
To: Jan Kiszka <jan.kiszka@siemens.com>
Cc: Gleb Natapov <gleb@kernel.org>, kvm <kvm@vger.kernel.org>
Subject: Re: [PATCH] KVM: VMX: Do not skip the instruction if handle_dr injects a fault
Date: Fri, 20 Dec 2013 19:20:54 +0100 [thread overview]
Message-ID: <52B48A86.9050606@redhat.com> (raw)
In-Reply-To: <52B1E678.6060609@siemens.com>
Il 18/12/2013 19:16, Jan Kiszka ha scritto:
> If kvm_get_dr or kvm_set_dr reports that it raised a fault, we must not
> advance the instruction pointer. Otherwise the exception will hit the
> wrong instruction.
>
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> ---
> arch/x86/kvm/vmx.c | 10 +++++++---
> 1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> index 56c654c..ee3bf54 100644
> --- a/arch/x86/kvm/vmx.c
> +++ b/arch/x86/kvm/vmx.c
> @@ -5141,10 +5141,14 @@ static int handle_dr(struct kvm_vcpu *vcpu)
> reg = DEBUG_REG_ACCESS_REG(exit_qualification);
> if (exit_qualification & TYPE_MOV_FROM_DR) {
> unsigned long val;
> - if (!kvm_get_dr(vcpu, dr, &val))
> - kvm_register_write(vcpu, reg, val);
> +
> + if (kvm_get_dr(vcpu, dr, &val))
> + return 1;
> + kvm_register_write(vcpu, reg, val);
> } else
> - kvm_set_dr(vcpu, dr, vcpu->arch.regs[reg]);
> + if (kvm_set_dr(vcpu, dr, vcpu->arch.regs[reg]))
> + return 1;
> +
> skip_emulated_instruction(vcpu);
> return 1;
> }
>
Applied to kvm/queue, thanks.
Paolo
prev parent reply other threads:[~2013-12-20 18:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-18 18:16 [PATCH] KVM: VMX: Do not skip the instruction if handle_dr injects a fault Jan Kiszka
2013-12-20 18:20 ` Paolo Bonzini [this message]
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=52B48A86.9050606@redhat.com \
--to=pbonzini@redhat.com \
--cc=gleb@kernel.org \
--cc=jan.kiszka@siemens.com \
--cc=kvm@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox