Ported over the kernel heap to libroot to make use of it's validation

capabilities to aid in debugging memory corruption issues.

It does:
* Initialize memory to 0xcc to help turn up use of uninitialized memory
* Set freed memory to 0xdeadbeef to help find accesses of freed memory
* Use the paranoid heap validation to turn up many cases of memory corruption
* Use a simplistic wall check to turn up memory overwrites past allocations
* Take extra steps to validate freed addresses to turn up misaligned frees

It has an interface to en-/disable paranoid validation and to start/stop regular
wall checking. Both are currently just enabled. At a later stage a debug version
of libroot could be used by an application and the checks enabled at will. Note
that due to the paranoid validation and the suboptimal locking this allocator
will perform horribly. Still to find memory corruption issues in the system or
also in your applications it can be helpful to build your installation with it
turned on. To enable it you currently need to edit the Jamfile to sub-include
the malloc_debug instead of the malloc directory.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32894 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Michael Lotz 2009-09-01 18:15:30 +00:00
parent 74e8797f5e
commit 185fd1c5d2
3 changed files with 1761 additions and 0 deletions

View File

@ -34,6 +34,7 @@ SubInclude HAIKU_TOP src system libroot posix arch $(TARGET_ARCH) ;
SubInclude HAIKU_TOP src system libroot posix crypt ;
SubInclude HAIKU_TOP src system libroot posix locale ;
SubInclude HAIKU_TOP src system libroot posix malloc ;
#SubInclude HAIKU_TOP src system libroot posix malloc_debug ;
SubInclude HAIKU_TOP src system libroot posix pthread ;
SubInclude HAIKU_TOP src system libroot posix signal ;
SubInclude HAIKU_TOP src system libroot posix stdio ;

View File

@ -0,0 +1,7 @@
SubDir HAIKU_TOP src system libroot posix malloc_debug ;
UsePrivateSystemHeaders ;
MergeObject posix_malloc.o :
heap.cpp
;

File diff suppressed because it is too large Load Diff