Package: kexec-tools
Version: 1:2.0.4-1
Severity: normal
Tags: upstream, patch

Dear Maintainer,
     I'm trying to use kexec to boot a multiboot image.  My image
     relies on mbi->mem_lower being correct, but the current code
     combined with a stock debian kernel always fills this field in
     with zero.

     The problem is that the debian stock kernel protects the first
     few pages (from physical address zero) so they don't appear in
     /proc/iomem -- so the test in kexec-multiboot-x86.c to
     find the low memory fails -- there's never any visible memroy at
     location zero in /proc/iomem.

     My suggested fix is attached.

---
 kexec/arch/i386/kexec-multiboot-x86.c |   14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

Index: kexec-tools-2.0.4/kexec/arch/i386/kexec-multiboot-x86.c
===================================================================
--- kexec-tools-2.0.4.orig/kexec/arch/i386/kexec-multiboot-x86.c        
2013-03-14 18:45:16.000000000 +1000
+++ kexec-tools-2.0.4/kexec/arch/i386/kexec-multiboot-x86.c     2014-01-15 
10:21:02.138172304 +1000
@@ -261,10 +261,18 @@ int multiboot_x86_load(int argc, char **
                mmap[i].length_high    = length >> 32;
                if (range[i].type == RANGE_RAM) {
                        mmap[i].Type = 1; /* RAM */
-                       /* Is this the "low" memory? */
-                       if ((range[i].start == 0)
-                           && (range[i].end > mem_lower))
+                       /*
+                         * Is this the "low" memory?  Can't just test
+                         * against zero, because Linux protects (and
+                         * hides) the first few pages of physical
+                         * memory.
+                         */
+
+                       if ((range[i].start <= 64*1024)
+                           && (range[i].end > mem_lower)) {
+                                range[i].start = 0;
                                mem_lower = range[i].end;
+                        }
                        /* Is this the "high" memory? */
                        if ((range[i].start <= 0x100000)
                            && (range[i].end > mem_upper + 0x100000))



-- System Information:
Debian Release: jessie/sid
  APT prefers unstable
  APT policy: (990, 'unstable'), (500, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.13.0-rc8 (SMP w/8 CPU cores)
Locale: LANG=en_AU.UTF-8, LC_CTYPE=en_AU.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages kexec-tools depends on:
ii  debconf [debconf-2.0]  1.5.52
ii  libc6                  2.17-97

kexec-tools recommends no packages.

kexec-tools suggests no packages.

-- debconf information:
* kexec-tools/load_kexec: true
  kexec-tools/use_grub_config: false


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to