Open vpshastry opened 1 year ago
Depends on type of bugs, https://clang.llvm.org/docs/SanitizerSpecialCaseList.html Leaks are only runtime.
@vitalybuka thanks for the answer.
Can this issue be kept open to address this and provide an option to set this option at compile time? Preferrably via the same mechanism as -fsanitize-ignorelist
. With a section for leak
.
It will break important feature of lsan, it's link time feature. The program does not need to be recompiled to use lsan. Compiler time ignore list will require to recompile.
However if you can change your program, you can use __lsan_ignore_object Example in https://android.googlesource.com/platform/external/abseil-cpp/+/HEAD/absl/debugging/leak_check.cc
Probably with asan, when we still need to recompile we can try to apply such ignore list. We can __lsan_disable()/__lsan_enable() for the scope, matching to ignore list entry, and ignore all allocations in the middle.
We can keep it open, but I don't think we will have enough interest to work on this.
You can define a function named __lsan_default_suppressions
in your source code:
extern "C" const char* __lsan_default_suppressions() {
return "leak:foo()";
}
Wow! Both are great solutions. Thanks a ton. I guess we can close the issue.
https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer#suppressions is missing documentation about __lsan_default_suppressions
. I'd write it if I'd be able to create a PR for the wiki. :-)
When I build my binary with ASAN enabled, I finally be able to run my executable with
LSAN_OPTIONS=suppressions=<suppression-file>
environment variable that always suppresses leaks from a specific, known, third party library. The point is, I know the suppression file at compile time. Is there a way I can set it at compile time?Ex: Say my binary is compiled with below options
The final binary generated is
myBinary
. RunningmyBinary
should always take the suppression file set at compile time.