]>
Commit | Line | Data |
---|---|---|
6a930a95 BS |
1 | From e7706fc691513b0f06adb3de3d6ac04293180146 Mon Sep 17 00:00:00 2001 |
2 | From: Ken'ichi Ohmichi <oomichi@mxs.nes.nec.co.jp> | |
3 | Date: Mon, 20 Oct 2008 13:51:52 +0900 | |
4 | Subject: [PATCH] x86, kdump: fix invalid access on i386 sparsemem | |
5 | References: bnc#440525 | |
6 | ||
7 | Impact: fix kdump crash on 32-bit sparsemem kernels | |
8 | ||
9 | Since linux-2.6.27, kdump has failed on i386 sparsemem kernel. | |
10 | 1st-kernel gets a panic just before switching to 2nd-kernel. | |
11 | ||
12 | The cause is that a kernel accesses invalid mem_section by | |
13 | page_to_pfn(image->swap_page) at machine_kexec(). | |
14 | image->swap_page is allocated if kexec for hibernation, but | |
15 | it is not allocated if kdump. So if kdump, a kernel should | |
16 | not access the mem_section corresponding to image->swap_page. | |
17 | ||
18 | The attached patch fixes this invalid access. | |
19 | ||
20 | Signed-off-by: Ken'ichi Ohmichi <oomichi@mxs.nes.nec.co.jp> | |
21 | Cc: kexec-ml <kexec@lists.infradead.org> | |
22 | Cc: Andrew Morton <akpm@linux-foundation.org> | |
23 | Signed-off-by: Ingo Molnar <mingo@elte.hu> | |
24 | Acked-by: Bernhard Walle <bwalle@suse.de> | |
25 | ||
26 | diff --git a/arch/x86/kernel/machine_kexec_32.c b/arch/x86/kernel/machine_kexec_32.c | |
27 | index 0732adb..7a38574 100644 | |
28 | --- a/arch/x86/kernel/machine_kexec_32.c | |
29 | +++ b/arch/x86/kernel/machine_kexec_32.c | |
30 | @@ -162,7 +162,10 @@ void machine_kexec(struct kimage *image) | |
31 | page_list[VA_PTE_0] = (unsigned long)kexec_pte0; | |
32 | page_list[PA_PTE_1] = __pa(kexec_pte1); | |
33 | page_list[VA_PTE_1] = (unsigned long)kexec_pte1; | |
34 | - page_list[PA_SWAP_PAGE] = (page_to_pfn(image->swap_page) << PAGE_SHIFT); | |
35 | + | |
36 | + if (image->type == KEXEC_TYPE_DEFAULT) | |
37 | + page_list[PA_SWAP_PAGE] = (page_to_pfn(image->swap_page) | |
38 | + << PAGE_SHIFT); | |
39 | ||
40 | /* The segment registers are funny things, they have both a | |
41 | * visible and an invisible part. Whenever the visible part is |