Commit 16c67629 authored by Andi Kleen's avatar Andi Kleen Committed by Linus Torvalds

[PATCH] x86_64: Poison initdata

Due to popular request

Unconditionally poison __init code after bootup.

Poison initdata too.
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 8ea5648c
...@@ -87,7 +87,9 @@ SECTIONS ...@@ -87,7 +87,9 @@ SECTIONS
*(.init.text) *(.init.text)
_einittext = .; _einittext = .;
} }
__initdata_begin = .;
.init.data : { *(.init.data) } .init.data : { *(.init.data) }
__initdata_end = .;
. = ALIGN(16); . = ALIGN(16);
__setup_start = .; __setup_start = .;
.init.setup : { *(.init.setup) } .init.setup : { *(.init.setup) }
......
...@@ -484,6 +484,8 @@ void __init mem_init(void) ...@@ -484,6 +484,8 @@ void __init mem_init(void)
#endif #endif
} }
extern char __initdata_begin[], __initdata_end[];
void free_initmem(void) void free_initmem(void)
{ {
unsigned long addr; unsigned long addr;
...@@ -492,12 +494,11 @@ void free_initmem(void) ...@@ -492,12 +494,11 @@ void free_initmem(void)
for (; addr < (unsigned long)(&__init_end); addr += PAGE_SIZE) { for (; addr < (unsigned long)(&__init_end); addr += PAGE_SIZE) {
ClearPageReserved(virt_to_page(addr)); ClearPageReserved(virt_to_page(addr));
set_page_count(virt_to_page(addr), 1); set_page_count(virt_to_page(addr), 1);
#ifdef CONFIG_INIT_DEBUG
memset((void *)(addr & ~(PAGE_SIZE-1)), 0xcc, PAGE_SIZE); memset((void *)(addr & ~(PAGE_SIZE-1)), 0xcc, PAGE_SIZE);
#endif
free_page(addr); free_page(addr);
totalram_pages++; totalram_pages++;
} }
memset(__initdata_begin, 0xba, __initdata_end - __initdata_begin);
printk ("Freeing unused kernel memory: %luk freed\n", (&__init_end - &__init_begin) >> 10); printk ("Freeing unused kernel memory: %luk freed\n", (&__init_end - &__init_begin) >> 10);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment