CFI, Safe-Stack, and -fno-sanitize-trap

Hi,

I am using clang++3.9 to build a simple program with both CFI and safe-stack. I am getting linker errors when combining -fsanitize=safe-stack, -fsanitize=cfi, and -fno-sanitize-trap=all. Combining safe-stack and CFI without -fno-sanitize-trap=all works as expected.

It looks like clang is attempting to link in two compiler-rt libraries, one for ubsan and one for safestack, and this causes multiply defined symbols.

Is this the expected behavior? Can only one sanitizer at a time have trapping disabled?

The command line to trigger is below.

Hi Artem,

Thanks for the bug report! It should certainly be possible to use safestack with CFI in non-trapping mode, or indeed with any other sanitizer. I’ve sent https://reviews.llvm.org/D29545 for review which should fix this bug.

Peter