All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shannon Zhao <zhaoshenglong@huawei.com>
To: Julien Grall <julien.grall@arm.com>, xen-devel@lists.xen.org
Cc: sstabellini@kernel.org, wei.liu2@citrix.com,
	Shannon Zhao <shannon.zhao@linaro.org>
Subject: Re: [PATCH] xen/arm: map_dev_mmio_region: The iomem permission check should be done on MFN
Date: Wed, 15 Jun 2016 09:43:25 +0800	[thread overview]
Message-ID: <5760B2BD.8090804@huawei.com> (raw)
In-Reply-To: <1465905026-12887-1-git-send-email-julien.grall@arm.com>

Hi Julien,

On 2016/6/14 19:50, Julien Grall wrote:
> The helper iomem_access_permitted expects MFNs in parameters and not
> GNFs. Thankfully only the hardware domain can call this function and
> it will always be with GFNS == MFNs for now.
> 
> Also, fix the printf to use the MFN range and not the GFN one.
> 
> Signed-off-by: Julien Grall <julien.grall@arm.com>
> Cc: Shannon Zhao <shannon.zhao@linaro.org>
> 
Reviewed-by: Shannon Zhao <shannon.zhao@linaro.org>

> ---
>     This patch is a good candidate to backport to Xen 4.7. Without
>     it, the hardware domain can map any MMIO because the permission
>     check is done on the GPFNs and not the MNFs.
> ---
>  xen/arch/arm/p2m.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
> index 6a19c57..4c6547d 100644
> --- a/xen/arch/arm/p2m.c
> +++ b/xen/arch/arm/p2m.c
> @@ -1275,14 +1275,14 @@ int map_dev_mmio_region(struct domain *d,
>  {
>      int res;
>  
> -    if ( !(nr && iomem_access_permitted(d, start_gfn, start_gfn + nr - 1)) )
> +    if ( !(nr && iomem_access_permitted(d, mfn, mfn + nr - 1)) )
>          return 0;
>  
>      res = map_mmio_regions(d, start_gfn, nr, mfn);
>      if ( res < 0 )
>      {
>          printk(XENLOG_G_ERR "Unable to map [%#lx - %#lx] in Dom%d\n",
> -               start_gfn, start_gfn + nr - 1, d->domain_id);
> +               mfn, mfn + nr - 1, d->domain_id);
>          return res;
>      }
>  
> 

-- 
Shannon


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

  reply	other threads:[~2016-06-15  1:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-14 11:50 [PATCH] xen/arm: map_dev_mmio_region: The iomem permission check should be done on MFN Julien Grall
2016-06-15  1:43 ` Shannon Zhao [this message]
2016-07-11 17:41   ` Stefano Stabellini
2016-06-24 10:29 ` Julien Grall

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=5760B2BD.8090804@huawei.com \
    --to=zhaoshenglong@huawei.com \
    --cc=julien.grall@arm.com \
    --cc=shannon.zhao@linaro.org \
    --cc=sstabellini@kernel.org \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xen.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.