]> granicus.if.org Git - clang/commit
[ASan] Improve blacklisting of global variables.
authorAlexey Samsonov <vonosmas@gmail.com>
Fri, 17 Oct 2014 22:37:33 +0000 (22:37 +0000)
committerAlexey Samsonov <vonosmas@gmail.com>
Fri, 17 Oct 2014 22:37:33 +0000 (22:37 +0000)
commit87d48052c99c5988278f275ba94d2eb50f6f0a2a
treede203f18637fab479b28d40db4153d123ea5b228
parenta4de584195b308145f7ad189b5dd0303de5fb4f7
[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).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@220097 91177308-0d34-0410-b5e6-96231b3b80d8
docs/AddressSanitizer.rst
include/clang/Basic/SanitizerBlacklist.h
lib/Basic/SanitizerBlacklist.cpp
lib/CodeGen/CodeGenModule.cpp
lib/CodeGen/CodeGenModule.h
lib/CodeGen/SanitizerMetadata.cpp
lib/CodeGen/SanitizerMetadata.h
test/CodeGen/asan-globals.cpp
test/CodeGen/sanitize-init-order.cpp