Heads-up: splitting out C++-specific parts of TSan and MSan runtimes


TL;DR I plan to pull interceptors for operator new/delete in TSan and MSan into separate static libraries: tsan_cxx and msan_cxx.

Currently, static UBSan and ASan runtimes have parts that are linked into the executable in C++ mode only (ubsan_standalone_cxx, and asan_cxx):

  1. it’s necessary for UBSan, as handlers in ubsan_standalone_cxx use functions from C++ ABI (dynamic_cast), which will be unavailable in plain C executable.
  2. we did this in ASan as a step in https://code.google.com/p/address-sanitizer/issues/detail?id=295 (making operator new/delete more standard-compliant). We decided that at some point we may, for instance, build asan_cxx with different flags to throw bad_alloc from operator new.

UBSan runtime was recently embedded into ASan (in particular, ubsan_cxx is now a part of asan_cxx). It solved a number of problems, but made TSan+UBsan and MSan+UBSan combinations temporarily unavailable. I want to fix that.

It means that UBSan will be embedded into both TSan and MSan runtimes in the same way as in ASan, and ubsan_cxx should be a part of some tsan_cxx and msan_cxx. I think that it’s a reasonable step to factor new/delete operators out to tsan_cxx and msan_cxx to make all sanitizers consistent, and potential future changes to these operators easier.

I plan to start implementing these changes early next week. Please let me know if you have objections.