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 <[email protected]>
> >---
> > 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.
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to