summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorAtsushi Kumagai <ats-kumagai@wm.jp.nec.com>2016-05-26 15:49:59 +0900
committerAtsushi Kumagai <ats-kumagai@wm.jp.nec.com>2016-06-07 13:01:46 +0900
commitecf7a13945bf4f68328a015732d476b3ef9f0162 (patch)
treefbd21dca6eb2cbb86a1d8b847e39221502ea18bf /arch
parent11a6dae4a39b52237ad2cd6e25492c7d1438ea8f (diff)
[PATCH] Skip null entries to walk page tables correctly
If there is a null page table entry, the current code try to read 0x0 for -e option as lower page table although it should be skipped. This behavior will cause unexpected results. Especially if pfn:0 is on a memory hole or excluded, this feature will be disabled completely. Signed-off-by: Atsushi Kumagai <ats-kumagai@wm.jp.nec.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86_64.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/arch/x86_64.c b/arch/x86_64.c
index c51e26e..ddf7be6 100644
--- a/arch/x86_64.c
+++ b/arch/x86_64.c
@@ -537,6 +537,8 @@ find_vmemmap_x86_64()
}
/* mask the pgd entry for the address of the pud page */
pud_addr &= PMASK;
+ if (pud_addr == 0)
+ continue;
/* read the entire pud page */
if (!readmem(PADDR, (unsigned long long)pud_addr, (void *)pud_page,
PTRS_PER_PUD * sizeof(unsigned long))) {
@@ -549,6 +551,8 @@ find_vmemmap_x86_64()
pudindex < PTRS_PER_PUD; pudindex++, pudp++) {
pmd_addr = *pudp & PMASK;
/* read the entire pmd page */
+ if (pmd_addr == 0)
+ continue;
if (!readmem(PADDR, pmd_addr, (void *)pmd_page,
PTRS_PER_PMD * sizeof(unsigned long))) {
ERRMSG("Can't get pud entry for slot %ld.\n", pudindex);