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
asan hangs at exception #38989
Comments
assigned to @serge-sans-paille |
The reason appears simple.
|
This is still reproducible with compiler-rt master version. A nice way to fix that error would be to lazily load interceptors, but that would come at a small runtime cost. Adding Kostya Serebryany for more advices... |
Is there an easy workaround in the build command line(s) for this program? |
The workaround is trivial: pass That way, when asan builds its interceptors, the `__cxa_throw`` symbol is found by dlopen. |
Is this somehow specific to libstdc++, Also, gcc's asan at least doesn't hang in an |
It's not specific to libstdc++, the issue would raise for any shared library linked into a dlopened library and not in the main executable. I agree with the error handling aspect, @kostya, any idea to improve the situation? |
No good ideas, sorry, except that patches are welcome |
@Kostya: in this snippet
we could check whether REAL(__cxa_throw) != __cxa_throw, which is the cause of the origin loop. Even better, if REAL(__cxa_throw) == __cxa_throw, we could try a new dlsym lookup because if the input program is correct, then __cxa_throw must be available when called. Taking this one step further, there is no need to run the dlsym at startup, it could be done lazily upon first call :-) |
I'd like to avoid any kind of lazy init, it usually adds complexity more than it removes it. |
https://reviews.llvm.org/D63877 now raises a decent error |
Fixed by https://reviews.llvm.org/rL366413 |
ASan hangs in an infinite loop if an exception is raised in a `.so` that was loaded by a `dlopen`ed library. There doesn't seem to be a fix for this yet - the bug report says it is fixed, but there is a subsequent revert of the fix and the issue was not re-opened. See code comments. See: https://bugs.llvm.org/show_bug.cgi?id=39641 and: llvm/llvm-project#38989 Signed-off-by: David Feltell <david.feltell@foundry.com>
ASan hangs in an infinite loop if an exception is raised in a `.so` that was loaded by a `dlopen`ed library. There doesn't seem to be a fix for this yet - the bug report says it is fixed, but there is a subsequent revert of the fix and the issue was not re-opened. See code comments. See: https://bugs.llvm.org/show_bug.cgi?id=39641 and: llvm/llvm-project#38989 Signed-off-by: David Feltell <david.feltell@foundry.com>
ASan hangs in an infinite loop if an exception is raised in a `.so` that was loaded by a `dlopen`ed library. There doesn't seem to be a fix for this yet - the bug report says it is fixed, but there is a subsequent revert of the fix and the issue was not re-opened. See code comments. See: https://bugs.llvm.org/show_bug.cgi?id=39641 and: llvm/llvm-project#38989 Signed-off-by: David Feltell <david.feltell@foundry.com>
Extended Description
Hello.
Attached is a test-case for the problem.
If some C++ shlib is dlopen()ed by the C program,
and then this shlib throws an exception (that it
also catches of course - invisible to the C code),
then asan fails to find __cxa_throw, and calls the
__asan_handle_no_return() in an infinite loop.
Another bug here is that it is not possible to
see the symbols of asan functions:
(gdb) bt
#0 0x00000000004e6bf9 in __asan::AsanThread::stack_top() ()
#1 0x00000000004e4785 in __asan_handle_no_return ()
#2 0x000000000043304c in __interceptor___cxa_throw ()
#3 0x00007ffff40fea9f in foo () at shlib.cpp:4
#4 0x00007ffff40fe97d in bar () at shlib.cpp:13
#5 0x00000000005121eb in main () at main.c:11
... even though everything was compiled with debug info.
The text was updated successfully, but these errors were encountered: