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 <[email protected]>
---
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;