[PATCH] i386: instead of poisoning .init zone, change protection bits to force a fault

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Chasing some invalid accesses to .init zone, I found that free_init_pages() was properly freeing the pages but virtual was still usable.

A poisoning (memset(page, 0xcc, PAGE_SIZE)) was done but this is not reliable.

Applying this patch at least in mm is a good thing...

(After that we could map non possible cpu percpu data to the initial percpudata that is included in .init and discarded in free_initmem())

Signed-off-by: Eric Dumazet <[email protected]>

--- linux-2.6.16-rc1-mm3/arch/i386/mm/init.c	2006-01-25 10:17:24.000000000 +0100
+++ linux-2.6.16-rc1-mm3-ed/arch/i386/mm/init.c	2006-01-29 21:46:39.000000000 +0100
@@ -750,11 +750,12 @@
 	for (addr = begin; addr < end; addr += PAGE_SIZE) {
 		ClearPageReserved(virt_to_page(addr));
 		set_page_count(virt_to_page(addr), 1);
-		memset((void *)addr, 0xcc, PAGE_SIZE);
+               change_page_attr(virt_to_page(addr), 1, __pgprot(0));
 		free_page(addr);
 		totalram_pages++;
 	}
 	printk(KERN_INFO "Freeing %s: %ldk freed\n", what, (end - begin) >> 10);
+	global_flush_tlb();
 }
 
 void free_initmem(void)

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux