Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

leak sanitizer can not show backtrace #665

Closed
Dushistov opened this issue Apr 3, 2016 · 2 comments
Closed

leak sanitizer can not show backtrace #665

Dushistov opened this issue Apr 3, 2016 · 2 comments

Comments

@Dushistov
Copy link

After end of program leak sanitizer show:

==11566==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 8 byte(s) in 1 object(s) allocated from:
#0 0xb883b8 in __interceptor_malloc /media/Seagate_Expansi/tmp/llvm-svn/src/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:52
#1 0x7f6fb41173a9 in read_charset_define /home/evgeniy/arch_build/libx11/src/libX11-1.6.3/src/xlibi18n/lcGeneric.c:505
#2 0x7f6fb41173a9 in load_generic /home/evgeniy/arch_build/libx11/src/libX11-1.6.3/src/xlibi18n/lcGeneric.c:940

Direct leak of 7 byte(s) in 1 object(s) allocated from:
#0 0xb883b8 in __interceptor_malloc /media/Seagate_Expansi/tmp/llvm-svn/src/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:52
#1 0x7f6fb4111e6f in _XlcAddCT /home/evgeniy/arch_build/libx11/src/libX11-1.6.3/src/xlibi18n/lcCT.c:517

SUMMARY: AddressSanitizer: 15 byte(s) leaked in 2 allocation(s).

As you can see after _XlcAddCT leak detector do not show rest of backtrace.
If compile _XlcAddCT into shared library and LD_PRELOAD it and print backtrace with
backtrace(3), then I get something like this:
backtrace() returned 20 addresses
./a.out(__interceptor_backtrace+0x41) [0xb17071]
/home/evgeniy/projects/compas/planetable/km_pl/build_sanit/libx11_preload.so(_XlcAddCT+0x60) [0x7fa42e9948a0]
/usr/lib/libX11.so.6(_XlcInitCTInfo+0x34) [0x7fa42d9610c4]
/usr/lib/libX11.so.6(+0x573d3) [0x7fa42d9673d3]
/usr/lib/libX11.so.6(+0x56a73) [0x7fa42d966a73]
/usr/lib/libX11.so.6(_XlcCreateLC+0x3c) [0x7fa42d9672ac]
/usr/lib/libX11.so.6(_XlcUtf8Loader+0x10) [0x7fa42d9880d0]
/usr/lib/libX11.so.6(_XOpenLC+0x10e) [0x7fa42d96e87e]
/usr/lib/libX11.so.6(_XrmInitParseInfo+0xb) [0x7fa42d96ea8b]
/usr/lib/libX11.so.6(+0x467b0) [0x7fa42d9567b0]
/usr/lib/libX11.so.6(XrmGetStringDatabase+0xe) [0x7fa42d959dce]
/usr/lib/libX11.so.6(+0x26774) [0x7fa42d936774]
/usr/lib/libX11.so.6(XGetDefault+0x10e) [0x7fa42d936a1e]
./a.out() [0x245d9cb]
./a.out() [0x2460578]
./a.out() [0x23d9eaa]
./a.out() [0x23d9a3c]
./a.out(main+0x290f) [0x21871bf]
/usr/lib/libc.so.6(__libc_start_main+0xf0) [0x7fa42aa91710]
./a.out(_start+0x29) [0xae6de9]

also if rebuild application without -fsanitize=address,undefined and run under valgrind it show full backtrace for memory leak.

This bug prevent me to mask this memory leak with "leak:XGetDefault"

@Dushistov
Copy link
Author

I try with clang 3.9.0(trunk) and gcc 5.3.0. Platform linux/amd64

@yugr
Copy link

yugr commented Apr 4, 2016

Check https://github.com/google/sanitizers/wiki/AddressSanitizer ("My malloc stacktraces are too short?" section).

@kcc kcc closed this as completed Apr 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants