LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] kdump: Fix invalid access on i386 sparsemem.
@ 2008-10-20  4:51 Ken'ichi Ohmichi
  2008-10-20  7:14 ` Ingo Molnar
  0 siblings, 1 reply; 2+ messages in thread
From: Ken'ichi Ohmichi @ 2008-10-20  4:51 UTC (permalink / raw)
  To: kexec-ml, lkml, Andrew Morton


Hi,

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.


Thanks
Ken'ichi Ohmichi

Signed-off-by: Ken'ichi Ohmichi <oomichi@mxs.nes.nec.co.jp>
---
diff -rpuN a/arch/x86/kernel/machine_kexec_32.c b/arch/x86/kernel/machine_kexec_32.c
--- a/arch/x86/kernel/machine_kexec_32.c	2008-10-10 07:13:53.000000000 +0900
+++ b/arch/x86/kernel/machine_kexec_32.c	2008-10-17 20:38:37.000000000 +0900
@@ -162,7 +162,10 @@ void machine_kexec(struct kimage *image)
 	page_list[VA_PTE_0] = (unsigned long)kexec_pte0;
 	page_list[PA_PTE_1] = __pa(kexec_pte1);
 	page_list[VA_PTE_1] = (unsigned long)kexec_pte1;
-	page_list[PA_SWAP_PAGE] = (page_to_pfn(image->swap_page) << PAGE_SHIFT);
+
+	if (image->type == KEXEC_TYPE_DEFAULT)
+		page_list[PA_SWAP_PAGE] = (page_to_pfn(image->swap_page)
+						<< PAGE_SHIFT);
 
 	/* The segment registers are funny things, they have both a
 	 * visible and an invisible part.  Whenever the visible part is
_

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] kdump: Fix invalid access on i386 sparsemem.
  2008-10-20  4:51 [PATCH] kdump: Fix invalid access on i386 sparsemem Ken'ichi Ohmichi
@ 2008-10-20  7:14 ` Ingo Molnar
  0 siblings, 0 replies; 2+ messages in thread
From: Ingo Molnar @ 2008-10-20  7:14 UTC (permalink / raw)
  To: Ken'ichi Ohmichi
  Cc: kexec-ml, lkml, Andrew Morton, Huang Ying, Yinghai Lu,
	Thomas Gleixner, H. Peter Anvin


* Ken'ichi Ohmichi <oomichi@mxs.nes.nec.co.jp> wrote:

> 
> Hi,
> 
> 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.

applied to tip/x86/urgent, thanks!

	Ingo

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-10-20  7:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-20  4:51 [PATCH] kdump: Fix invalid access on i386 sparsemem Ken'ichi Ohmichi
2008-10-20  7:14 ` Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).