aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorArjan van de Ven <arjan@linux.intel.com>2008-01-30 07:34:07 -0500
committerIngo Molnar <mingo@elte.hu>2008-01-30 07:34:07 -0500
commit3c1df68b848b39270752ff8d4b956cc4a4dce0f6 (patch)
tree7edffa58f936a55fe6a69ca32cde71c0b9d20354 /arch
parent488fd99588bf23da951b524a806e44feaa1aa366 (diff)
x86: make sure initmem is writable
When we free initmem, various rodata and CPA checks may have left memory read only.. this patch ensures that the memory is writable before we free it. Signed-off-by: Arjan van de Ven <arjan@linux.intel.com> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/mm/init_32.c7
-rw-r--r--arch/x86/mm/init_64.c1
2 files changed, 8 insertions, 0 deletions
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
index 0d3369b900e9..4d1156545194 100644
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -780,6 +780,13 @@ void free_init_pages(char *what, unsigned long begin, unsigned long end)
780{ 780{
781 unsigned long addr; 781 unsigned long addr;
782 782
783 /*
784 * We just marked the kernel text read only above, now that
785 * we are going to free part of that, we need to make that
786 * writeable first.
787 */
788 set_memory_rw(begin, (end - begin) >> PAGE_SHIFT);
789
783 for (addr = begin; addr < end; addr += PAGE_SIZE) { 790 for (addr = begin; addr < end; addr += PAGE_SIZE) {
784 ClearPageReserved(virt_to_page(addr)); 791 ClearPageReserved(virt_to_page(addr));
785 init_page_count(virt_to_page(addr)); 792 init_page_count(virt_to_page(addr));
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index 9b69fa54a831..f97ace7a55e5 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -570,6 +570,7 @@ void free_init_pages(char *what, unsigned long begin, unsigned long end)
570 * 2Mb kernel mapping just for this debug feature. 570 * 2Mb kernel mapping just for this debug feature.
571 */ 571 */
572 if (begin >= __START_KERNEL_map) { 572 if (begin >= __START_KERNEL_map) {
573 set_memory_rw(begin, (end - begin)/PAGE_SIZE);
573 set_memory_np(begin, (end - begin)/PAGE_SIZE); 574 set_memory_np(begin, (end - begin)/PAGE_SIZE);
574 set_memory_nx(begin, (end - begin)/PAGE_SIZE); 575 set_memory_nx(begin, (end - begin)/PAGE_SIZE);
575 } 576 }