From: Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
To: Stefano Stabellini <sstabellini@kernel.org>
Cc: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
"julien.grall@arm.com" <julien.grall@arm.com>,
Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>,
Stefano Stabellini <stefanos@xilinx.com>
Subject: Re: [Xen-devel] [PATCH v5 6/7] xen/arm: don't iomem_permit_access for reserved-memory regions
Date: Tue, 13 Aug 2019 14:34:37 +0000 [thread overview]
Message-ID: <87blwtgmma.fsf@epam.com> (raw)
In-Reply-To: <20190812222844.9636-6-sstabellini@kernel.org>
Stefano Stabellini writes:
> Don't allow reserved-memory regions to be remapped into any unprivileged
> guests, until reserved-memory regions are properly supported in Xen. For
> now, do not call iomem_permit_access on them, because giving
> iomem_permit_access to dom0 means that the toolstack will be able to
> assign the region to a domU.
>
> Signed-off-by: Stefano Stabellini <stefanos@xilinx.com>
> ---
>
> Changes in v5:
> - fix check condition
> - use strnicmp
> - return error
> - improve commit message
>
> Changes in v4:
> - compare the parent name with reserved-memory
> - use dt_node_cmp
>
> Changes in v3:
> - new patch
> ---
> xen/arch/arm/domain_build.c | 24 ++++++++++++++++--------
> 1 file changed, 16 insertions(+), 8 deletions(-)
>
> diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
> index 4c8404155a..e0c0c01c88 100644
> --- a/xen/arch/arm/domain_build.c
> +++ b/xen/arch/arm/domain_build.c
> @@ -1155,15 +1155,23 @@ static int __init map_range_to_domain(const struct dt_device_node *dev,
> bool need_mapping = !dt_device_for_passthrough(dev);
> int res;
>
> - res = iomem_permit_access(d, paddr_to_pfn(addr),
> - paddr_to_pfn(PAGE_ALIGN(addr + len - 1)));
> - if ( res )
> + /*
> + * Don't give iomem permissions for reserved-memory ranges to domUs
> + * until reserved-memory support is complete.
> + */
> + if ( strnicmp(dt_node_full_name(dev), "/reserved-memory",
> + strlen("/reserved-memory")) != 0 )
Why are you using strnicmp there? With such usage it is the same as
strcasecmp(). But, if you want to find "/reserved-memory" anywhere in
dt_node_full_name(dev), then you probably want to use strcasestr()
> {
> - printk(XENLOG_ERR "Unable to permit to dom%d access to"
> - " 0x%"PRIx64" - 0x%"PRIx64"\n",
> - d->domain_id,
> - addr & PAGE_MASK, PAGE_ALIGN(addr + len) - 1);
> - return res;
> + res = iomem_permit_access(d, paddr_to_pfn(addr),
> + paddr_to_pfn(PAGE_ALIGN(addr + len - 1)));
> + if ( res )
> + {
> + printk(XENLOG_ERR "Unable to permit to dom%d access to"
> + " 0x%"PRIx64" - 0x%"PRIx64"\n",
> + d->domain_id,
> + addr & PAGE_MASK, PAGE_ALIGN(addr + len) - 1);
> + return res;
> + }
> }
>
> if ( need_mapping )
--
Volodymyr Babchuk at EPAM
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2019-08-13 14:35 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-12 22:28 [Xen-devel] [PATCH v5 0/7] reserved-memory in dom0 Stefano Stabellini
2019-08-12 22:28 ` [Xen-devel] [PATCH v5 1/7] xen/arm: pass node to device_tree_for_each_node Stefano Stabellini
2019-08-13 13:45 ` Volodymyr Babchuk
2019-08-14 22:12 ` Stefano Stabellini
2019-08-13 17:25 ` Julien Grall
2019-08-14 22:11 ` Stefano Stabellini
2019-08-12 22:28 ` [Xen-devel] [PATCH v5 2/7] xen/arm: make process_memory_node a device_tree_node_func Stefano Stabellini
2019-08-13 14:14 ` Volodymyr Babchuk
2019-08-14 22:35 ` Stefano Stabellini
2019-08-15 9:12 ` Julien Grall
2019-08-15 11:20 ` Volodymyr Babchuk
2019-08-15 11:24 ` Julien Grall
2019-08-15 11:29 ` Julien Grall
2019-08-15 12:14 ` Volodymyr Babchuk
2019-08-15 12:33 ` Julien Grall
2019-08-15 13:51 ` Volodymyr Babchuk
2019-08-15 14:15 ` Julien Grall
2019-08-13 17:37 ` Julien Grall
2019-08-14 22:54 ` Stefano Stabellini
2019-08-12 22:28 ` [Xen-devel] [PATCH v5 3/7] xen/arm: keep track of reserved-memory regions Stefano Stabellini
2019-08-13 14:23 ` Volodymyr Babchuk
2019-08-13 14:46 ` Julien Grall
2019-08-13 15:14 ` Volodymyr Babchuk
2019-08-13 15:15 ` Julien Grall
2019-08-13 15:39 ` Volodymyr Babchuk
2019-08-14 12:48 ` Julien Grall
2019-08-12 22:28 ` [Xen-devel] [PATCH v5 4/7] xen/arm: early_print_info print reserved_mem Stefano Stabellini
2019-08-13 14:28 ` Volodymyr Babchuk
2019-08-13 14:47 ` Julien Grall
2019-08-14 22:21 ` Stefano Stabellini
2019-08-14 12:52 ` Julien Grall
2019-08-12 22:28 ` [Xen-devel] [PATCH v5 5/7] xen/arm: handle reserved-memory in consider_modules and dt_unreserved_regions Stefano Stabellini
2019-08-12 22:28 ` [Xen-devel] [PATCH v5 6/7] xen/arm: don't iomem_permit_access for reserved-memory regions Stefano Stabellini
2019-08-13 14:34 ` Volodymyr Babchuk [this message]
2019-08-13 14:55 ` Julien Grall
2019-08-14 22:40 ` Stefano Stabellini
2019-08-15 9:15 ` Julien Grall
2019-08-12 22:28 ` [Xen-devel] [PATCH v5 7/7] xen/arm: add reserved-memory regions to the dom0 memory node Stefano Stabellini
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=87blwtgmma.fsf@epam.com \
--to=volodymyr_babchuk@epam.com \
--cc=julien.grall@arm.com \
--cc=sstabellini@kernel.org \
--cc=stefanos@xilinx.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.