All of lore.kernel.org
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Roger Pau Monne <roger.pau@citrix.com>
Cc: xen-devel@lists.xenproject.org, Jan Beulich <jbeulich@suse.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>
Subject: Re: [PATCH v3 2/3] xen/pvh: check permissions when adding MMIO regions
Date: Thu, 22 Jan 2015 15:28:24 -0500	[thread overview]
Message-ID: <20150122202824.GD5813@l.oracle.com> (raw)
In-Reply-To: <1421939963-22182-3-git-send-email-roger.pau@citrix.com>

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 Dom0
> 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é <roger.pau@citrix.com>
> Cc: Jan Beulich <jbeulich@suse.com>
> Cc: Andrew Cooper <andrew.cooper3@citrix.com>
> ---
> 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 domain *d, unsigned long gfn,
>  {
>      unsigned long i;
>      p2m_access_t a;
> +    mfn_t omfn;
> +    p2m_type_t t;
>      int rc;
>  
> -    a = p2m_get_hostp2m(d)->default_access;
>      for ( i = 0; i < nr_mfns; i++ )
>      {
> +        if ( !iomem_access_permitted(d, mfn + i, mfn + i) )
> +        {
> +            omfn = get_gfn_query_unlocked(d, gfn + i, &t);
> +            guest_physmap_remove_page(d, gfn + i, mfn_x(omfn), PAGE_ORDER_4K);
> +            continue;
> +        }
> +
> +        if ( rangeset_contains_singleton(mmio_ro_ranges, mfn + i) )
> +            a = p2m_access_r;
> +        else
> +            a = p2m_access_rw;
> +
>          if ( (rc = 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

  parent reply	other threads:[~2015-01-22 20:28 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-22 15:19 [PATCH v3 0/3] xen/pvh: prevent Dom0 from accessing reserved MMIO regions Roger Pau Monne
2015-01-22 15:19 ` [PATCH v3 1/3] xen: allow set_mmio_p2m_entry to specify access type Roger Pau Monne
2015-01-22 15:25   ` Tim Deegan
2015-01-22 15:19 ` [PATCH v3 2/3] xen/pvh: check permissions when adding MMIO regions Roger Pau Monne
2015-01-22 15:43   ` Jan Beulich
2015-01-23 11:29     ` Roger Pau Monné
2015-01-23 11:44       ` Jan Beulich
2015-01-22 20:28   ` Konrad Rzeszutek Wilk [this message]
2015-01-23 11:21     ` Jan Beulich
2015-01-23 15:04       ` Konrad Rzeszutek Wilk
2015-01-22 15:19 ` [PATCH v3 3/3] xen: prevent access to HPET from Dom0 Roger Pau Monne
2015-01-22 15:47   ` Jan Beulich
2015-01-23 11:46     ` Roger Pau Monné

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=20150122202824.GD5813@l.oracle.com \
    --to=konrad.wilk@oracle.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=roger.pau@citrix.com \
    --cc=xen-devel@lists.xenproject.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.