[cfe-users] Trouble adding leak sanitizer suppressions with --fsanitizer-blacklist option
Andrew C. Morrow
andrew.c.morrow at gmail.com
Thu Oct 2 10:58:15 PDT 2014
Hi cfe-users -
I'm using clang-3.4 from Ubuntu Trusty and trying to get leak
sanitizer integrated with a project. The project builds with
-fsanitize=address passed to all compile and link lines, and reports
various memory errors, so I know it is working. When run with
ASAN_OPTIONS="detect_leaks=1" in the environment leaks are reported at
exit, so that is working as well.
I have a suppressions file that works correctly when
LSAN_OPTIONS="suppressions=etc/asan.suppressions" is set in the shell
environment. The expected suppressions are applied and the suppressed
leaks are not reported at exit. The file looks like this:
$ cat ./etc/asan.suppressions
# ignore v8 for now
However, if I try to set this file as the suppressions file with
--fsanitize-blacklist=etc/asan.suppressions, then the suppressions are
not applied, and all of the leaks I would expect to have been
suppressed are still reported. I know that clang actually is consuming
the file, because if I put a malformed line into the suppressions file
the build fails with:
clang: error: malformed sanitizer blacklist: 'Malformed line 1: 'aslaskdfj''
I'm passing both -fsanitize=address and
-fsanitize-blacklist=etc/asan.suppressions to both the compile and
link stages of the build.
Obviously, I can just use LSAN_OPTIONS, but the blacklist would I
think be preferable if I could get it to work.
What am I doing wrong?
Also, a question about the blacklist that does not seem to be answered
in the docs:
Does the blacklist file get read on each execution of the binary built
with -fsanitize-blacklist, and therefore needs to be kept with the
binary? Or are the contents of the blacklist file read at compile time
and baked into the executable so that the binary can be used
standalone? I'm hoping the latter, as what I would really like to use
is __lsan_default_suppressions, but it appears that that is not
available until clang-3.5 (it is mentioned in
sanitizer/lsan_interface.h for clang-3.5, but not for clang-3.4), and
unfortunately I need this integration to work with clang-3.4.
$ uname -a
Linux workstation 3.13.0-35-generic #62-Ubuntu SMP Fri Aug 15 01:58:42
UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
$ clang++ --version
Ubuntu clang version 3.4-1ubuntu3 (tags/RELEASE_34/final) (based on LLVM 3.4)
Thread model: posix
More information about the cfe-users