From: Ben Gras Date: Tue, 8 Jun 2010 00:59:48 +0000 (+0000) Subject: vm: junkfree feature that fills freed pages with a recognizable pattern. X-Git-Tag: v3.1.8~492 X-Git-Url: http://zhaoyanbai.com/repos/rndc-confgen.html?a=commitdiff_plain;h=31adc0a3c48509afe0e625e93deb39c7f0834a73;p=minix.git vm: junkfree feature that fills freed pages with a recognizable pattern. --- diff --git a/servers/vm/alloc.c b/servers/vm/alloc.c index 9782d9ec6..b4b82745e 100644 --- a/servers/vm/alloc.c +++ b/servers/vm/alloc.c @@ -540,6 +540,12 @@ PRIVATE void free_pages(phys_bytes pageno, int npages) assert(!addr_search(&addravl, pageno, AVL_EQUAL)); +#if JUNKFREE + if(sys_memset(0xa5a5a5a5, VM_PAGE_SIZE * pageno, + VM_PAGE_SIZE * npages) != OK) + panic("free_pages: sys_memset failed"); +#endif + /* try to merge with higher neighbour */ if((pr=addr_search(&addravl, pageno+npages, AVL_EQUAL))) { USE(pr, pr->addr -= npages; diff --git a/servers/vm/vm.h b/servers/vm/vm.h index 0a20d6ee4..f3d9b5722 100644 --- a/servers/vm/vm.h +++ b/servers/vm/vm.h @@ -20,6 +20,7 @@ /* Compile in asserts and custom sanity checks at all? */ #define SANITYCHECKS 0 #define VMSTATS 0 +#define JUNKFREE 0 /* Fill freed pages with junk */ /* How noisy are we supposed to be? */ #define VERBOSE 0