Make use of the address range blocking to guarantee that accessing 0xdeadbeef

and 0xcccccccc (and 64 pages thereafter) in any way will always lead to a crash.
Before it could happen that these ranges were allocated for an area and then
accessing these would not be as evident anymore. Only enabled when the
corresponding paranoid setting is enabled (which it currently is).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33033 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Michael Lotz
2009-09-10 02:09:16 +00:00
parent 9aff7f1593
commit 65b5e4d7ed
+9
View File
@@ -1912,6 +1912,15 @@ heap_init(addr_t base, size_t size)
status_t
heap_init_post_sem()
{
#if PARANOID_KERNEL_MALLOC
vm_block_address_range("uninitialized heap memory",
(void *)ROUNDDOWN(0xcccccccc, B_PAGE_SIZE), B_PAGE_SIZE * 64);
#endif
#if PARANOID_KERNEL_FREE
vm_block_address_range("freed heap memory",
(void *)ROUNDDOWN(0xdeadbeef, B_PAGE_SIZE), B_PAGE_SIZE * 64);
#endif
sHeapGrowSem = create_sem(0, "heap_grow_sem");
if (sHeapGrowSem < 0) {
panic("heap_init_post_sem(): failed to create heap grow sem\n");