From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: x86_decode_insn succeeds with GroupMask flags when it should fail Date: Sun, 08 Jan 2012 16:51:14 +0200 Message-ID: <4F09AD62.8090308@redhat.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: kvm , Takuya Yoshikawa To: Stefan Hajnoczi Return-path: Received: from mx1.redhat.com ([209.132.183.28]:5977 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752650Ab2AHOvS (ORCPT ); Sun, 8 Jan 2012 09:51:18 -0500 In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: On 01/07/2012 12:37 PM, Stefan Hajnoczi wrote: > The unimplemented movdqa (66 0f 7f 07) instruction triggers a bug in > the x86 emulator. The emulator should fail since the instruction is > unimplemented. However the emulator thinks it is succeeding but we > keep re-executing the same instruction over and over. top shows 100% > CPU utilization and perf top shows we're constantly running through > the x86 emulator in kvm.ko. > > The problem is that ctxt->d != 0 even though the instruction is > unimplemented (N): > > while (ctxt->d & GroupMask) { > switch (ctxt->d & GroupMask) { > ... <-- opcode zeroed if instruction is unimplemented > } > > ctxt->d &= ~(u64)GroupMask; <-- only clears GroupMask > ctxt->d |= opcode.flags; <-- opcode.flags == 0, ctxt->d != 0 > } > > ... > > /* Unrecognised? */ > if (ctxt->d == 0 || (ctxt->d & Undefined)) <-- always false > return EMULATION_FAILED; > #define N D(Undefined) should fix it. -- error compiling committee.c: too many arguments to function