#include <linux/debugfs.h>
#include <linux/kasan.h>
#include <linux/mm.h>
#include <linux/init.h>
#include <linux/sched.h>
#include <linux/seq_file.h>
#include <linux/highmem.h>
#include <linux/pci.h>
#include <linux/ptdump.h>
#include <asm/e820/types.h>
struct pg_state { … };
struct addr_marker { … };
#ifdef CONFIG_X86_64
enum address_markers_idx { … };
static struct addr_marker address_markers[] = …;
#define INIT_PGD …
#else
enum address_markers_idx {
USER_SPACE_NR = 0,
KERNEL_SPACE_NR,
VMALLOC_START_NR,
VMALLOC_END_NR,
#ifdef CONFIG_HIGHMEM
PKMAP_BASE_NR,
#endif
#ifdef CONFIG_MODIFY_LDT_SYSCALL
LDT_NR,
#endif
CPU_ENTRY_AREA_NR,
FIXADDR_START_NR,
END_OF_SPACE_NR,
};
static struct addr_marker address_markers[] = {
[USER_SPACE_NR] = { 0, "User Space" },
[KERNEL_SPACE_NR] = { PAGE_OFFSET, "Kernel Mapping" },
[VMALLOC_START_NR] = { 0UL, "vmalloc() Area" },
[VMALLOC_END_NR] = { 0UL, "vmalloc() End" },
#ifdef CONFIG_HIGHMEM
[PKMAP_BASE_NR] = { 0UL, "Persistent kmap() Area" },
#endif
#ifdef CONFIG_MODIFY_LDT_SYSCALL
[LDT_NR] = { 0UL, "LDT remap" },
#endif
[CPU_ENTRY_AREA_NR] = { 0UL, "CPU entry area" },
[FIXADDR_START_NR] = { 0UL, "Fixmap area" },
[END_OF_SPACE_NR] = { -1, NULL }
};
#define INIT_PGD …
#endif
#define PTE_LEVEL_MULT …
#define PMD_LEVEL_MULT …
#define PUD_LEVEL_MULT …
#define P4D_LEVEL_MULT …
#define PGD_LEVEL_MULT …
#define pt_dump_seq_printf(m, to_dmesg, fmt, args...) …
#define pt_dump_cont_printf(m, to_dmesg, fmt, args...) …
static void printk_prot(struct seq_file *m, pgprotval_t pr, int level, bool dmsg)
{ … }
static void note_wx(struct pg_state *st, unsigned long addr)
{ … }
static void effective_prot(struct ptdump_state *pt_st, int level, u64 val)
{ … }
static void note_page(struct ptdump_state *pt_st, unsigned long addr, int level,
u64 val)
{ … }
bool ptdump_walk_pgd_level_core(struct seq_file *m,
struct mm_struct *mm, pgd_t *pgd,
bool checkwx, bool dmesg)
{ … }
void ptdump_walk_pgd_level(struct seq_file *m, struct mm_struct *mm)
{ … }
void ptdump_walk_pgd_level_debugfs(struct seq_file *m, struct mm_struct *mm,
bool user)
{ … }
EXPORT_SYMBOL_GPL(…);
void ptdump_walk_user_pgd_level_checkwx(void)
{ … }
bool ptdump_walk_pgd_level_checkwx(void)
{ … }
static int __init pt_dump_init(void)
{ … }
__initcall(pt_dump_init);