Search code examples
ubuntuclangubuntu-16.04address-sanitizer

Why does ASAN_SYMBOLIZER_PATH no longer work with version adorned binaries


On Ubuntu 14.10, the llvm-symbolizer program is installed as /usr/bin/llvm-symbolizer-3.5. Normally, address sanitizer wants to find a binary named llvm-symbolizer in PATH. However, as a workaround, it was possible to explicitly set ASAN_SYMBOLIZER_PATH. So, setting ASAN_SYMBOLIZER_PATH=/usr/bin/llvm-symbolizer-3.5 in the environment would let an address sanitizer instrumented program print symbolized errors.

On Ubuntu 16.04, the llvm-symbolizer program is again installed with a version suffix, now as /usr/bin/llvm-symbolizer-3.8. However, the ASAN_SYMBOLIZER_PATH setting no longer seems to work. Running an ASAN instrumented program with ASAN_SYMBOLIZER_PATH=/usr/bin/llvm-symbolizer-3.8 set in the environment generates the following error when ASAN detects an error:

==18718==ERROR: External symbolizer path is set to '/usr/bin/llvm-symbolizer-3.8' which isn't a known symbolizer. Please set the path to the llvm-symbolizer binary or other known tool.

Does anyone know why this behavior changed, or how to restore the old behavior? This seems unreasonably restrictive. The symbolizer program I've pointed ASAN to is definitely a known symbolizer, it just happens to have an Ubuntu mandated version tag at the end.

Note that adjusting PATH doesn't help here, since Ubuntu doesn't ship an llvm-symbolizer binary that comes without a version adornment.


Solution

  • It turns out, that on Ubuntu's packaging of LLVM, one can get the unadorned llvm-symbolizer binary from the path /usr/lib/llvm-3.x/bin, so PATH=/usr/lib/llvm-3.x/bin:$PATH [COMMAND] does the trick. I still think though that this change is a regression in compiler_rt.