summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVivek Goyal <vgoyal@in.ibm.com>2005-08-04 17:56:51 +0530
committerEric W. Biederman <ebiederm@xmission.com>2006-07-27 09:43:20 -0600
commit7d142115e31c566cd3b333c84834b4dbd100c43e (patch)
treed7bfdd8062c3358c90087702936954769fb63115
parent71b37c87c709970c62924c58fe436857d569fe80 (diff)
Hack to avoid kexec segment stomping
o This is temporary hack patch to avoid any kexec segment being put in small memory hole between data and bss segments (Valid only for some older ld versions). This data is stomped by new kernel as kernel somehow thinks it to be part of bss. o This should be removed once the problem is fixed at kernel level. Signed-off-by: Vivek Goyal <vgoyal@in.ibm.com> Signed-off-by: Maneesh Soni <maneesh@in.ibm.com>
-rw-r--r--kexec/arch/i386/crashdump-x86.c10
-rw-r--r--kexec/arch/i386/kexec-elf-x86.c11
2 files changed, 19 insertions, 2 deletions
diff --git a/kexec/arch/i386/crashdump-x86.c b/kexec/arch/i386/crashdump-x86.c
index e469c1d..9984bec 100644
--- a/kexec/arch/i386/crashdump-x86.c
+++ b/kexec/arch/i386/crashdump-x86.c
@@ -705,7 +705,15 @@ int load_crashdump_segments(struct kexec_info *info, char* mod_cmdline,
if (prepare_crash_memory_elf32_headers(info, tmp, sz) < 0)
return -1;
}
- elfcorehdr = add_buffer(info, tmp, sz, sz, align, min_base,
+
+ /* Hack: With some ld versions (GNU ld version 2.14.90.0.4 20030523),
+ * vmlinux program headers show a gap of two pages between bss segment
+ * and data segment but effectively kernel considers it as bss segment
+ * and overwrites the any data placed there. Hence bloat the memsz of
+ * elf core header segment to 16K to avoid being placed in such gaps.
+ * This is a makeshift solution until it is fixed in kernel.
+ */
+ elfcorehdr = add_buffer(info, tmp, sz, 16*1024, align, min_base,
max_addr, 1);
if (delete_memmap(memmap_p, elfcorehdr, sz) < 0)
return -1;
diff --git a/kexec/arch/i386/kexec-elf-x86.c b/kexec/arch/i386/kexec-elf-x86.c
index 02dd70a..6308f4e 100644
--- a/kexec/arch/i386/kexec-elf-x86.c
+++ b/kexec/arch/i386/kexec-elf-x86.c
@@ -227,7 +227,16 @@ int elf_x86_load(int argc, char **argv, const char *buf, off_t len,
/* Get the linux parameter header */
hdr = xmalloc(sizeof(*hdr));
- param_base = add_buffer(info, hdr, sizeof(*hdr), sizeof(*hdr),
+
+ /* Hack: With some ld versions, vmlinux program headers show
+ * a gap of two pages between bss segment and data segment
+ * but effectively kernel considers it as bss segment and
+ * overwrites the any data placed there. Hence bloat the
+ * memsz of parameter segment to 16K to avoid being placed
+ * in such gaps.
+ * This is a makeshift solution until it is fixed in kernel
+ */
+ param_base = add_buffer(info, hdr, sizeof(*hdr), 16*1024,
16, 0, max_addr, 1);
/* Initialize the parameter header */