From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: KVM: x86: use proper port value when checking io instruction permission (v3) Date: Sun, 29 May 2011 11:34:43 +0300 Message-ID: <4DE20523.7080707@redhat.com> References: <20110524171120.GA19906@amt.cnet> <20110524172706.GC22042@redhat.com> <20110525181820.GA14921@amt.cnet> <4DDDF3D6.3000505@redhat.com> <20110526115605.GA29882@amt.cnet> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Gleb Natapov , kvm , Joerg Roedel To: Marcelo Tosatti Return-path: Received: from mx1.redhat.com ([209.132.183.28]:4031 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751127Ab1E2Ies (ORCPT ); Sun, 29 May 2011 04:34:48 -0400 In-Reply-To: <20110526115605.GA29882@amt.cnet> Sender: kvm-owner@vger.kernel.org List-ID: On 05/26/2011 02:56 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. > > diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c > index 3bc6b7a..fc3d2d9 100644 > --- a/arch/x86/kvm/emulate.c > +++ b/arch/x86/kvm/emulate.c > @@ -47,7 +47,7 @@ > #define DstDI (5<<1) /* Destination is in ES:(E)DI */ > #define DstMem64 (6<<1) /* 64bit memory operand */ > #define DstImmUByte (7<<1) /* 8-bit unsigned immediate operand */ > -#define DstMask (7<<1) > +#define DstMask ((7<<1) | (1<<18)) Ouch, why?? My comment about bits 19-20 was only about the shifting of of Prot etc. from 21+ to 22+. -- error compiling committee.c: too many arguments to function