]> err.no Git - linux-2.6/commitdiff
x86: make sure initmem is writable
authorArjan van de Ven <arjan@linux.intel.com>
Wed, 30 Jan 2008 12:34:07 +0000 (13:34 +0100)
committerIngo Molnar <mingo@elte.hu>
Wed, 30 Jan 2008 12:34:07 +0000 (13:34 +0100)
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>
arch/x86/mm/init_32.c
arch/x86/mm/init_64.c

index 0d3369b900e967ba999a2add81e95fbc6e827c4a..4d115654519442babfa3e0d2a3f4d4fc3749a9b6 100644 (file)
@@ -780,6 +780,13 @@ void free_init_pages(char *what, unsigned long begin, unsigned long end)
 {
        unsigned long addr;
 
+       /*
+        * We just marked the kernel text read only above, now that
+        * we are going to free part of that, we need to make that
+        * writeable first.
+        */
+       set_memory_rw(begin, (end - begin) >> PAGE_SHIFT);
+
        for (addr = begin; addr < end; addr += PAGE_SIZE) {
                ClearPageReserved(virt_to_page(addr));
                init_page_count(virt_to_page(addr));
index 9b69fa54a831fd84e1c8114728a6ad9ea0dec9e5..f97ace7a55e5a15bca02fe015ac0f4ff73e8749a 100644 (file)
@@ -570,6 +570,7 @@ void free_init_pages(char *what, unsigned long begin, unsigned long end)
         * 2Mb kernel mapping just for this debug feature.
         */
        if (begin >= __START_KERNEL_map) {
+               set_memory_rw(begin, (end - begin)/PAGE_SIZE);
                set_memory_np(begin, (end - begin)/PAGE_SIZE);
                set_memory_nx(begin, (end - begin)/PAGE_SIZE);
        }