|
@@ -476,7 +476,7 @@ static inline bool is_hypervisor_range(int idx)
|
|
|
}
|
|
|
|
|
|
static void ptdump_walk_pgd_level_core(struct seq_file *m, pgd_t *pgd,
|
|
|
- bool checkwx)
|
|
|
+ bool checkwx, bool dmesg)
|
|
|
{
|
|
|
#ifdef CONFIG_X86_64
|
|
|
pgd_t *start = (pgd_t *) &init_top_pgt;
|
|
@@ -489,7 +489,7 @@ static void ptdump_walk_pgd_level_core(struct seq_file *m, pgd_t *pgd,
|
|
|
|
|
|
if (pgd) {
|
|
|
start = pgd;
|
|
|
- st.to_dmesg = true;
|
|
|
+ st.to_dmesg = dmesg;
|
|
|
}
|
|
|
|
|
|
st.check_wx = checkwx;
|
|
@@ -527,13 +527,33 @@ static void ptdump_walk_pgd_level_core(struct seq_file *m, pgd_t *pgd,
|
|
|
|
|
|
void ptdump_walk_pgd_level(struct seq_file *m, pgd_t *pgd)
|
|
|
{
|
|
|
- ptdump_walk_pgd_level_core(m, pgd, false);
|
|
|
+ ptdump_walk_pgd_level_core(m, pgd, false, true);
|
|
|
+}
|
|
|
+
|
|
|
+void ptdump_walk_pgd_level_debugfs(struct seq_file *m, pgd_t *pgd)
|
|
|
+{
|
|
|
+ ptdump_walk_pgd_level_core(m, pgd, false, false);
|
|
|
+}
|
|
|
+EXPORT_SYMBOL_GPL(ptdump_walk_pgd_level_debugfs);
|
|
|
+
|
|
|
+static void ptdump_walk_user_pgd_level_checkwx(void)
|
|
|
+{
|
|
|
+#ifdef CONFIG_PAGE_TABLE_ISOLATION
|
|
|
+ pgd_t *pgd = (pgd_t *) &init_top_pgt;
|
|
|
+
|
|
|
+ if (!static_cpu_has(X86_FEATURE_PTI))
|
|
|
+ return;
|
|
|
+
|
|
|
+ pr_info("x86/mm: Checking user space page tables\n");
|
|
|
+ pgd = kernel_to_user_pgdp(pgd);
|
|
|
+ ptdump_walk_pgd_level_core(NULL, pgd, true, false);
|
|
|
+#endif
|
|
|
}
|
|
|
-EXPORT_SYMBOL_GPL(ptdump_walk_pgd_level);
|
|
|
|
|
|
void ptdump_walk_pgd_level_checkwx(void)
|
|
|
{
|
|
|
- ptdump_walk_pgd_level_core(NULL, NULL, true);
|
|
|
+ ptdump_walk_pgd_level_core(NULL, NULL, true, false);
|
|
|
+ ptdump_walk_user_pgd_level_checkwx();
|
|
|
}
|
|
|
|
|
|
static int __init pt_dump_init(void)
|