Undefined behavior sanitizer suppression file: failed to parse suppressions

Viewed 1870

After compiling an application with clang 3.6 using -fsanitize=undefined, I'm trying to start the instrumented program while using a suppression file to ignore some of the errors:

UBSAN_OPTIONS="suppressions=ubsan.supp" ./app.exe

The suppression file ubsan.supp contains:

signed-integer-overflow:example.c

This leads to an error message:

UndefinedBehaviorSanitizer: failed to parse suppressions

The same occurs with a gcc 4.9 build. The only documentation I can find is http://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html, which is for clang 3.9, while I use 3.6 (which doesn't have documentation for ubsan included).

Can anyone provide working examples for ubsan suppression files, that work in clang 3.6?

Edit: By browsing the source code of ubsan, I found that the only valid suppression type might be "vptr_check" - dunno which version I was looking at though. Can anyone confirm that in clang 3.9 more suppression types are available?

2 Answers

I didn't spend the time to find out exactly which suppressions were available in clang-3.6, but it appears that in clang-3.7 only vptr_check is available as a suppression. Starting in clang-3.8, the suppressions list is defined to be the list of checks, plus vptr_check. In clang-3.9 the checks available are:

  • "undefined"
  • "null"
  • "misaligned-pointer-use"
  • "alignment"
  • "object-size"
  • "signed-integer-overflow"
  • "unsigned-integer-overflow"
  • "integer-divide-by-zero"
  • "float-divide-by-zero"
  • "shift-base"
  • "shift-exponent"
  • "bounds"
  • "unreachable"
  • "return"
  • "vla-bound"
  • "float-cast-overflow"
  • "bool"
  • "enum"
  • "function"
  • "returns-nonnull-attribute"
  • "nonnull-attribute"
  • "vptr"
  • "cfi"
  • "vptr_check"
Related