]> xenbits.xensource.com Git - qemu-xen.git/commitdiff
mips/malta: load the initrd at the end of the low memory
authorAurelien Jarno <aurelien@aurel32.net>
Fri, 23 Jun 2017 10:42:56 +0000 (12:42 +0200)
committerYongbok Kim <yongbok.kim@imgtec.com>
Tue, 11 Jul 2017 14:06:34 +0000 (15:06 +0100)
Currently the malta board is loading the initrd just after the kernel.
This doesn't work for kaslr enabled kernels, as the initrd ends-up being
overwritten.

Move the initrd at the end of the low memory, that should leave a
sufficient gap for kaslr.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Tested-by: Yongbok Kim <yongbok.kim@imgtec.com>
Signed-off-by: Yongbok Kim <yongbok.kim@imgtec.com>
hw/mips/mips_malta.c

index 95cdabb2dda634fd29154630c5ae2163df2d3afb..dad2f37fb14427f25c7d69266bbd23ba8be4c42b 100644 (file)
@@ -841,8 +841,9 @@ static int64_t load_kernel (void)
     if (loaderparams.initrd_filename) {
         initrd_size = get_image_size (loaderparams.initrd_filename);
         if (initrd_size > 0) {
-            initrd_offset = (kernel_high + ~INITRD_PAGE_MASK) & INITRD_PAGE_MASK;
-            if (initrd_offset + initrd_size > ram_size) {
+            initrd_offset = (loaderparams.ram_low_size - initrd_size
+                             - ~INITRD_PAGE_MASK) & INITRD_PAGE_MASK;
+            if (kernel_high >= initrd_offset) {
                 fprintf(stderr,
                         "qemu: memory too small for initial ram disk '%s'\n",
                         loaderparams.initrd_filename);