From 19dfa5885245a5a835346256e910275a08498219 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Mon, 22 Aug 2005 21:01:03 +0000 Subject: [PATCH] add_wall() first added the memory block to the list, and then added the wall - there was a race condition between that and the wall checker daemon (if enabled): it could occasionally report an overwritten wall in that very moment. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14051 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/heap.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/system/kernel/heap.c b/src/system/kernel/heap.c index 01ca49a78c..b2298e155a 100644 --- a/src/system/kernel/heap.c +++ b/src/system/kernel/heap.c @@ -224,14 +224,13 @@ add_wall(void *address, size_t size, size_t alignment) address = (uint8 *)address + alignment; wall = get_wall(address); + set_wall(wall, size, alignment); #if USE_CHECKING_WALL acquire_sem(sWallCheckLock); list_add_link_to_tail(&sWalls, &wall->link); release_sem(sWallCheckLock); #endif - - set_wall(wall, size, alignment); return address; } @@ -246,8 +245,8 @@ check_wall(void *address) for (i = 0; i < WALL_SIZE / 4; i++) { if (frontWall->wall[i] != 0xabadcafe) { - panic("free: front wall %i was overwritten (allocation at %p, %lu bytes): %08lx\n", - i, address, frontWall->size, frontWall->wall[i]); + panic("free: front wall %i (%p) was overwritten (allocation at %p, %lu bytes): %08lx\n", + i, frontWall, address, frontWall->size, frontWall->wall[i]); } } @@ -255,8 +254,8 @@ check_wall(void *address) for (i = 0; i < WALL_SIZE / 4; i++) { if (backWall->wall[i] != 0xabadcafe) { - panic("free: back wall %i was overwritten (allocation at %p, %lu bytes): %08lx\n", - i, address, frontWall->size, backWall->wall[i]); + panic("free: back wall %i (%p) was overwritten (allocation at %p, %lu bytes): %08lx\n", + i, backWall, address, frontWall->size, backWall->wall[i]); } } }