I am not on the fastboot list, so cc me on any replies. Thanks ...
Add some simple bounds checking for crashkernel args in i386 & x86_64.
Signed-off-by: Prarit Bhargava <[EMAIL PROTECTED]>
--- linux-2.6.19.2.orig/arch/i386/kernel/setup.c 2007-01-12
09:08:12.000000000 -0500
+++ linux-2.6.19.2/arch/i386/kernel/setup.c 2007-01-12 09:31:53.000000000
-0500
@@ -1176,9 +1176,20 @@ void __init setup_bootmem_allocator(void
}
#endif
#ifdef CONFIG_KEXEC
- if (crashk_res.start != crashk_res.end)
+ if ((crashk_res.start < crashk_res.end) &&
+ (crashk_res.end <= (max_low_pfn << PAGE_SHIFT))) {
reserve_bootmem(crashk_res.start,
- crashk_res.end - crashk_res.start + 1);
+ crashk_res.end - crashk_res.start + 1);
+ }
+ else {
+ printk(KERN_ERR "memory for kdump not within permissible range"
+ " (0x%lx to 0x%lx)\ndisabling kdump\n",
+ crashk_res.end, max_low_pfn << PAGE_SHIFT);
+ crashk_res.end = 0;
+ crashk_res.start = 0;
+ }
+#endif
+
#endif
}
--- linux-2.6.19.2.orig/arch/i386/kernel/machine_kexec.c 2007-01-12
09:08:12.000000000 -0500
+++ linux-2.6.19.2/arch/i386/kernel/machine_kexec.c 2007-01-12
09:09:55.000000000 -0500
@@ -160,9 +160,6 @@ static int __init parse_crashkernel(char
size = memparse(arg, &arg);
if (*arg == '@') {
base = memparse(arg+1, &arg);
- /* FIXME: Do I want a sanity check
- * to validate the memory range?
- */
crashk_res.start = base;
crashk_res.end = base + size - 1;
}
--- linux-2.6.19.2.orig/arch/x86_64/kernel/setup.c 2007-01-12
09:08:12.000000000 -0500
+++ linux-2.6.19.2/arch/x86_64/kernel/setup.c 2007-01-12 09:31:46.000000000
-0500
@@ -485,9 +485,18 @@ void __init setup_arch(char **cmdline_p)
}
#endif
#ifdef CONFIG_KEXEC
- if (crashk_res.start != crashk_res.end) {
+ /* FIXME: still too early for e820 range fix but better than nothing */
+ if ((crashk_res.start < crashk_res.end) &&
+ (crashk_res.end <= (max_low_pfn << PAGE_SHIFT))) {
reserve_bootmem_generic(crashk_res.start,
- crashk_res.end - crashk_res.start + 1);
+ crashk_res.end - crashk_res.start + 1);
+ }
+ else {
+ printk(KERN_ERR "memory for kdump not within permissible range"
+ " (0x%lx to 0x%lx)\ndisabling kdump\n",
+ crashk_res.end, max_low_pfn << PAGE_SHIFT);
+ crashk_res.end = 0;
+ crashk_res.start = 0;
}
#endif
--- linux-2.6.19.2.orig/arch/x86_64/kernel/machine_kexec.c 2007-01-12
09:08:12.000000000 -0500
+++ linux-2.6.19.2/arch/x86_64/kernel/machine_kexec.c 2007-01-12
09:12:40.000000000 -0500
@@ -247,9 +247,6 @@ static int __init setup_crashkernel(char
return -EINVAL;
if (*p == '@') {
base = memparse(p+1, &p);
- /* FIXME: Do I want a sanity check to validate the
- * memory range? Yes you do, but it's too early for
- * e820 -AK */
crashk_res.start = base;
crashk_res.end = base + size - 1;
}
_______________________________________________
fastboot mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/fastboot