I’m having what I would consider to be a very bizarre issue with ASAN. I am working on a linux daemon that is started by systemd. My ASAN flags look like this:
Environment=ASAN_OPTIONS=abort_on_error=1:log_path=%h/.local/share/grd_asan/as_%p.log:symbolize=1:halt_on_error=0:disable_coredump=0:unmap_shadow_on_exit=1:detect_leaks=0
Environment=LSAN_OPTIONS=exitcode=0
The issue I am having is that ASAN does not log the crashes when detect_leaks=0
, but it does log them when detect_leaks=1
. When I first instrumented, LeakSanitizer was on by default and it did log, but it was annoying so I needed to disable it so I could log my actual segfault, but when I did this, I even got core dumps but no ASAN logs until I turn LeakSanitizer back on, but with LS on, I can’t even get to my bug. And whats even weirder, during my actual crash coredump backtrace, is this:
gef➤ bt
#0 0x00007f5b7b368624 in __pthread_kill_implementation () at /lib64/libc.so.6
#1 0x00007f5b7b30fd1e in raise () at /lib64/libc.so.6
#2 0x00007f5b7b2f7942 in abort () at /lib64/libc.so.6
#3 0x00007f5b7c4e210f in __sanitizer::Abort() () at /lib64/libasan.so.8
#4 0x00007f5b7c4f1b8c in __sanitizer::Die() () at /lib64/libasan.so.8
#5 0x00007f5b7c4d9b20 in __sanitizer::ReportFile::ReopenIfNecessary() () at /lib64/libasan.so.8
#6 0x00007f5b7c4e0f3e in __sanitizer::ReportFile::Write(char const*, unsigned long) () at /lib64/libasan.so.8
#7 0x00007f5b7c4e39b5 in __sanitizer::SharedPrintfCodeNoBuffer(bool, char*, int, char const*, __va_list_tag*) [clone .constprop.0] () at /lib64/libasan.so.8
#8 0x00007f5b7c4e3be9 in __sanitizer::SharedPrintfCode(bool, char const*, __va_list_tag*) () at /lib64/libasan.so.8
#9 0x00007f5b7c4e3c95 in __sanitizer::Printf(char const*, ...) () at /lib64/libasan.so.8
#10 0x00007f5b7c4c8ec0 in __asan::ReportDeadlySignal(__sanitizer::SignalContext const&) () at /lib64/libasan.so.8
#11 0x00007f5b7c4c7ecf in __asan::AsanOnDeadlySignal(int, void*, void*) () at /lib64/libasan.so.8
This would indicate to me that ASAN is actually trying to log the issue but… its not and thats what I don’t understand.