From mboxrd@z Thu Jan 1 00:00:00 1970 From: Konrad Rzeszutek Wilk Subject: Re: [PATCH v3 2/3] xen/pvh: check permissions when adding MMIO regions Date: Thu, 22 Jan 2015 15:28:24 -0500 Message-ID: <20150122202824.GD5813@l.oracle.com> References: <1421939963-22182-1-git-send-email-roger.pau@citrix.com> <1421939963-22182-3-git-send-email-roger.pau@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YEOMj-0008Ly-Tg for xen-devel@lists.xenproject.org; Thu, 22 Jan 2015 20:28:34 +0000 Content-Disposition: inline In-Reply-To: <1421939963-22182-3-git-send-email-roger.pau@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Roger Pau Monne Cc: xen-devel@lists.xenproject.org, Jan Beulich , Andrew Cooper List-Id: xen-devel@lists.xenproject.org On Thu, Jan 22, 2015 at 04:19:22PM +0100, Roger Pau Monne wrote: > Check that MMIO regions added to PVH Dom0 are allowed. Previously a PVH D= om0 > would have access to the full MMIO range. How do we do this for normal PV dom0? Do we enforce the same restriction? If not, should we ? > = > Signed-off-by: Roger Pau Monn=E9 > Cc: Jan Beulich > Cc: Andrew Cooper > --- > Changes since v2: > - Fix coding style. > = > Changes since v1: > - Use the newly introduced p2m_access_t to set the access type. > - Don't add a next label. > --- > xen/arch/x86/domain_build.c | 15 ++++++++++++++- > 1 file changed, 14 insertions(+), 1 deletion(-) > = > diff --git a/xen/arch/x86/domain_build.c b/xen/arch/x86/domain_build.c > index 01cfa58..76722f7 100644 > --- a/xen/arch/x86/domain_build.c > +++ b/xen/arch/x86/domain_build.c > @@ -320,11 +320,24 @@ static __init void pvh_add_mem_mapping(struct domai= n *d, unsigned long gfn, > { > unsigned long i; > p2m_access_t a; > + mfn_t omfn; > + p2m_type_t t; > int rc; > = > - a =3D p2m_get_hostp2m(d)->default_access; > for ( i =3D 0; i < nr_mfns; i++ ) > { > + if ( !iomem_access_permitted(d, mfn + i, mfn + i) ) > + { > + omfn =3D get_gfn_query_unlocked(d, gfn + i, &t); > + guest_physmap_remove_page(d, gfn + i, mfn_x(omfn), PAGE_ORDE= R_4K); > + continue; > + } > + > + if ( rangeset_contains_singleton(mmio_ro_ranges, mfn + i) ) > + a =3D p2m_access_r; > + else > + a =3D p2m_access_rw; > + > if ( (rc =3D set_mmio_p2m_entry(d, gfn + i, _mfn(mfn + i), a)) ) > panic("pvh_add_mem_mapping: gfn:%lx mfn:%lx i:%ld rc:%d\n", > gfn, mfn, i, rc); > -- = > 1.9.3 (Apple Git-50) > = > = > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > http://lists.xen.org/xen-devel