diff options
author | Ken'ichi Ohmichi <oomichi@mxs.nes.nec.co.jp> | 2008-10-20 00:51:52 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-10-28 11:48:24 -0400 |
commit | e7706fc691513b0f06adb3de3d6ac04293180146 (patch) | |
tree | 06a8ace4426f38ec9015373d6f3b08abd6a57456 /arch/x86 | |
parent | 1281675e9c0d4d42d993697f4daab45ef22d49da (diff) |
x86, kdump: fix invalid access on i386 sparsemem
Impact: fix kdump crash on 32-bit sparsemem kernels
Since linux-2.6.27, kdump has failed on i386 sparsemem kernel.
1st-kernel gets a panic just before switching to 2nd-kernel.
The cause is that a kernel accesses invalid mem_section by
page_to_pfn(image->swap_page) at machine_kexec().
image->swap_page is allocated if kexec for hibernation, but
it is not allocated if kdump. So if kdump, a kernel should
not access the mem_section corresponding to image->swap_page.
The attached patch fixes this invalid access.
Signed-off-by: Ken'ichi Ohmichi <oomichi@mxs.nes.nec.co.jp>
Cc: kexec-ml <kexec@lists.infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/kernel/machine_kexec_32.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/arch/x86/kernel/machine_kexec_32.c b/arch/x86/kernel/machine_kexec_32.c index 0732adba05ca..7a385746509a 100644 --- a/arch/x86/kernel/machine_kexec_32.c +++ b/arch/x86/kernel/machine_kexec_32.c | |||
@@ -162,7 +162,10 @@ void machine_kexec(struct kimage *image) | |||
162 | page_list[VA_PTE_0] = (unsigned long)kexec_pte0; | 162 | page_list[VA_PTE_0] = (unsigned long)kexec_pte0; |
163 | page_list[PA_PTE_1] = __pa(kexec_pte1); | 163 | page_list[PA_PTE_1] = __pa(kexec_pte1); |
164 | page_list[VA_PTE_1] = (unsigned long)kexec_pte1; | 164 | page_list[VA_PTE_1] = (unsigned long)kexec_pte1; |
165 | page_list[PA_SWAP_PAGE] = (page_to_pfn(image->swap_page) << PAGE_SHIFT); | 165 | |
166 | if (image->type == KEXEC_TYPE_DEFAULT) | ||
167 | page_list[PA_SWAP_PAGE] = (page_to_pfn(image->swap_page) | ||
168 | << PAGE_SHIFT); | ||
166 | 169 | ||
167 | /* The segment registers are funny things, they have both a | 170 | /* The segment registers are funny things, they have both a |
168 | * visible and an invisible part. Whenever the visible part is | 171 | * visible and an invisible part. Whenever the visible part is |