summaryrefslogtreecommitdiffstats
path: root/lib/Basic
diff options
context:
space:
mode:
authorAlexey Samsonov <vonosmas@gmail.com>2014-10-17 00:20:19 +0000
committerAlexey Samsonov <vonosmas@gmail.com>2014-10-17 00:20:19 +0000
commitdd1c90cd6be51df34fbd2043193a1b423c6a9f69 (patch)
tree579a18825d9a8baf1166cadef72d5226bdf6baf4 /lib/Basic
parentf488f1737fbdacefeada5abd141ea78be29cef93 (diff)
SanitizerBlacklist: blacklist functions by their source location.
This commit changes the way we blacklist functions in ASan, TSan, MSan and UBSan. We used to treat function as "blacklisted" and turned off instrumentation in it in two cases: 1) Function is explicitly blacklisted by its mangled name. This part is not changed. 2) Function is located in llvm::Module, whose identifier is contained in the list of blacklisted sources. This is completely wrong, as llvm::Module may not correspond to the actual source file function is defined in. Also, function can be defined in a header, in which case user had to blacklist the .cpp file this header was #include'd into, not the header itself. Such functions could cause other problems - for instance, if the header was included in multiple source files, compiled separately and linked into a single executable, we could end up with both instrumented and non-instrumented version of the same function participating in the same link. After this change we will make blacklisting decision based on the SourceLocation of a function definition. If a function is not explicitly defined in the source file, (for example, the function is compiler-generated and responsible for initialization/destruction of a global variable), then it will be blacklisted if the corresponding global variable is defined in blacklisted source file, and will be instrumented otherwise. After this commit, the active users of blacklist files may have to revisit them. This is a backwards-incompatible change, but I don't think it's possible or makes sense to support the old incorrect behavior. I plan to make similar change for blacklisting GlobalVariables (which is ASan-specific). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219997 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Basic')
-rw-r--r--lib/Basic/SanitizerBlacklist.cpp6
1 files changed, 0 insertions, 6 deletions
diff --git a/lib/Basic/SanitizerBlacklist.cpp b/lib/Basic/SanitizerBlacklist.cpp
index f0221331ed..2f4bdb5113 100644
--- a/lib/Basic/SanitizerBlacklist.cpp
+++ b/lib/Basic/SanitizerBlacklist.cpp
@@ -12,7 +12,6 @@
//
//===----------------------------------------------------------------------===//
#include "clang/Basic/SanitizerBlacklist.h"
-#include "llvm/IR/Function.h"
#include "llvm/IR/GlobalValue.h"
#include "llvm/IR/Module.h"
@@ -33,11 +32,6 @@ SanitizerBlacklist::SanitizerBlacklist(StringRef BlacklistPath,
SourceManager &SM)
: SCL(llvm::SpecialCaseList::createOrDie(BlacklistPath)), SM(SM) {}
-bool SanitizerBlacklist::isIn(const llvm::Function &F) const {
- return isBlacklistedFile(F.getParent()->getModuleIdentifier()) ||
- isBlacklistedFunction(F.getName());
-}
-
bool SanitizerBlacklist::isIn(const llvm::GlobalVariable &G,
StringRef Category) const {
return isBlacklistedFile(G.getParent()->getModuleIdentifier(), Category) ||