|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v3 2/3] xen/pvh: check permissions when adding MMIO regions
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@xxxxxxxxxx>
> Cc: Jan Beulich <jbeulich@xxxxxxxx>
> Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
> ---
> 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@xxxxxxxxxxxxx
> http://lists.xen.org/xen-devel
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |