LLVM Merges TySan As Sanitizer For Type-Based Aliasing Violations
- Reference: 0001513181
- News link: https://www.phoronix.com/news/LLVM-Merge-TySan-Type-Sanitizer
- Source link:
Merged today to LLVM Git for next year's LLVM 20 release is TySan as a sanitizer for type-based aliasing violations.
The [1]Git commit landing the Type Sanitizer explains of this new addition:
"C/C++ have type-based aliasing rules, and LLVM's optimizer can exploit these given TBAA metadata added by Clang. Roughly, a pointer of given type cannot be used to access an object of a different type (with, of course, certain exceptions). Unfortunately, there's a lot of code in the wild that violates these rules (e.g. for type punning), and such code often must be built with -fno-strict-aliasing. Performance is often sacrificed as a result. Part of the problem is the difficulty of finding TBAA violations. Hopefully, this sanitizer will help."
[2]The merge request dates back almost one year exactly and contains more background and discussion on this new LLVM Type Sanitizer for those interested.
The idea for the Type Sanitizer isn't new but was started back in 2017 by Hal Finkel at Argonne National Laboratory. [3]This slide deck offers more background information as well for the motives of this newest sanitizer.
[1] https://github.com/llvm/llvm-project/commit/a487b792e2dabcec02c63d19e32958572a257408
[2] https://github.com/llvm/llvm-project/pull/76259
[3] https://llvm.org/devmtg/2017-10/slides/Finkel-The%20Type%20Sanitizer.pdf
phoronix