From be089ee6cae01ff37525249972cba0623be26018 Mon Sep 17 00:00:00 2001 From: Josh Boyer Date: Nov 18 2013 19:19:43 +0000 Subject: Add patch to fix rhel5.9 KVM guests (rhbz 967652) --- diff --git a/KVM-x86-fix-emulation-of-movzbl-bpl-eax.patch b/KVM-x86-fix-emulation-of-movzbl-bpl-eax.patch new file mode 100644 index 0000000..65a48c3 --- /dev/null +++ b/KVM-x86-fix-emulation-of-movzbl-bpl-eax.patch @@ -0,0 +1,53 @@ +Bugzilla: 967652 +Upstream-status: 3.13 (should hit stable) + +From daf727225b8abfdfe424716abac3d15a3ac5626a Mon Sep 17 00:00:00 2001 +From: Paolo Bonzini +Date: Thu, 31 Oct 2013 23:05:24 +0100 +Subject: [PATCH] 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 +Cc: stable@vger.kernel.org +Cc: Gleb Natapov +Signed-off-by: Paolo Bonzini +Signed-off-by: Gleb Natapov +--- + arch/x86/kvm/emulate.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c +index 16c037e..282d28c 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, + case OpMem8: + ctxt->memop.bytes = 1; + if (ctxt->memop.type == OP_REG) { +- ctxt->memop.addr.reg = decode_register(ctxt, ctxt->modrm_rm, 1); ++ int highbyte_regs = ctxt->rex_prefix == 0; ++ ++ ctxt->memop.addr.reg = decode_register(ctxt, ctxt->modrm_rm, ++ highbyte_regs); + fetch_register_operand(&ctxt->memop); + } + goto mem_common; +-- +1.8.3.1 + diff --git a/kernel.spec b/kernel.spec index 21239a9..532c2f5 100644 --- a/kernel.spec +++ b/kernel.spec @@ -810,6 +810,9 @@ Patch25148: alx-Reset-phy-speed-after-resume.patch #rhbz 1031086 Patch25150: slab_common-Do-not-check-for-duplicate-slab-names.patch +#rhbz 967652 +Patch25151: KVM-x86-fix-emulation-of-movzbl-bpl-eax.patch + # END OF PATCH DEFINITIONS %endif @@ -1557,6 +1560,9 @@ ApplyPatch alx-Reset-phy-speed-after-resume.patch #rhbz 1031086 ApplyPatch slab_common-Do-not-check-for-duplicate-slab-names.patch +#rhbz 967652 +ApplyPatch KVM-x86-fix-emulation-of-movzbl-bpl-eax.patch + # END OF PATCH APPLICATIONS %endif @@ -2399,6 +2405,7 @@ fi # || || %changelog * Mon Nov 18 2013 Josh Boyer +- Add patch to fix rhel5.9 KVM guests (rhbz 967652) - Add patch to fix crash from slab when using md-raid mirrors (rhbz 1031086) - Add patches from Pierre Ossman to fix 24Hz/24p radeon audio (rhbz 1010679) - Add patch to fix ALX phy issues after resume (rhbz 1011362)