From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andre Przywara Subject: Re: [PATCH v3 16/30] KVM: x86 emulator: If LOCK prefix is used dest arg should be memory. Date: Mon, 15 Mar 2010 16:46:20 +0100 Message-ID: <4B9E564C.4060306@amd.com> References: <1268663937-27784-1-git-send-email-gleb@redhat.com> <1268663937-27784-17-git-send-email-gleb@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit Cc: avi@redhat.com, mtosatti@redhat.com, kvm@vger.kernel.org To: Gleb Natapov Return-path: Received: from va3ehsobe003.messaging.microsoft.com ([216.32.180.13]:21315 "EHLO VA3EHSOBE003.bigfish.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S936228Ab0COPrb (ORCPT ); Mon, 15 Mar 2010 11:47:31 -0400 In-Reply-To: <1268663937-27784-17-git-send-email-gleb@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: 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. Regards, Andre. > > Signed-off-by: Gleb Natapov > --- > 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