All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Nadav Amit <nadav.amit@gmail.com>
Cc: Nadav Amit <namit@cs.technion.ac.il>, KVM <kvm@vger.kernel.org>
Subject: Re: [PATCH] KVM: vmx: VMXOFF emulation in vm86 should cause #UD
Date: Fri, 29 Aug 2014 10:57:58 +0200	[thread overview]
Message-ID: <54004096.2080104@redhat.com> (raw)
In-Reply-To: <CAF79F43-D597-426E-97DE-FB3DB0E0D505@gmail.com>

Il 29/08/2014 10:52, Nadav Amit ha scritto:
> > Patch looks good, but where is the check that MOD == 3 in the "case
> > RMExt"?  Am I just not seeing it?
> 
> This seems to be part of the “case GroupDual”.

GroupDual handles it, but the EXT() macro you're using is exactly what 
you want:

#define RMExt       (4<<15)     /* Opcode extension in ModRM r/m if mod == 3 */

I guess what's missing is

------------------ 8< ------------------
Subject: [PATCH] Check ModRM for RMExt

Some group7 extensions are only defined for mod==3.  Check this and
reject emulation if mod!=3.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index 56657b0bb3bb..d472e4d50e3c 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -4360,6 +4360,8 @@ done_prefixes:
 				opcode = opcode.u.gdual->mod012[goffset];
 			break;
 		case RMExt:
+			if ((ctxt->modrm >> 6) == 3)
+				return EMULATION_FAILED;
 			goffset = ctxt->modrm & 7;
 			opcode = opcode.u.group[goffset];
 			break;

What do you think?

Paolo

  reply	other threads:[~2014-08-29  8:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-29  8:26 [PATCH] KVM: vmx: VMXOFF emulation in vm86 should cause #UD Nadav Amit
2014-08-29  8:36 ` Paolo Bonzini
2014-08-29  8:52   ` Nadav Amit
2014-08-29  8:57     ` Paolo Bonzini [this message]
2014-08-29  9:12       ` Nadav Amit
2014-08-29  9:47         ` Paolo Bonzini

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=54004096.2080104@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=nadav.amit@gmail.com \
    --cc=namit@cs.technion.ac.il \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.