All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jay Lan <jlan@sgi.com>
To: linux-ia64@vger.kernel.org
Subject: [PATCH] IA64 kexec-tools: efi_memmap overflow on large systems
Date: Thu, 01 Feb 2007 01:54:22 +0000	[thread overview]
Message-ID: <45C1484E.3020300@sgi.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 375 bytes --]

This patch fixes a efi_memmap overflow problem on large system.
Currently the kexec allocates statically 16k buffer to contain
efi_memmap. It can hold about 333 entries. It causes data
corruption on large system.

This patch would let kexec allocate the efi_memmap at run time using
the actual size allocated in the production kernel.


Signed-off-by: Jay Lan <jlan@sgi.com>

[-- Attachment #2: efi-memmap-overflow --]
[-- Type: text/plain, Size: 1912 bytes --]

Index: kexec-tools-testing-20061214/kexec/arch/ia64/kexec-elf-ia64.c
===================================================================
--- kexec-tools-testing-20061214.orig/kexec/arch/ia64/kexec-elf-ia64.c	2006-12-14 01:12:03.000000000 -0600
+++ kexec-tools-testing-20061214/kexec/arch/ia64/kexec-elf-ia64.c	2007-01-31 19:33:23.000000000 -0600
@@ -47,6 +47,7 @@
 #include <arch/options.h>
 
 static const int probe_debug = 0;
+extern unsigned long saved_efi_memmap_size;
 
 /*
  * elf_ia64_probe - sanity check the elf image
@@ -229,8 +230,8 @@ int elf_ia64_load(int argc, char **argv,
         elf_rel_set_symbol(&info->rhdr, "__boot_param_base",
                         &boot_param_base, sizeof(long));
 
-	// reserve 8k for efi_memmap
-	efi_memmap_size = 1UL<<14;
+	// reserve efi_memmap of actual size allocated in production kernel
+	efi_memmap_size = saved_efi_memmap_size;
 	efi_memmap_buf = xmalloc(efi_memmap_size);
 	efi_memmap_base = add_buffer(info, efi_memmap_buf,
 			efi_memmap_size, efi_memmap_size, 4096, 0,
Index: kexec-tools-testing-20061214/kexec/arch/ia64/kexec-ia64.c
===================================================================
--- kexec-tools-testing-20061214.orig/kexec/arch/ia64/kexec-ia64.c	2006-12-14 01:12:03.000000000 -0600
+++ kexec-tools-testing-20061214/kexec/arch/ia64/kexec-ia64.c	2007-01-31 19:35:20.000000000 -0600
@@ -38,6 +38,7 @@
 
 static struct memory_range memory_range[MAX_MEMORY_RANGES];
 static int memory_ranges;
+unsigned long saved_efi_memmap_size;
 
 /* Reserve range for EFI memmap and Boot parameter */
 static int split_range(int range, unsigned long start, unsigned long end)
@@ -124,6 +125,7 @@ int get_memory_ranges(struct memory_rang
 			continue;
 		} else if (memcmp(str, "EFI Memory Map\n", 14) == 0) {
 			memory_ranges = split_range(memory_ranges, start, end);
+			saved_efi_memmap_size = end - start;
 			continue;
 		} else
 			continue;

             reply	other threads:[~2007-02-01  1:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-01  1:54 Jay Lan [this message]
2007-02-01  2:43 ` [PATCH] IA64 kexec-tools: efi_memmap overflow on large systems Zou, Nanhai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=45C1484E.3020300@sgi.com \
    --to=jlan@sgi.com \
    --cc=linux-ia64@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.