dump_pagetables.c (92907cbbef8625bb3998d1eb385fc88f23c97a3f) dump_pagetables.c (8609d1b5daa36350e020e737946c40887af1743a)
1/*
2 * Debug helper to dump the current kernel pagetables of the system
3 * so that we can see what the various memory ranges are set to.
4 *
5 * (C) Copyright 2008 Intel Corporation
6 *
7 * Author: Arjan van de Ven <arjan@linux.intel.com>
8 *

--- 412 unchanged lines hidden (view full) ---

421 else
422 pr_info("x86/mm: Checked W+X mappings: passed, no W+X pages found.\n");
423}
424
425void ptdump_walk_pgd_level(struct seq_file *m, pgd_t *pgd)
426{
427 ptdump_walk_pgd_level_core(m, pgd, false);
428}
1/*
2 * Debug helper to dump the current kernel pagetables of the system
3 * so that we can see what the various memory ranges are set to.
4 *
5 * (C) Copyright 2008 Intel Corporation
6 *
7 * Author: Arjan van de Ven <arjan@linux.intel.com>
8 *

--- 412 unchanged lines hidden (view full) ---

421 else
422 pr_info("x86/mm: Checked W+X mappings: passed, no W+X pages found.\n");
423}
424
425void ptdump_walk_pgd_level(struct seq_file *m, pgd_t *pgd)
426{
427 ptdump_walk_pgd_level_core(m, pgd, false);
428}
429EXPORT_SYMBOL_GPL(ptdump_walk_pgd_level);
429
430void ptdump_walk_pgd_level_checkwx(void)
431{
432 ptdump_walk_pgd_level_core(NULL, NULL, true);
433}
434
430
431void ptdump_walk_pgd_level_checkwx(void)
432{
433 ptdump_walk_pgd_level_core(NULL, NULL, true);
434}
435
435#ifdef CONFIG_X86_PTDUMP
436static int ptdump_show(struct seq_file *m, void *v)
436static int __init pt_dump_init(void)
437{
437{
438 ptdump_walk_pgd_level(m, NULL);
439 return 0;
440}
441
442static int ptdump_open(struct inode *inode, struct file *filp)
443{
444 return single_open(filp, ptdump_show, NULL);
445}
446
447static const struct file_operations ptdump_fops = {
448 .open = ptdump_open,
449 .read = seq_read,
450 .llseek = seq_lseek,
451 .release = single_release,
452};
453#endif
454
455static int pt_dump_init(void)
456{
457#ifdef CONFIG_X86_PTDUMP
458 struct dentry *pe;
459#endif
460
461#ifdef CONFIG_X86_32
462 /* Not a compile-time constant on x86-32 */
463 address_markers[VMALLOC_START_NR].start_address = VMALLOC_START;
464 address_markers[VMALLOC_END_NR].start_address = VMALLOC_END;
465# ifdef CONFIG_HIGHMEM
466 address_markers[PKMAP_BASE_NR].start_address = PKMAP_BASE;
467# endif
468 address_markers[FIXADDR_START_NR].start_address = FIXADDR_START;
469#endif
470
438#ifdef CONFIG_X86_32
439 /* Not a compile-time constant on x86-32 */
440 address_markers[VMALLOC_START_NR].start_address = VMALLOC_START;
441 address_markers[VMALLOC_END_NR].start_address = VMALLOC_END;
442# ifdef CONFIG_HIGHMEM
443 address_markers[PKMAP_BASE_NR].start_address = PKMAP_BASE;
444# endif
445 address_markers[FIXADDR_START_NR].start_address = FIXADDR_START;
446#endif
447
471#ifdef CONFIG_X86_PTDUMP
472 pe = debugfs_create_file("kernel_page_tables", 0600, NULL, NULL,
473 &ptdump_fops);
474 if (!pe)
475 return -ENOMEM;
476#endif
477
478 return 0;
479}
480
481__initcall(pt_dump_init);
482MODULE_LICENSE("GPL");
483MODULE_AUTHOR("Arjan van de Ven <arjan@linux.intel.com>");
484MODULE_DESCRIPTION("Kernel debugging helper that dumps pagetables");
448 return 0;
449}
450
451__initcall(pt_dump_init);
452MODULE_LICENSE("GPL");
453MODULE_AUTHOR("Arjan van de Ven <arjan@linux.intel.com>");
454MODULE_DESCRIPTION("Kernel debugging helper that dumps pagetables");