diff options
author | Alexey Samsonov <vonosmas@gmail.com> | 2014-10-17 22:37:33 +0000 |
---|---|---|
committer | Alexey Samsonov <vonosmas@gmail.com> | 2014-10-17 22:37:33 +0000 |
commit | a0ac3c2bf049eb28e77a19dd70cbd570585f4747 (patch) | |
tree | 8402834fea925554f41fa463c71caffc10fe39ad /clang/lib/CodeGen/SanitizerMetadata.h | |
parent | 2845fb29d8ec227b2dedf83fa606eceaea443ccf (diff) | |
download | bcm5719-llvm-a0ac3c2bf049eb28e77a19dd70cbd570585f4747.tar.gz bcm5719-llvm-a0ac3c2bf049eb28e77a19dd70cbd570585f4747.zip |
[ASan] Improve blacklisting of global variables.
This commit changes the way we blacklist global variables in ASan.
Now the global is excluded from instrumentation (either regular
bounds checking, or initialization-order checking) if:
1) Global is explicitly blacklisted by its mangled name.
This part is left unchanged.
2) SourceLocation of a global is in blacklisted source file.
This changes the old behavior, where instead of looking at the
SourceLocation of a variable we simply considered llvm::Module
identifier. This was wrong, as identifier may not correspond to
the file name, and we incorrectly disabled instrumentation
for globals coming from #include'd files.
3) Global is blacklisted by type.
Now we build the type of a global variable using Clang machinery
(QualType::getAsString()), instead of llvm::StructType::getName().
After this commit, the active users of ASan blacklist files
may have to revisit them (this is a backwards-incompatible change).
llvm-svn: 220097
Diffstat (limited to 'clang/lib/CodeGen/SanitizerMetadata.h')
-rw-r--r-- | clang/lib/CodeGen/SanitizerMetadata.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/SanitizerMetadata.h b/clang/lib/CodeGen/SanitizerMetadata.h index 4d63aef552f..f3c700a6f2f 100644 --- a/clang/lib/CodeGen/SanitizerMetadata.h +++ b/clang/lib/CodeGen/SanitizerMetadata.h @@ -15,6 +15,7 @@ #include "clang/Basic/LLVM.h" #include "clang/Basic/SourceLocation.h" +#include "clang/AST/Type.h" namespace llvm { class GlobalVariable; @@ -39,7 +40,7 @@ public: void reportGlobalToASan(llvm::GlobalVariable *GV, const VarDecl &D, bool IsDynInit = false); void reportGlobalToASan(llvm::GlobalVariable *GV, SourceLocation Loc, - StringRef Name, bool IsDynInit = false, + StringRef Name, QualType Ty, bool IsDynInit = false, bool IsBlacklisted = false); void disableSanitizerForGlobal(llvm::GlobalVariable *GV); void disableSanitizerForInstruction(llvm::Instruction *I); |