summaryrefslogtreecommitdiffstats
path: root/src/kernel
diff options
context:
space:
mode:
authorPatrick Williams <iawillia@us.ibm.com>2013-04-28 18:39:46 -0500
committerA. Patrick Williams III <iawillia@us.ibm.com>2013-05-01 14:22:37 -0500
commit12bb660f69bc7d7bd4cab92621ee2d5b3963ab62 (patch)
treea5422e50ee94c990caf67afd3ee7654a98ec56f4 /src/kernel
parente319acb36befe9fbbdd71565ec570d5977be532b (diff)
downloadtalos-hostboot-12bb660f69bc7d7bd4cab92621ee2d5b3963ab62.tar.gz
talos-hostboot-12bb660f69bc7d7bd4cab92621ee2d5b3963ab62.zip
Enhance heap corruption detection.
Change-Id: I25ec156fe3c9088d2de2254017407dbadd2fac31 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/4255 Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com> Tested-by: Jenkins Server Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/kernel')
-rw-r--r--src/kernel/heapmgr.C8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/kernel/heapmgr.C b/src/kernel/heapmgr.C
index f790b9e46..5518a96f8 100644
--- a/src/kernel/heapmgr.C
+++ b/src/kernel/heapmgr.C
@@ -119,6 +119,7 @@ void* HeapManager::_allocate(size_t i_sz)
g_smallheap_alloc_hw = g_smallheap_allocated;
// test_pages();
#endif
+ crit_assert(chunk->free);
chunk->free = false;
return &chunk->next;
}
@@ -180,7 +181,7 @@ void* HeapManager::_reallocBig(void* i_ptr, size_t i_sz)
break;
}
- bc = bc->next;
+ bc = (big_chunk_t*) (((uint64_t)bc->next) & 0x00000000FFFFFFFF);
}
return new_ptr;
}
@@ -196,6 +197,7 @@ void HeapManager::_free(void * i_ptr)
__sync_sub_and_fetch(&g_smallheap_count,1);
__sync_sub_and_fetch(&g_smallheap_allocated,bucketByteSize(chunk->bucket));
#endif
+ crit_assert(!chunk->free);
push_bucket(chunk, chunk->bucket);
}
}
@@ -531,7 +533,7 @@ void* HeapManager::_allocateBig(size_t i_sz)
break;
}
}
- bc = bc->next;
+ bc = (big_chunk_t*) (((uint64_t)bc->next) & 0x00000000FFFFFFFF);
}
if(!bc)
{
@@ -570,7 +572,7 @@ bool HeapManager::_freeBig(void* i_ptr)
result = true;
break;
}
- bc = bc->next;
+ bc = (big_chunk_t*) (((uint64_t)bc->next) & 0x00000000FFFFFFFF);
}
return result;
}
OpenPOWER on IntegriCloud