The relocation code in __start_xen requires one extra element in the
MBI structure. By the looks of it the temporary MBI array is already
large enough. Add an assertion to catch any issue in the future.

Signed-off-by: Wei Liu <wei.l...@citrix.com>
---
 xen/arch/x86/guest/pvh-boot.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/xen/arch/x86/guest/pvh-boot.c b/xen/arch/x86/guest/pvh-boot.c
index 0e9e5bfdf6..7e13e7604b 100644
--- a/xen/arch/x86/guest/pvh-boot.c
+++ b/xen/arch/x86/guest/pvh-boot.c
@@ -44,6 +44,13 @@ static void __init convert_pvh_info(void)
 
     ASSERT(pvh_info->magic == XEN_HVM_START_MAGIC_VALUE);
 
+    /*
+     * Temporary MBI array needs to be at least one element bigger than
+     * required. The extra element is used to aid relocation. See
+     * arch/x86/setup.c:__start_xen().
+     */
+    ASSERT(ARRAY_SIZE(pvh_mbi_mods) > pvh_info->nr_modules);
+
     /*
      * Turn hvm_start_info into mbi. Luckily all modules are placed under 4GB
      * boundary on x86.
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reply via email to