[patch 4/4] x86/mm/dump_pagetables: Use helper to get the shadow PGD
From: Thomas Gleixner
Date: Mon Nov 27 2017 - 15:43:59 EST
Use kernel_to_shadow_pgdp() instead of open coding it.
Fixes: ca646ac417b8 ("x86/mm/debug_pagetables: Allow dumping current pagetables")
Fixes: 04bafab4b2ee ("x86/mm/dump_pagetables: Check Kaiser shadow page table for WX pages")
Requested-by: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>
Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
---
arch/x86/mm/dump_pagetables.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
--- a/arch/x86/mm/dump_pagetables.c
+++ b/arch/x86/mm/dump_pagetables.c
@@ -504,8 +504,10 @@ void ptdump_walk_pgd_level(struct seq_fi
void ptdump_walk_pgd_level_debugfs(struct seq_file *m, pgd_t *pgd, bool shadow)
{
+#ifdef CONFIG_KAISER
if (shadow && kaiser_enabled)
- pgd += PTRS_PER_PGD;
+ pgd = kernel_to_shadow_pgdp(pgd);
+#endif
ptdump_walk_pgd_level_core(m, pgd, false, false);
}
EXPORT_SYMBOL_GPL(ptdump_walk_pgd_level_debugfs);
@@ -518,7 +520,7 @@ void ptdump_walk_shadow_pgd_level_checkw
if (!kaiser_enabled)
return;
pr_info("x86/mm: Checking shadow page tables\n");
- pgd += PTRS_PER_PGD;
+ pgd = kernel_to_shadow_pgdp(pgd);
ptdump_walk_pgd_level_core(NULL, pgd, true, false);
#endif
}