mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-25 22:20:45 +00:00
bdaeea1b68
This annotates malloc and friends so that valgrind can track the heap. To do this, we need to follow a few rules: * Call VALGRIND_MALLOCLIKE_BLOCK whenever we malloc something * Call VALGRIND_FREELIKE_BLOCK whenever we free something (generally after we have done our bookkeeping) * Call VALGRIND_RESIZEINPLACE_BLOCK whenever we change the size of an allocation. We don't record the original request size of a block, and neither does valgrind. For this reason, we pretend that the old size of the allocation was for 0 bytes. This marks the whole allocaton as undefined, so in order to mark all bits correctly, we must make the whole new allocation defined with VALGRIND_MAKE_MEM_DEFINED. This may cause us to miss some invalid reads, but there is no way to detect these without recording the original size of the allocation. In addition to the above, dlmalloc itself tends to make a lot of accesses which we know are safe, but which would be unsafe outside of dlmalloc. For this reason, we provide a suppression file which ignores errors ocurring in dlmalloc.c Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
53 lines
481 B
Text
53 lines
481 B
Text
{
|
|
dlmalloc
|
|
Memcheck:Addr1
|
|
src:dlmalloc.c
|
|
}
|
|
{
|
|
dlmalloc
|
|
Memcheck:Addr4
|
|
src:dlmalloc.c
|
|
}
|
|
{
|
|
dlmalloc
|
|
Memcheck:Addr8
|
|
src:dlmalloc.c
|
|
}
|
|
{
|
|
dlmalloc
|
|
Memcheck:Addr1
|
|
fun:*
|
|
src:dlmalloc.c
|
|
}
|
|
{
|
|
dlmalloc
|
|
Memcheck:Addr4
|
|
fun:*
|
|
src:dlmalloc.c
|
|
}
|
|
{
|
|
dlmalloc
|
|
Memcheck:Addr8
|
|
fun:*
|
|
src:dlmalloc.c
|
|
}
|
|
{
|
|
dlmalloc
|
|
Memcheck:Value4
|
|
src:dlmalloc.c
|
|
}
|
|
{
|
|
dlmalloc
|
|
Memcheck:Value8
|
|
src:dlmalloc.c
|
|
}
|
|
{
|
|
dlmalloc
|
|
Memcheck:Cond
|
|
src:dlmalloc.c
|
|
}
|
|
{
|
|
dlmalloc
|
|
Memcheck:Free
|
|
src:dlmalloc.c
|
|
}
|