aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2013-10-31 18:05:24 -0400
committerGleb Natapov <gleb@redhat.com>2013-11-03 09:50:37 -0500
commitdaf727225b8abfdfe424716abac3d15a3ac5626a (patch)
treec8915168c207e0c17ee44aa2bc49245dd8ee212e /arch/x86/kvm
parent81e87e26796782e014fd1f2bb9cd8fb6ce4021a8 (diff)
KVM: x86: fix emulation of "movzbl %bpl, %eax"
When I was looking at RHEL5.9's failure to start with unrestricted_guest=0/emulate_invalid_guest_state=1, I got it working with a slightly older tree than kvm.git. I now debugged the remaining failure, which was introduced by commit 660696d1 (KVM: X86 emulator: fix source operand decoding for 8bit mov[zs]x instructions, 2013-04-24) introduced a similar mis-emulation to the one in commit 8acb4207 (KVM: fix sil/dil/bpl/spl in the mod/rm fields, 2013-05-30). The incorrect decoding occurs in 8-bit movzx/movsx instructions whose 8-bit operand is sil/dil/bpl/spl. Needless to say, "movzbl %bpl, %eax" does occur in RHEL5.9's decompression prolog, just a handful of instructions before finally giving control to the decompressed vmlinux and getting out of the invalid guest state. Because OpMem8 bypasses decode_modrm, the same handling of the REX prefix must be applied to OpMem8. Reported-by: Michele Baldessari <michele@redhat.com> Cc: stable@vger.kernel.org Cc: Gleb Natapov <gleb@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Gleb Natapov <gleb@redhat.com>
Diffstat (limited to 'arch/x86/kvm')
-rw-r--r--arch/x86/kvm/emulate.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index 16c037e7db7d..282d28cb9931 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -4117,7 +4117,10 @@ static int decode_operand(struct x86_emulate_ctxt *ctxt, struct operand *op,
4117 case OpMem8: 4117 case OpMem8:
4118 ctxt->memop.bytes = 1; 4118 ctxt->memop.bytes = 1;
4119 if (ctxt->memop.type == OP_REG) { 4119 if (ctxt->memop.type == OP_REG) {
4120 ctxt->memop.addr.reg = decode_register(ctxt, ctxt->modrm_rm, 1); 4120 int highbyte_regs = ctxt->rex_prefix == 0;
4121
4122 ctxt->memop.addr.reg = decode_register(ctxt, ctxt->modrm_rm,
4123 highbyte_regs);
4121 fetch_register_operand(&ctxt->memop); 4124 fetch_register_operand(&ctxt->memop);
4122 } 4125 }
4123 goto mem_common; 4126 goto mem_common;