I want to disable ASan and TSan checks for one method in a project and the option llvm provides is a Sanitizer special case list.
Here is a small example code which triggers an AddressSanitizer error.
#include <cstdlib>
#include <memory>
class BadASan
{
public:
void get_memory()
{
int *a = reinterpret_cast<int *>(malloc(40));
a[10] = 1;
}
};
int main()
{
auto bad_asan = std::make_unique<BasASan>();
bad_asan->get_memory();
return 0;
}
I have a file ignorelist.txt
to tell ASan to ignore BadASan::get_memory()
, but none of the pattern I tried so far are working. Every line starting with fun:
I tried on its own or with combination of others
[address]
fun:BadASan::get_memory # fully qualified name
fun:*get_memory # pattern with only the method name
fun:__ZN3BadASan7get_memoryEv # mangled name
I compile the code with:
# clang++ -std=c++17 -fsanitze=address -fsanitize-ignorelist=ignorelist.txt bad_asan.cxx
but still the AddressSanitizer is showing the error.
How do I disable ASan for the method BadASan::get_memory
with an ignorelist?