<div dir="ltr">Hi Andrew,<div><br></div><div>Blacklist file and suppressions file are different, and have different format:</div><div>Here's the description of blacklist file format for ASan: <a href="http://clang.llvm.org/docs/AddressSanitizer.html#blacklist">http://clang.llvm.org/docs/AddressSanitizer.html#blacklist</a></div><div><br></div><div>Blacklist file is only used during the compilation. Compiler just doesn't insert ASan checks for blacklisted items, so</div><div>if you have a bug in a blacklisted function, its code will not have ASan checks, and this the bug has no chance of being reported in runtime.</div><div><br></div><div>Suppression file is used in runtime - when the error actually happens, it is matched against the suppressions, and is not reported in case of a match.</div><div><br></div><div>Note that:</div><div>1) There's no way to "suppress" ASan errors. Currently all ASan errors are fatal and immediately crash your executable. This is done on purpose -</div><div>we believe ASan-detected errors are critical and definitely needs to be fixed, and making the errors unrecoverable improves tool performance</div><div><br></div><div>2) There's currently no way to "blacklist" memory leaks. They can only be suppressed. The reason is - LSan doesn't modify the program at compile time at</div><div>all. It just replaces the memory allocator at link time, plugging in custom functions instead of malloc/free from standard library. So, in order to propagate</div><div>blacklist contents to LSan, we'd have to bake it into the executable, which we don't really want to do.</div><div><br></div><div>Now this problem is solved with __lsan_default_suppressions, so I don't really know what to advise you, assuming you're bound to the old version of Clang.</div><div><br></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Oct 2, 2014 at 10:58 AM, Andrew C. Morrow <span dir="ltr"><<a href="mailto:andrew.c.morrow@gmail.com" target="_blank">andrew.c.morrow@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi cfe-users -<br>
<br>
I'm using clang-3.4 from Ubuntu Trusty and trying to get leak<br>
sanitizer integrated with a project. The project builds with<br>
-fsanitize=address passed to all compile and link lines, and reports<br>
various memory errors, so I know it is working. When run with<br>
ASAN_OPTIONS="detect_leaks=1" in the environment leaks are reported at<br>
exit, so that is working as well.<br>
<br>
I have a suppressions file that works correctly when<br>
LSAN_OPTIONS="suppressions=etc/asan.suppressions" is set in the shell<br>
environment. The expected suppressions are applied and the suppressed<br>
leaks are not reported at exit. The file looks like this:<br>
<br>
$ cat ./etc/asan.suppressions<br>
# ignore v8 for now<br>
leak:v8::<br>
<br>
However, if I try to set this file as the suppressions file with<br>
--fsanitize-blacklist=etc/asan.suppressions, then the suppressions are<br>
not applied, and all of the leaks I would expect to have been<br>
suppressed are still reported. I know that clang actually is consuming<br>
the file, because if I put a malformed line into the suppressions file<br>
the build fails with:<br>
<br>
clang: error: malformed sanitizer blacklist: 'Malformed line 1: 'aslaskdfj''<br>
<br>
I'm passing both -fsanitize=address and<br>
-fsanitize-blacklist=etc/asan.suppressions to both the compile and<br>
link stages of the build.<br>
<br>
Obviously, I can just use LSAN_OPTIONS, but the blacklist would I<br>
think be preferable if I could get it to work.<br>
<br>
What am I doing wrong?<br>
<br>
Also, a question about the blacklist that does not seem to be answered<br>
in the docs:<br>
<br>
Does the blacklist file get read on each execution of the binary built<br>
with -fsanitize-blacklist, and therefore needs to be kept with the<br>
binary? Or are the contents of the blacklist file read at compile time<br>
and baked into the executable so that the binary can be used<br>
standalone? I'm hoping the latter, as what I would really like to use<br>
is __lsan_default_suppressions, but it appears that that is not<br>
available until clang-3.5 (it is mentioned in<br>
sanitizer/lsan_interface.h for clang-3.5, but not for clang-3.4), and<br>
unfortunately I need this integration to work with clang-3.4.<br>
<br>
Thanks,<br>
Andrew<br>
<br>
$ uname -a<br>
Linux workstation 3.13.0-35-generic #62-Ubuntu SMP Fri Aug 15 01:58:42<br>
UTC 2014 x86_64 x86_64 x86_64 GNU/Linux<br>
$ clang++ --version<br>
Ubuntu clang version 3.4-1ubuntu3 (tags/RELEASE_34/final) (based on LLVM 3.4)<br>
Target: x86_64-pc-linux-gnu<br>
Thread model: posix<br>
_______________________________________________<br>
cfe-users mailing list<br>
<a href="mailto:cfe-users@cs.uiuc.edu">cfe-users@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-users" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-users</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr">Alexey Samsonov<br><a href="mailto:vonosmas@gmail.com" target="_blank">vonosmas@gmail.com</a></div>
</div>