[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Arm: tighten translate_get_page()
- To: Jan Beulich <jbeulich@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- From: "Orzel, Michal" <michal.orzel@xxxxxxx>
- Date: Tue, 17 Feb 2026 16:28:24 +0100
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=suse.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=OxcUDoQL252eVzIou23h+L2DSICCWKQ62YBpeBJIlew=; b=cZkdrMldOcErfgM1WIxHrNklyLOsmPJeGTOnpwftOXra57xI/innyHhysTAEj+uezGZN8YzTueLqK26UD9PR4RrWpubTrGwS3hhioFDFq+gtmSYJx3x0Umv5y0e51McIune9gK3ErsXeL5vDDC3UFk2rMcsbZUrIUKwtvNhhDrrfByhdJAGDjgvw0TvMlrLg79Tn3mCIN/zQpc0YyMNr34XN4yWS6oKonaMglWUrXuMytyXKY3sBbA7osO+fWaZbKKGzrjFN6mYokf3d6wwymceF48+nk9zNyJehs6Ft2LjR51G2nXf3xS0QW4dHcQl/4Smq4ByYXLs09wrYQwlbZg==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Z00m+dYYHVGlyRrLYlfnvNeeMm01haCMT99LcpRdk9q/wfDSVDHZqPx4a3DVXXoZNAynlILBwzasZelTL2b+0uFo7FhVZJLYSU+RUAL89sL/QV1Mg3+4aq0Xs+MwTenmJAbY4Y/LW/vit9SGXhq2mZXz+sKg+64xpZje4+xN14xFI6lzrsEZ6e4sJKK4/ceWL0+Uom3XkL7IctSNeLJvTak/LXfKhQj35UTWUl62QQLH6YhQ6zc60OE3c8XTTCd0tonhRHkBfTqk4tir2cdVqBYB0O1T+Y//tTHcnYv2vGRYi5uZJRIf2S4MnhmnbeSN5u2f5avCyzanl/E5jPNDRg==
- Cc: Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Volodymyr Babchuk <volodymyr_babchuk@xxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>
- Delivery-date: Tue, 17 Feb 2026 15:28:48 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 16/02/2026 16:20, Jan Beulich wrote:
> Permitting writes when the P2M type says "read-only" can't be correct.
>
> Fixes: 1661158723a ("xen/arm: Extend copy_to_guest to support copying from/to
> guest physical address")
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Reviewed-by: Michal Orzel <michal.orzel@xxxxxxx>
> ---
> What exactly p2m_ram_ro means on Arm is unclear: The comment next to its
> definition says one thing, its use in get_page_from_gfn() says another.
> (I remember raising this point before, i.e. it feels a little odd that the
> ambiguity still exists.) The patch here assumes the comment is what is
> wrong.
>
> --- a/xen/arch/arm/guestcopy.c
> +++ b/xen/arch/arm/guestcopy.c
> @@ -44,7 +44,7 @@ static struct page_info *translate_get_p
> if ( !page )
> return NULL;
>
> - if ( !p2m_is_ram(p2mt) )
> + if ( write ? p2mt != p2m_ram_rw : !p2m_is_ram(p2mt) )
> {
> put_page(page);
> return NULL;
The ambiguity you mention is indeed problematic. This mixes page type with p2m
type. The comment "The p2m_type is based on the type of the page" admits this
conflation for DOMID_XEN.
AFAICT, p2m_ram_ro is not used on Arm for normal domains. The only use is in
get_page_from_gfn() for DOMID_XEN. Maybe we could change get_page_from_gfn() to
always return p2m_ram_rw since DOMID_XEN has direct 1:1 access anyway?
~Michal
|