[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen master] xen/arm: Fix P2M root page tables invalidation



commit 14c57887f36937c1deb9eeca852c3a7595d2d0b8
Author:     Michal Orzel <michal.orzel@xxxxxxx>
AuthorDate: Mon Jun 16 08:56:48 2025 +0200
Commit:     Michal Orzel <michal.orzel@xxxxxxx>
CommitDate: Tue Jun 17 08:31:52 2025 +0200

    xen/arm: Fix P2M root page tables invalidation
    
    Fix the condition part of the for loop in p2m_invalidate_root() that
    uses P2M_ROOT_LEVEL instead of P2M_ROOT_PAGES. The goal here is to
    invalidate all root page tables (that can be concatenated), so the loop
    must iterate through all these pages. Root level can be 0 or 1, whereas
    there can be 1,2,8,16 root pages. The issue may lead to some pages
    not being invalidated and therefore the guest access won't be trapped.
    We use it to track pages accessed by guest for set/way emulation provided
    no IOMMU, IOMMU not enabled for the domain or P2M not shared with IOMMU.
    
    Fixes: 2148a125b73b ("xen/arm: Track page accessed between batch of Set/Way 
operations")
    Reported-by: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>
    Signed-off-by: Michal Orzel <michal.orzel@xxxxxxx>
    Reviewed-by: Julien Grall <jgrall@xxxxxxxxxx>
---
 xen/arch/arm/mmu/p2m.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/arm/mmu/p2m.c b/xen/arch/arm/mmu/p2m.c
index d96078f547..67296dabb5 100644
--- a/xen/arch/arm/mmu/p2m.c
+++ b/xen/arch/arm/mmu/p2m.c
@@ -1291,7 +1291,7 @@ static void p2m_invalidate_root(struct p2m_domain *p2m)
 
     p2m_write_lock(p2m);
 
-    for ( i = 0; i < P2M_ROOT_LEVEL; i++ )
+    for ( i = 0; i < P2M_ROOT_PAGES; i++ )
         p2m_invalidate_table(p2m, page_to_mfn(p2m->root + i));
 
     p2m_write_unlock(p2m);
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.