DynamoRIO / DynamoRIO/drmemory

[linux] instrument auxiliary alloc routines: memalign(), valloc(), etc.

Open
#94 3 comments 0 reactions 1 assignee Claimed by @derekbruening View on GitHub
Migrated OpSys-Linux Priority-Medium
Dominant language
C
Stars
2.7k
Forks
290
PR merge metrics
No merged PRs in 30d

Description

_From [derek.br...@gmail.com](https://code.google.com/u/117968039472581148324/) on December 10, 2010 17:57:33_

PR 406323

some *nix allocators provide additional routines beyond malloc, calloc, realloc.
some of these are obsolete.
some merely provide information, but we may need to intercept them in order to
hide our redzones.
- memalign and valloc
- posix_memalign
- mallinfo
- mallopt
- independent_calloc
- independent_comalloc
- pvalloc
- cfree
- malloc_trim
- malloc_usable_size => I already handle (and use) this one
- malloc_stats

I've recently seen:

Error `#1`: UNADDRESSABLE ACCESS: reading 0x02a9c6d4-0x02a9c6d8 4 byte(s)
Elapsed time = 0:00:00.187 in thread 337403
Note: prev lower malloc: 0x02a9bed0-0x02a9c6c8
0x10e236c6 libc.so.6 !mallopt
??:0
0x10e2450e libc.so.6 !mallopt
??:0
0x10e2559e libc.so.6 !memalign
??:0
0x10e25775 libc.so.6 !posix_memalign
??:0
0x10e25718 libc.so.6 !posix_memalign
??:0
0x10ba664f libglib-2.0.so.0 !g_slice_free1
??:0
0x10ba6908 libglib-2.0.so.0 !g_slice_alloc
??:0
0x10b70670 libglib-2.0.so.0 !g_array_sized_new
??:0
0x10b70725 libglib-2.0.so.0 !g_array_new
??:0
0x10baf4de libglib-2.0.so.0 !g_static_private_set
??:0
0x10b7e17c libglib-2.0.so.0 !g_get_filename_charsets
??:0
0x10b7e32d libglib-2.0.so.0 !g_get_filename_charsets
??:0
0x10baf867 libglib-2.0.so.0 !g_thread_init_glib
??:0
0x10b48dd4 libgthread-2.0.so.0 !g_thread_init
??:0

xref PR 573482: glib custom allocator leads to reported leaks
add "G_SLICE=always-malloc G_DEBUG=gc-friendly" when running?
or would it still use posix_memalign()?
should just implement interception of posix_memalign()

PR 406323, part 1: instrument auxiliary alloc routines: mallopt(), etc.
- add handling for the simpler aux routines, the ones that just ask
for stats or tweak behavior or are identical to existing routines:
cfree, mallopt, mallinfo, malloc_stats, malloc_trim, malloc_get_state
- add warnings on unhandled alloc routines
- add tests/memalign.c that calls these routines

_Original issue: http://code.google.com/p/drmemory/issues/detail?id=94_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.