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

[Xen-devel] [PATCH v3 09/16] hvmloader: Check modules whereabouts



As perform_tests() is going to clear memory past 4MB, we check that the
memory can be use.

Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>
---
New in V3
---
 tools/firmware/hvmloader/hvmloader.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/tools/firmware/hvmloader/hvmloader.c 
b/tools/firmware/hvmloader/hvmloader.c
index d319de0..a40503d 100644
--- a/tools/firmware/hvmloader/hvmloader.c
+++ b/tools/firmware/hvmloader/hvmloader.c
@@ -303,6 +303,15 @@ int main(void)
 
     smp_initialise();
 
+    /* Check that tests does not use memory where modules are stored */
+    BUG_ON( ((uint32_t)hvm_start_info + sizeof(struct hvm_start_info)) >= 4 << 
20 );
+    for ( unsigned i = 0; i < hvm_start_info->nr_modules; i++ )
+    {
+        const struct hvm_modlist_entry *modlist =
+            (struct hvm_modlist_entry *)hvm_start_info->modlist_paddr;
+        if ( modlist[i].size )
+            BUG_ON( modlist[i].paddr + modlist[i].size >= 4ul << 20 );
+    }
     perform_tests();
 
     if ( bios->bios_info_setup )
-- 
Anthony PERARD


_______________________________________________
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®.