public inbox for kexec@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] kdump: force page alignment for per-CPU crash notes.
@ 2012-02-29 17:21 Eugene Surovegin
  2012-03-01  1:18 ` Simon Horman
  2012-03-01 15:09 ` Vivek Goyal
  0 siblings, 2 replies; 12+ messages in thread
From: Eugene Surovegin @ 2012-02-29 17:21 UTC (permalink / raw)
  To: linux-kernel; +Cc: Eugene Surovegin, kexec-list, Eric Biederman, Vivek Goyal

Per-CPU allocations are not guaranteed to be physically contiguous.
However, kdump kernel and user-space code assumes that per-CPU
memory, used for saving CPU registers on crash, is.
This can cause corrupted /proc/vmcore in some cases - the main
symptom being huge ELF note section.

Force page alignment for note_buf_t to ensure that this assumption holds.

Signed-off-by: Eugene Surovegin <surovegin@google.com>
CC: Eric Biederman <ebiederm@xmission.com>
CC: Vivek Goyal <vgoyal@redhat.com>
CC: kexec-list <kexec@lists.infradead.org>
---
 kernel/kexec.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/kernel/kexec.c b/kernel/kexec.c
index 7b08867..e641b5c 100644
--- a/kernel/kexec.c
+++ b/kernel/kexec.c
@@ -1232,8 +1232,13 @@ void crash_save_cpu(struct pt_regs *regs, int cpu)
 
 static int __init crash_notes_memory_init(void)
 {
-	/* Allocate memory for saving cpu registers. */
-	crash_notes = alloc_percpu(note_buf_t);
+	/* Allocate memory for saving cpu registers.
+	 * Force page alignment to avoid crossing physical page boundary -
+	 * kexec-tools and kernel /proc/vmcore handler assume these per-CPU
+	 * chunks are physically contiguous.
+	 */
+	crash_notes = (note_buf_t __percpu *)__alloc_percpu(sizeof(note_buf_t),
+							    PAGE_SIZE);
 	if (!crash_notes) {
 		printk("Kexec: Memory allocation for saving cpu register"
 		" states failed\n");
-- 
1.7.9.1


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

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

end of thread, other threads:[~2012-03-01 18:56 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-29 17:21 [PATCH] kdump: force page alignment for per-CPU crash notes Eugene Surovegin
2012-03-01  1:18 ` Simon Horman
2012-03-01  1:23   ` Eugene Surovegin
2012-03-01  1:32     ` Simon Horman
2012-03-01  1:39       ` Eugene Surovegin
2012-03-01  1:51         ` HATAYAMA Daisuke
2012-03-01  1:56           ` Eugene Surovegin
2012-03-01  2:50           ` Simon Horman
2012-03-01  2:53         ` Simon Horman
2012-03-01 15:09 ` Vivek Goyal
2012-03-01 17:04   ` Eugene Surovegin
2012-03-01 18:31     ` Vivek Goyal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox