Add section headers to SpecialCaseLists
authorVlad Tsyrklevich <vlad@tsyrklevich.net>
Mon, 25 Sep 2017 22:11:11 +0000 (22:11 +0000)
committerVlad Tsyrklevich <vlad@tsyrklevich.net>
Mon, 25 Sep 2017 22:11:11 +0000 (22:11 +0000)
commit998b220e97b443a6dd80a2dbe12bbe6702d7042b
tree5fead9097262c8159f4e74db9bdc733f8760e351
parentedee9999c4de706f29272eb9757260a188cae59e
Add section headers to SpecialCaseLists

Summary:
Sanitizer blacklist entries currently apply to all sanitizers--there
is no way to specify that an entry should only apply to a specific
sanitizer. This is important for Control Flow Integrity since there are
several different CFI modes that can be enabled at once. For maximum
security, CFI blacklist entries should be scoped to only the specific
CFI mode(s) that entry applies to.

Adding section headers to SpecialCaseLists allows users to specify more
information about list entries, like sanitizer names or other metadata,
like so:

  [section1]
  fun:*fun1*
  [section2|section3]
  fun:*fun23*

The section headers are regular expressions. For backwards compatbility,
blacklist entries entered before a section header are put into the '[*]'
section so that blacklists without sections retain the same behavior.

SpecialCaseList has been modified to also accept a section name when
matching against the blacklist. It has also been modified so the
follow-up change to clang can define a derived class that allows
matching sections by SectionMask instead of by string.

Reviewers: pcc, kcc, eugenis, vsk

Reviewed By: eugenis, vsk

Subscribers: vitalybuka, llvm-commits

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

llvm-svn: 314170
llvm/include/llvm/Support/SpecialCaseList.h
llvm/lib/Support/SpecialCaseList.cpp
llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
llvm/tools/llvm-cov/CoverageFilters.cpp
llvm/tools/sancov/sancov.cc
llvm/unittests/Support/SpecialCaseListTest.cpp