* x86_decode_insn succeeds with GroupMask flags when it should fail
@ 2012-01-07 10:37 Stefan Hajnoczi
2012-01-08 14:51 ` Avi Kivity
0 siblings, 1 reply; 2+ messages in thread
From: Stefan Hajnoczi @ 2012-01-07 10:37 UTC (permalink / raw)
To: kvm; +Cc: Takuya Yoshikawa
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;
Stefan
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: x86_decode_insn succeeds with GroupMask flags when it should fail
2012-01-07 10:37 x86_decode_insn succeeds with GroupMask flags when it should fail Stefan Hajnoczi
@ 2012-01-08 14:51 ` Avi Kivity
0 siblings, 0 replies; 2+ messages in thread
From: Avi Kivity @ 2012-01-08 14:51 UTC (permalink / raw)
To: Stefan Hajnoczi; +Cc: kvm, Takuya Yoshikawa
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-01-08 14:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-07 10:37 x86_decode_insn succeeds with GroupMask flags when it should fail Stefan Hajnoczi
2012-01-08 14:51 ` Avi Kivity
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).