diff options
Diffstat (limited to 'arch/x86/mm/init_64.c')
-rw-r--r-- | arch/x86/mm/init_64.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c index 05bb12db0b09..4757be7b5e55 100644 --- a/arch/x86/mm/init_64.c +++ b/arch/x86/mm/init_64.c | |||
@@ -559,8 +559,21 @@ void free_init_pages(char *what, unsigned long begin, unsigned long end) | |||
559 | free_page(addr); | 559 | free_page(addr); |
560 | totalram_pages++; | 560 | totalram_pages++; |
561 | } | 561 | } |
562 | if (addr > __START_KERNEL_map) | 562 | #ifdef CONFIG_DEBUG_RODATA |
563 | global_flush_tlb(); | 563 | /* |
564 | * This will make the __init pages not present and | ||
565 | * not executable, so that any attempt to use a | ||
566 | * __init function from now on will fault immediately | ||
567 | * rather than supriously later when memory gets reused. | ||
568 | * | ||
569 | * We only do this for DEBUG_RODATA to not break up the | ||
570 | * 2Mb kernel mapping just for this debug feature. | ||
571 | */ | ||
572 | if (begin >= __START_KERNEL_map) { | ||
573 | set_memory_np(begin, (end - begin)/PAGE_SIZE); | ||
574 | set_memory_nx(begin, (end - begin)/PAGE_SIZE); | ||
575 | } | ||
576 | #endif | ||
564 | } | 577 | } |
565 | 578 | ||
566 | void free_initmem(void) | 579 | void free_initmem(void) |