public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Gleb Natapov <gleb@redhat.com>
To: Avi Kivity <avi@redhat.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>, kvm <kvm@vger.kernel.org>,
	Joerg Roedel <joerg.roedel@amd.com>
Subject: Re: KVM: x86: use proper port value when checking io instruction permission (v2)
Date: Thu, 26 May 2011 09:55:11 +0300	[thread overview]
Message-ID: <20110526065511.GA29458@redhat.com> (raw)
In-Reply-To: <4DDDF3D6.3000505@redhat.com>

On Thu, May 26, 2011 at 09:31:50AM +0300, Avi Kivity wrote:
> On 05/25/2011 09:18 PM, Marcelo Tosatti wrote:
> >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 by reading RDX register at decode stage when appropriate.
> >
> >Fixes FC8.32 installation.
> >
> >+#define Sse         (1<<18)     /* SSE Vector instruction */
> 
> 19/20 are still available, no need to go 64-bit just yet.
> 
> >  /* Misc flags */
> >-#define Prot        (1<<21) /* instruction generates #UD if not in prot-mode */
> >
> >+	case SrcDX:
> >+		c->src.type = OP_REG;
> >+		c->src.bytes = c->op_bytes;
> 
> Needs to be 2.  Otherwise we'll see extra bits from edx, or lose
> bits from dx if it's a 1-byte instruction.
> 
But those extra bits will be dropped by check_perm_in() anyway. Can
c->op_bytes ever be 1?

> >+		c->src.addr.reg =&c->regs[VCPU_REGS_RDX];
> >+		fetch_register_operand(&c->src);
> >+		break;
> >  	}
> >
> >  	if (rc != X86EMUL_CONTINUE)
> >@@ -3649,6 +3657,12 @@ done_prefixes:
> >  		c->dst.addr.mem.seg = VCPU_SREG_ES;
> >  		c->dst.val = 0;
> >  		break;
> >+	case DstDX:
> >+		c->dst.type = OP_REG;
> >+		c->dst.bytes = c->op_bytes;
> 
> 2 again.
> 
> >+		c->dst.addr.reg =&c->regs[VCPU_REGS_RDX];
> >+		fetch_register_operand(&c->dst);
> >+		break;
> >  	case ImplicitOps:
> >  		/* Special instructions do their own operand decoding. */
> >  	default:
> 
> We also need to unify Src/Dst decode eventually.
> 
> -- 
> I have a truly marvellous patch that fixes the bug which this
> signature is too narrow to contain.

--
			Gleb.

  reply	other threads:[~2011-05-26  6:55 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

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=20110526065511.GA29458@redhat.com \
    --to=gleb@redhat.com \
    --cc=avi@redhat.com \
    --cc=joerg.roedel@amd.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    /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