From: "Jan Beulich" Subject: Re: [PATCH v7 10/10] xen/common: do not implicitly permit access to mapped I/O memory Date: Mon, 26 May 2014 11:14:58 +0100 Message-ID: <538330420200007800015B2B@mail.emea.novell.com> References: <1399305254-3695-1-git-send-email-avanzini.arianna@gmail.com> <1399305254-3695-11-git-send-email-avanzini.arianna@gmail.com> <5368C22B020000780000F3C9@mail.emea.novell.com> <53822511.1040604@linaro.org> <53831F6502000078000159F6@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <53831F6502000078000159F6@mail.emea.novell.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Arianna Avanzini , Julien Grall Cc: Ian.Campbell@eu.citrix.com, paolo.valente@unimore.it, keir@xen.org, stefano.stabellini@eu.citrix.com, andrew.cooper3@citrix.com, dario.faggioli@citrix.com, Ian.Jackson@eu.citrix.com, xen-devel@lists.xen.org, julien.grall@citrix.com, etrudeau@broadcom.com, tim@xen.org, viktor.kleinik@globallogic.com List-Id: xen-devel@lists.xenproject.org >>> On 26.05.14 at 11:03, wrote: >>>> On 25.05.14 at 19:14, wrote: >> On 06/05/14 10:06, Jan Beulich wrote: >>>> @@ -838,7 +842,7 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) > u_domctl) >>>> break; >>>> >>>> ret = -EPERM; >>>> - if ( !iomem_access_permitted(current->domain, mfn, mfn_end) ) >>>> + if ( !iomem_access_permitted(d, mfn, mfn_end) ) >>> >>> I'm not sure if we shouldn't rather be conservative here and check >>> both domains' permissions. >> >> I think we only need to check the permission of the current domain. >> Checking the permission of the guest is not necessary here. Hence, the >> code to map a region will be more difficult. We will have first call >> iomem_permission then call memory_mapping. >> >> I would prefer to keep the current permission check ie: >> >> if ( !iomem_access_permitted(current->domain, ...) ) > > In fact my earlier comment was wrong - for some reason I was > thinking this was the mapping operation that gets modified here, > not the permission one. For the permission one it is of course > wrong to check the subject domain's permissions, as they're only > about to be granted. Or maybe I wasn't wrong - the patch context doesn't really make clear whether it's the granting or mapping operation that gets adjusted here (since an earlier patch moved the mapping one into this function). Jan