Allow specifying sanitizers in blacklists
authorVlad Tsyrklevich <vlad@tsyrklevich.net>
Mon, 25 Sep 2017 22:11:12 +0000 (22:11 +0000)
committerVlad Tsyrklevich <vlad@tsyrklevich.net>
Mon, 25 Sep 2017 22:11:12 +0000 (22:11 +0000)
commit2eccdab308a33c802ea34873cf49dcab4e38cec6
tree7298244e726a6445594775c3e36e7a97a6d88faf
parent998b220e97b443a6dd80a2dbe12bbe6702d7042b
Allow specifying sanitizers in blacklists

Summary:
This is the follow-up patch to D37924.

This change refactors clang to use the the newly added section headers
in SpecialCaseList to specify which sanitizers blacklists entries
should apply to, like so:

  [cfi-vcall]
  fun:*bad_vcall*
  [cfi-derived-cast|cfi-unrelated-cast]
  fun:*bad_cast*

The SanitizerSpecialCaseList class has been added to allow querying by
SanitizerMask, and SanitizerBlacklist and its downstream users have been
updated to provide that information. Old blacklists not using sections
will continue to function identically since the blacklist entries will
be placed into a '[*]' section by default matching against all
sanitizers.

Reviewers: pcc, kcc, eugenis, vsk

Reviewed By: eugenis

Subscribers: dberris, cfe-commits, mgorny

Differential Revision: https://reviews.llvm.org/D37925

llvm-svn: 314171
22 files changed:
clang/docs/ControlFlowIntegrity.rst
clang/docs/SanitizerSpecialCaseList.rst
clang/include/clang/Basic/SanitizerBlacklist.h
clang/include/clang/Basic/SanitizerSpecialCaseList.h [new file with mode: 0644]
clang/lib/AST/Decl.cpp
clang/lib/Basic/CMakeLists.txt
clang/lib/Basic/SanitizerBlacklist.cpp
clang/lib/Basic/SanitizerSpecialCaseList.cpp [new file with mode: 0644]
clang/lib/Basic/XRayLists.cpp
clang/lib/CodeGen/CGClass.cpp
clang/lib/CodeGen/CGDeclCXX.cpp
clang/lib/CodeGen/CGExpr.cpp
clang/lib/CodeGen/CodeGenFunction.cpp
clang/lib/CodeGen/CodeGenModule.cpp
clang/lib/CodeGen/CodeGenModule.h
clang/test/CodeGen/Inputs/sanitizer-special-case-list.sanitized.txt [new file with mode: 0644]
clang/test/CodeGen/Inputs/sanitizer-special-case-list.unsanitized1.txt [new file with mode: 0644]
clang/test/CodeGen/Inputs/sanitizer-special-case-list.unsanitized2.txt [new file with mode: 0644]
clang/test/CodeGen/Inputs/sanitizer-special-case-list.unsanitized3.txt [new file with mode: 0644]
clang/test/CodeGen/Inputs/sanitizer-special-case-list.unsanitized4.txt [new file with mode: 0644]
clang/test/CodeGen/sanitizer-special-case-list.c [new file with mode: 0644]
clang/test/CodeGenCXX/cfi-blacklist.cpp