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 <[email protected]>

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);
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to