From: Gleb Natapov <gleb@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: linux-kernel@vger.kernel.org,
Michele Baldessari <michele@redhat.com>,
stable@vger.kernel.org
Subject: Re: [PATCH] KVM: x86: fix emulation of "movzbl %bpl, %eax"
Date: Fri, 1 Nov 2013 12:59:28 +0200 [thread overview]
Message-ID: <20131101105928.GE20205@redhat.com> (raw)
In-Reply-To: <1383257124-8241-1-git-send-email-pbonzini@redhat.com>
On Thu, Oct 31, 2013 at 11:05:24PM +0100, Paolo Bonzini wrote:
> 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>
Reviewed-by: Gleb Natapov <gleb@redhat.com>
> ---
> 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 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,
> 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
--
Gleb.
next prev parent reply other threads:[~2013-11-01 10:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-31 22:05 [PATCH] KVM: x86: fix emulation of "movzbl %bpl, %eax" Paolo Bonzini
2013-11-01 10:59 ` Gleb Natapov [this message]
2013-11-03 14:50 ` Gleb Natapov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20131101105928.GE20205@redhat.com \
--to=gleb@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=michele@redhat.com \
--cc=pbonzini@redhat.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).