It seems that from xen ELF image POV _end symbol properly determine
image end. However, taking into account that initial Xen image mapping
covers 16 MiB it looks that it is not sufficient. Currently bootloader
potentially may load xen ELF image at 1 MiB and let's say put Linux
kernel or initrd at 8 MiB. Nothing forbids it. This means that initially
Xen image mapping may cover not only Xen image but also loaded modules.
So, let's move end of xen ELF image to 16 MiB. This way we avoid above
mentioned issue because bootloader will be forced to allocate 15 MiB
memory region for image. Then it (bootloader) would not be able to put
in this place anything else because from its POV simply this memory
region will be allocated and used.

This patch does not change xen ELF file size. It changes memory size
which should be allocated for the image during load.

Signed-off-by: Daniel Kiper <daniel.ki...@oracle.com>
---
 xen/arch/x86/xen.lds.S |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S
index d903c31..9adb2f3 100644
--- a/xen/arch/x86/xen.lds.S
+++ b/xen/arch/x86/xen.lds.S
@@ -266,14 +266,16 @@ SECTIONS
   .reloc : {
     *(.reloc)
   } :text
-  /* Trick the linker into setting the image size to exactly 16Mb. */
   . = ALIGN(__section_alignment__);
+#else
+  efi = .;
+#endif
+
+  /* Trick the linker into setting the image size to exactly 16Mb. */
   .pad : {
     . = ALIGN(MB(16));
+    __end_of_image__ = .;
   } :text
-#else
-  efi = .;
-#endif
 
   /* Sections to be discarded */
   /DISCARD/ : {
-- 
1.7.10.4


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

Reply via email to