-
Notifications
You must be signed in to change notification settings - Fork 995
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
LeakSanitizer gives bogus or incomplete stacktraces #870
Comments
Note that this is a known limitation and already covered in 4-th question of Asan FAQ. As a workaround you can build your software with |
@yugr . I think you read my issue too quickly ;)
|
@delcypher Ok, sorry for being superficial here. My guess is that problem is caused by this frame
It comes from precompiled libstdc++ and thus does not preserve frame pointer which causes fast unwinder to stop. The fact that it breaks differently on different versions of Clang probly makes sense - unwinder just reads random garbage from rsp[0] which may have arbitrary value depending on surrounding code. |
That's a common issue in sanitizer deployment, and the usual fix is
-shared-libstdc++. System libstdc++/libc++ is normally built w/o frame
pointers, and fast_unwind_on_malloc=0 is way too slow.
…On Tue, Oct 17, 2017 at 6:48 AM, Yury Gribov ***@***.***> wrote:
@delcypher <https://github.com/delcypher> Ok, sorry for being superficial
here. My guess is that problem is caused by this frame
#1 0x7f90da6210a8 in operator new(unsigned long) /build/gcc-multilib/src/gcc/libstdc++-v3/libsupc++/new_op.cc:50
It comes from precompiled libstdc++ and thus does not preserve frame
pointer which causes fast unwinder to stop. The fact that it breaks it
differently on different versions of Clang probly makes sense - unwinder
just reads random garbage from rsp[0] which may have arbitrary value
depending on surrounding code.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#870 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAZuSsE5FQCsWldSWbTkthdVEAsVoWkHks5stLAlgaJpZM4P7_kF>
.
|
Done, right after the malloc question.
https://github.com/google/sanitizers/wiki/AddressSanitizer
…On Fri, Oct 20, 2017 at 2:34 PM, Dan Liew ***@***.***> wrote:
@yugr <https://github.com/yugr> @eugenis <https://github.com/eugenis>
Thanks for explaining. It makes sense now.
Perhaps something about this should be added to the FAQ?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#870 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAZuSmC9KU7mBhgQ4XaDmy5FBxRvekQtks5suRH-gaJpZM4P7_kF>
.
|
Thanks. Although in my case I'm already using a shared libstdc++ anyway. I'll close this issue as the underlying issue makes sense to me and is documented. |
Direct FAQ link for the https://github.com/google/sanitizers/wiki/AddressSanitizer#faq (ran into this on Fedora 27 with gcc with/without -fno-omit-frame-pointer) |
…sanitizers (google/sanitizers#870) FossilOrigin-Name: b9ce20f5d7e27c417b041c445dfbd0dd8996fcbeb6a8cebb2579263fe0287f07
It seems that LeakSanitizer will sometimes give bogus or incomplete stacktraces when using
fast_unwind_on_malloc=1
.For context see Z3Prover/z3#1297 . This where I first ran into the issue.
Reproduction steps
This is using Clang 5.0 on Arch Linux
Run with
fast_unwind_on_malloc
This stacktrace is unhelpful due to it being incomplete, but not misleading. However in the original bug report I also observed this. Note in that bug report I was using Clang 3.9. I might have had UBSan enabled too (
-fsanitize=undefined
). I don't remember but I'm compiling now to check.UPDATE: I tried building with UBSan as well as ASan with Clang 5.0 too and this doesn't reproduce the bogus stack trace.
This stacktrace is really misleading (i.e. bogus). I realised fairly quickly when I used gdb to step into the
_fini
implementation forlibz3.so
that the assembly for that function definitely wasn't allocating astd::string
.Run without
fast_unwind_on_malloc
The text was updated successfully, but these errors were encountered: