From: Gleb Natapov <gleb@redhat.com>
To: Andre Przywara <andre.przywara@amd.com>
Cc: avi@redhat.com, mtosatti@redhat.com, kvm@vger.kernel.org
Subject: Re: [PATCH v3 16/30] KVM: x86 emulator: If LOCK prefix is used dest arg should be memory.
Date: Mon, 15 Mar 2010 20:10:24 +0200 [thread overview]
Message-ID: <20100315181024.GD5406@redhat.com> (raw)
In-Reply-To: <4B9E564C.4060306@amd.com>
On Mon, Mar 15, 2010 at 04:46:20PM +0100, Andre Przywara wrote:
> Gleb Natapov wrote:
> >If LOCK prefix is used dest arg should be memory, otherwise instruction
> >should generate #UD.
> Well, there is one exception:
> There is an AMD specific "lock mov cr0 = mov cr8" equivalence, where
> there is no memory involved (and we intercept this). I am not sure
> if anyone actually uses this code sequence, but it is definitely
> legal.
>
Even without this patch "lock mov cr0" will cause #UD to be injected by
emulator since mov does not have Lock in opcode table. Also it look like
Intel does not support this extension so no portable program can use
it.
> Regards,
> Andre.
>
> >
> >Signed-off-by: Gleb Natapov <gleb@redhat.com>
> >---
> > arch/x86/kvm/emulate.c | 2 +-
> > 1 files changed, 1 insertions(+), 1 deletions(-)
> >
> >diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
> >index b89a8f2..46a7ee3 100644
> >--- a/arch/x86/kvm/emulate.c
> >+++ b/arch/x86/kvm/emulate.c
> >@@ -1842,7 +1842,7 @@ x86_emulate_insn(struct x86_emulate_ctxt *ctxt, struct x86_emulate_ops *ops)
> > }
> > /* LOCK prefix is allowed only with some instructions */
> >- if (c->lock_prefix && !(c->d & Lock)) {
> >+ if (c->lock_prefix && (!(c->d & Lock) || c->dst.type != OP_MEM)) {
> > kvm_queue_exception(ctxt->vcpu, UD_VECTOR);
> > goto done;
> > }
>
>
> --
> Andre Przywara
> AMD-OSRC (Dresden)
> Tel: x29712
--
Gleb.
next prev parent reply other threads:[~2010-03-15 18:10 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-15 14:38 [PATCH v3 00/30] emulator cleanup Gleb Natapov
2010-03-15 14:38 ` [PATCH v3 01/30] KVM: x86 emulator: Fix DstAcc decoding Gleb Natapov
2010-03-15 14:38 ` [PATCH v3 02/30] KVM: x86 emulator: fix RCX access during rep emulation Gleb Natapov
2010-03-15 14:38 ` [PATCH v3 03/30] KVM: x86 emulator: check return value against correct define Gleb Natapov
2010-03-15 14:38 ` [PATCH v3 04/30] KVM: Remove pointer to rflags from realmode_set_cr parameters Gleb Natapov
2010-03-15 14:38 ` [PATCH v3 05/30] KVM: Provide callback to get/set control registers in emulator ops Gleb Natapov
2010-03-15 14:38 ` [PATCH v3 06/30] KVM: remove realmode_lmsw function Gleb Natapov
2010-03-15 14:38 ` [PATCH v3 07/30] KVM: Provide x86_emulate_ctxt callback to get current cpl Gleb Natapov
2010-03-15 14:38 ` [PATCH v3 08/30] KVM: Provide current eip as part of emulator context Gleb Natapov
2010-03-15 14:38 ` [PATCH v3 09/30] KVM: x86 emulator: fix mov r/m, sreg emulation Gleb Natapov
2010-03-15 14:38 ` [PATCH v3 10/30] KVM: x86 emulator: fix 0f 01 /5 emulation Gleb Natapov
2010-03-15 14:38 ` [PATCH v3 11/30] KVM: x86 emulator: 0f (20|21|22|23) ignore mod bits Gleb Natapov
2010-03-15 14:38 ` [PATCH v3 12/30] KVM: x86 emulator: inject #UD on access to non-existing CR Gleb Natapov
2010-03-15 14:38 ` [PATCH v3 13/30] KVM: x86 emulator: fix mov dr to inject #UD when needed Gleb Natapov
2010-03-15 14:38 ` [PATCH v3 14/30] KVM: x86 emulator: fix return values of syscall/sysenter/sysexit emulations Gleb Natapov
2010-03-15 14:38 ` [PATCH v3 15/30] KVM: x86 emulator: do not call writeback if msr access fails Gleb Natapov
2010-03-15 14:38 ` [PATCH v3 16/30] KVM: x86 emulator: If LOCK prefix is used dest arg should be memory Gleb Natapov
2010-03-15 15:46 ` Andre Przywara
2010-03-15 15:50 ` Avi Kivity
2010-03-15 18:10 ` Gleb Natapov [this message]
2010-03-16 9:37 ` Avi Kivity
2010-03-16 9:43 ` Gleb Natapov
2010-03-15 14:38 ` [PATCH v3 17/30] KVM: x86 emulator: cleanup grp3 return value Gleb Natapov
2010-03-15 14:38 ` [PATCH v3 18/30] KVM: x86 emulator: Provide more callbacks for x86 emulator Gleb Natapov
2010-03-15 14:38 ` [PATCH v3 19/30] KVM: x86 emulator: Emulate task switch in emulator.c Gleb Natapov
2010-03-15 14:38 ` [PATCH v3 20/30] KVM: x86 emulator: Use load_segment_descriptor() instead of kvm_load_segment_descriptor() Gleb Natapov
2010-03-15 14:38 ` [PATCH v3 21/30] KVM: Use task switch from emulator.c Gleb Natapov
2010-03-15 14:38 ` [PATCH v3 22/30] KVM: x86 emulator: populate OP_MEM operand during decoding Gleb Natapov
2010-03-15 14:38 ` [PATCH v3 23/30] KVM: x86 emulator: add decoding of X,Y parameters from Intel SDM Gleb Natapov
2010-03-15 14:38 ` [PATCH v3 24/30] KVM: x86 emulator: during rep emulation decrement ECX only if emulation succeeded Gleb Natapov
2010-03-15 14:38 ` [PATCH v3 25/30] KVM: x86 emulator: fix in/out emulation Gleb Natapov
2010-03-15 14:38 ` [PATCH v3 26/30] KVM: x86 emulator: Move string pio emulation into emulator.c Gleb Natapov
2010-03-15 14:38 ` [PATCH v3 27/30] KVM: x86 emulator: remove saved_eip Gleb Natapov
2010-03-15 14:38 ` [PATCH v3 28/30] KVM: x86 emulator: restart string instruction without going back to a guest Gleb Natapov
2010-03-15 14:38 ` [PATCH v3 29/30] KVM: x86 emulator: introduce pio in string read ahead Gleb Natapov
2010-03-15 14:38 ` [PATCH v3 30/30] KVM: small kvm_arch_vcpu_ioctl_run() cleanup Gleb Natapov
2010-03-15 15:04 ` [PATCH v3 00/30] emulator cleanup Avi Kivity
2010-03-15 15:51 ` Andre Przywara
2010-03-15 16:57 ` Gleb Natapov
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=20100315181024.GD5406@redhat.com \
--to=gleb@redhat.com \
--cc=andre.przywara@amd.com \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.com \
/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