All of lore.kernel.org
 help / color / mirror / Atom feed
* KVM: x86: use proper port value when checking io instruction permission
@ 2011-05-24 17:11 Marcelo Tosatti
  2011-05-24 17:27 ` Gleb Natapov
  0 siblings, 1 reply; 23+ messages in thread
From: Marcelo Tosatti @ 2011-05-24 17:11 UTC (permalink / raw)
  To: kvm; +Cc: Avi Kivity, Joerg Roedel


Commit fa4491a6b667304 moved the permission check for io instructions
to the ->check_perm callback. It failed to copy the port value from RDX
register for string and "in,out ax,dx" instructions. Fix it.

Fixes FC8.32 installation.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>

diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index 3bc6b7a..df354a4 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -2944,6 +2944,15 @@ static int check_perm_in(struct x86_emulate_ctxt *ctxt)
 {
 	struct decode_cache *c = &ctxt->decode;
 
+	switch (c->b) {
+	case 0x6c: /* insb */
+	case 0x6d: /* insw/insd */
+	case 0xec: /* in al,dx */
+	case 0xed: /* in (e/r)ax,dx */
+		c->src.val = c->regs[VCPU_REGS_RDX];
+		break;
+	}
+
 	c->dst.bytes = min(c->dst.bytes, 4u);
 	if (!emulator_io_permited(ctxt, c->src.val, c->dst.bytes))
 		return emulate_gp(ctxt, 0);
@@ -2955,6 +2964,15 @@ static int check_perm_out(struct x86_emulate_ctxt *ctxt)
 {
 	struct decode_cache *c = &ctxt->decode;
 
+	switch (c->b) {
+	case 0x6e: /* outsb */
+	case 0x6f: /* outsw/outsd */
+	case 0xee: /* out dx,al */
+	case 0xef: /* out dx,(e/r)ax */
+		c->dst.val = c->regs[VCPU_REGS_RDX];
+		break;
+	}
+
 	c->src.bytes = min(c->src.bytes, 4u);
 	if (!emulator_io_permited(ctxt, c->dst.val, c->src.bytes))
 		return emulate_gp(ctxt, 0);

^ permalink raw reply related	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2011-05-30 18:28 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-24 17:11 KVM: x86: use proper port value when checking io instruction permission Marcelo Tosatti
2011-05-24 17:27 ` Gleb Natapov
2011-05-24 19:07   ` Avi Kivity
2011-05-24 19:18     ` Gleb Natapov
2011-05-24 19:25       ` Avi Kivity
2011-05-25 18:18   ` KVM: x86: use proper port value when checking io instruction permission (v2) Marcelo Tosatti
2011-05-26  6:31     ` Avi Kivity
2011-05-26  6:55       ` Gleb Natapov
2011-05-26  7:02         ` Avi Kivity
2011-05-26  7:04           ` Avi Kivity
2011-05-26  7:07             ` Gleb Natapov
2011-05-26  7:49               ` Paolo Bonzini
2011-05-26  8:26                 ` Gleb Natapov
2011-05-26  9:00                   ` Paolo Bonzini
2011-05-26  9:02                     ` Gleb Natapov
2011-05-26  9:23                       ` Paolo Bonzini
2011-05-26  9:29                         ` Gleb Natapov
2011-05-26 10:43                 ` Marcelo Tosatti
2011-05-26 11:56       ` KVM: x86: use proper port value when checking io instruction permission (v3) Marcelo Tosatti
2011-05-29  8:34         ` Avi Kivity
2011-05-30 18:23           ` KVM: x86: use proper port value when checking io instruction permission (v4) Marcelo Tosatti
2011-05-30 18:28             ` Avi Kivity
2011-05-30 18:23           ` KVM: x86: use proper port value when checking io instruction permission (v3) Marcelo Tosatti

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.