[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <B8075446-5721-4D41-99A1-19B729691F42@gmail.com>
Date: Wed, 13 Aug 2014 17:21:29 +0300
From: Nadav Amit <nadav.amit@...il.com>
To: Paolo Bonzini <pbonzini@...hat.com>
Cc: gleb@...nel.org, Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
"H. Peter Anvin" <hpa@...or.com>,
the arch/x86 maintainers <x86@...nel.org>,
KVM <kvm@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Nadav Amit <namit@...technion.ac.il>
Subject: Re: [PATCH] KVM: x86: Avoid emulating instructions on #UD mistakenly
Correction: the word “never” in the message is too harsh.
Nonetheless, there is a regression bug. I encountered it with “wrfsbase” instruction.
Nadav
On Aug 13, 2014, at 4:50 PM, Nadav Amit <namit@...technion.ac.il> wrote:
> Commit d40a6898e5 mistakenly caused instructions which are not marked as
> EmulateOnUD to be emulated upon #UD exception. The commit caused the check of
> whether the instruction flags include EmulateOnUD to never be evaluated. As a
> result instructions whose emulation is broken may be emulated. This fix moves
> the evaluation of EmulateOnUD so it would be evaluated.
>
> Signed-off-by: Nadav Amit <namit@...technion.ac.il>
> ---
> arch/x86/kvm/emulate.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
> index 56657b0..37a83b2 100644
> --- a/arch/x86/kvm/emulate.c
> +++ b/arch/x86/kvm/emulate.c
> @@ -4394,6 +4394,9 @@ done_prefixes:
>
> ctxt->execute = opcode.u.execute;
>
> + if (!(ctxt->d & EmulateOnUD) && ctxt->ud)
> + return EMULATION_FAILED;
> +
> if (unlikely(ctxt->d &
> (NotImpl|EmulateOnUD|Stack|Op3264|Sse|Mmx|Intercept|CheckPerm))) {
> /*
> @@ -4406,9 +4409,6 @@ done_prefixes:
> if (ctxt->d & NotImpl)
> return EMULATION_FAILED;
>
> - if (!(ctxt->d & EmulateOnUD) && ctxt->ud)
> - return EMULATION_FAILED;
> -
> if (mode == X86EMUL_MODE_PROT64 && (ctxt->d & Stack))
> ctxt->op_bytes = 8;
>
> --
> 1.9.1
>
Download attachment "signature.asc" of type "application/pgp-signature" (496 bytes)
Powered by blists - more mailing lists