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

[Xen-devel] [PATCH 2/2] kexec: fail image loads if the page tables cannot be built



From: David Vrabel <david.vrabel@xxxxxxxxxx>

CID 1128566

If an image source page is allocated in kimage_alloc_page() but the
machine_kexec_add_page() fails, the image may appear to load
succesfully but it will not execute.  The relocation will fault
(rebooting the host) when trying to copy the source page, as it is not
mapped.

Signed-off-by: David Vrabel <david.vrabel@xxxxxxxxxx>
---
 xen/common/kimage.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/xen/common/kimage.c b/xen/common/kimage.c
index 5c3e3b3..91943f1 100644
--- a/xen/common/kimage.c
+++ b/xen/common/kimage.c
@@ -592,6 +592,7 @@ static struct page_info *kimage_alloc_page(struct 
kexec_image *image,
      */
     struct page_info *page;
     paddr_t addr;
+    int ret;
 
     /*
      * Walk through the list of destination pages, and see if I have a
@@ -656,7 +657,13 @@ static struct page_info *kimage_alloc_page(struct 
kexec_image *image,
         }
     }
 found:
-    machine_kexec_add_page(image, page_to_maddr(page), page_to_maddr(page));
+    ret = machine_kexec_add_page(image, page_to_maddr(page),
+                                 page_to_maddr(page));
+    if ( ret < 0 )
+    {
+        free_domheap_page(page);
+        return NULL;
+    }
     return page;
 }
 
-- 
1.7.2.5


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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