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

[xen master] xen/vmap: Check the page has been mapped in vm_init_type()



commit a75c5aa2b22bea552ef5e0826e047dfcf61a9645
Author:     Julien Grall <jgrall@xxxxxxxxxx>
AuthorDate: Mon Jan 29 09:20:02 2024 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Mon Jan 29 09:20:02 2024 +0100

    xen/vmap: Check the page has been mapped in vm_init_type()
    
    The function map_pages_to_xen() could fail if it can't allocate the
    underlying page tables or (at least on Arm) if the area was already
    mapped.
    
    The first error is caught by clear_page() because it would fault.
    However, the second error while very unlikely is not caught at all.
    
    As this is boot code, use BUG_ON() to check if map_pages_to_xen() has
    succeeded.
    
    Signed-off-by: Julien Grall <jgrall@xxxxxxxxxx>
    Signed-off-by: Elias El Yandouzi <eliasely@xxxxxxxxxx>
    Acked-by: Jan Beulich <jbeulich@xxxxxxxx>
---
 xen/common/vmap.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/xen/common/vmap.c b/xen/common/vmap.c
index 330e2ba897..830f64c5ef 100644
--- a/xen/common/vmap.c
+++ b/xen/common/vmap.c
@@ -35,8 +35,11 @@ void __init vm_init_type(enum vmap_region type, void *start, 
void *end)
     for ( i = 0, va = (unsigned long)vm_bitmap(type); i < nr; ++i, va += 
PAGE_SIZE )
     {
         struct page_info *pg = alloc_domheap_page(NULL, 0);
+        int rc;
+
+        rc = map_pages_to_xen(va, page_to_mfn(pg), 1, PAGE_HYPERVISOR);
+        BUG_ON(rc);
 
-        map_pages_to_xen(va, page_to_mfn(pg), 1, PAGE_HYPERVISOR);
         clear_page((void *)va);
     }
     bitmap_fill(vm_bitmap(type), vm_low[type]);
--
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®.