kfan / rpms / kexec-tools

Forked from rpms/kexec-tools 3 years ago
Clone
Blob Blame History Raw
diff -up kexec-tools-testing-20070330/kexec/arch/ppc64/crashdump-ppc64.c.orig kexec-tools-testing-20070330/kexec/arch/ppc64/crashdump-ppc64.c
--- kexec-tools-testing-20070330/kexec/arch/ppc64/crashdump-ppc64.c.orig	2008-05-19 15:25:25.000000000 -0400
+++ kexec-tools-testing-20070330/kexec/arch/ppc64/crashdump-ppc64.c	2008-05-19 15:33:22.000000000 -0400
@@ -107,6 +107,7 @@ static int get_crash_memory_ranges(struc
 	struct dirent *dentry, *mentry;
 	int i, n, crash_rng_len = 0;
 	unsigned long long start, end, cstart, cend;
+	int page_size = getpagesize();
 
 	crash_max_memory_ranges = max_memory_ranges + 6;
 	crash_rng_len = sizeof(struct memory_range) * crash_max_memory_ranges;
@@ -219,6 +220,17 @@ static int get_crash_memory_ranges(struc
 		if (cend > crash_base + crash_size)
 			cend = crash_base + crash_size;
 		crash_memory_range[memory_ranges].start = cstart;
+		/*
+		 * The rtas section created here is formed by reading rtas-base
+		 * and rtas-size from /proc/device-tree/rtas.  Unfortunately
+		 * rtas-size is not required to be a multiple of PAGE_SIZE
+		 * The remainder of the page it ends on is just garbage, and is
+		 * safe to read, its just not accounted in rtas-size.  Since
+		 * we're creating an elf section here though, lets round it up
+		 * to the next page size boundary though, so makedumpfile can 
+		 * read it safely without going south on us.
+		 */
+		cend = (cend + page_size - 1) & (~(page_size - 1));
 		crash_memory_range[memory_ranges++].end = cend;
 	}
 	/*