summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Lan <jlan@sgi.com>2007-01-31 17:54:22 -0800
committerSimon Horman <horms@verge.net.au>2007-02-01 11:40:55 +0900
commitacd0bdeab5b2932a48165efbf79a21e111e950ae (patch)
treecd2f6f060ae629c7b1bbcac18c50ad7c78755e27
parent4b94de0aaa7b0fb911a7513f90e5b928799c7c2a (diff)
IA64 kexec-tools: efi_memmap overflow on large systems
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> Signed-off-by: Simon Horman <horms@verge.net.au>
-rw-r--r--kexec/arch/ia64/kexec-elf-ia64.c5
-rw-r--r--kexec/arch/ia64/kexec-ia64.c2
2 files changed, 5 insertions, 2 deletions
diff --git a/kexec/arch/ia64/kexec-elf-ia64.c b/kexec/arch/ia64/kexec-elf-ia64.c
index ca8e48e..48cc6a5 100644
--- a/kexec/arch/ia64/kexec-elf-ia64.c
+++ b/kexec/arch/ia64/kexec-elf-ia64.c
@@ -52,6 +52,7 @@
#define OPT_VMM (OPT_ARCH_MAX+3)
static const int probe_debug = 0;
+extern unsigned long saved_efi_memmap_size;
/*
* elf_ia64_probe - sanity check the elf image
@@ -236,8 +237,8 @@ int elf_ia64_load(int argc, char **argv, const char *buf, off_t len,
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,
diff --git a/kexec/arch/ia64/kexec-ia64.c b/kexec/arch/ia64/kexec-ia64.c
index 506d37d..8969fc5 100644
--- a/kexec/arch/ia64/kexec-ia64.c
+++ b/kexec/arch/ia64/kexec-ia64.c
@@ -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_range **range, int *ranges,
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;