[PATCH] D67298: [ASan] Only run dlopen-mixed-c-cxx.c with static runtime
serge via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Sep 7 05:31:12 PDT 2019
serge-sans-paille added a comment.
> And that's what I don't understand
My fault for not being clear enough. Let me elaborate the original faulty use case:
You've got an application written in C, compiled with asan, that dlopens a library written in C++, linked to libstdc++
When the application starts, asan installs a few handler based on the loaded symbols. It used to install a handler that points to itself for __cxa_throw because the symbol is not present in the binary.
When the C++ library is loaded, it resolves __cxa_throw to the asan implementation instead of the libstdc++ implementation.
When an exception is raised, the asam handler is called (that's normal) but it doesn't fallsback to libstdc++ (because this library wasn't loaded when the handler got initialized).
The problem with current test case is that it assumes the c++ code is compiled with libstdc++, which is an invalid assumption based on your feedback.
We could force clang to use libstdc++ when linking the C++ library, would that work in your situation?
- // RUN: %clangxx_asan -xc++ -shared -fPIC -o %t.so - < %s
+ // RUN: %clangxx_asan -xc++ -stdlib=libstdc++ -shared -fPIC -o %t.so - < %s
Assuming libstdc++ is available in the system?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D67298/new/
https://reviews.llvm.org/D67298
More information about the llvm-commits
mailing list