summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex/PPMacroExpansion.cpp
diff options
context:
space:
mode:
authorAlexander Potapenko <glider@google.com>2015-06-19 12:19:07 +0000
committerAlexander Potapenko <glider@google.com>2015-06-19 12:19:07 +0000
commitb9b73ef9067371fbe78c34e0f3b23d014413a2f8 (patch)
tree879cacb4b816acf453a145cdec863e6150070ece /clang/lib/Lex/PPMacroExpansion.cpp
parent284a750c5ff95a29cd8cc9130d3eb7ec6d25e352 (diff)
downloadbcm5719-llvm-b9b73ef9067371fbe78c34e0f3b23d014413a2f8.tar.gz
bcm5719-llvm-b9b73ef9067371fbe78c34e0f3b23d014413a2f8.zip
[ASan] Initial support for Kernel AddressSanitizer
This patch adds initial support for the -fsanitize=kernel-address flag to Clang. Right now it's quite restricted: only out-of-line instrumentation is supported, globals are not instrumented, some GCC kasan flags are not supported. Using this patch I am able to build and boot the KASan tree with LLVMLinux patches from github.com/ramosian-glider/kasan/tree/kasan_llvmlinux. To disable KASan instrumentation for a certain function attribute((no_sanitize("kernel-address"))) can be used. llvm-svn: 240131
Diffstat (limited to 'clang/lib/Lex/PPMacroExpansion.cpp')
-rw-r--r--clang/lib/Lex/PPMacroExpansion.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/Lex/PPMacroExpansion.cpp b/clang/lib/Lex/PPMacroExpansion.cpp
index c63cafb6d79..ccfb30240b0 100644
--- a/clang/lib/Lex/PPMacroExpansion.cpp
+++ b/clang/lib/Lex/PPMacroExpansion.cpp
@@ -1049,7 +1049,9 @@ static bool HasFeature(const Preprocessor &PP, const IdentifierInfo *II) {
Feature = Feature.substr(2, Feature.size() - 4);
return llvm::StringSwitch<bool>(Feature)
- .Case("address_sanitizer", LangOpts.Sanitize.has(SanitizerKind::Address))
+ .Case("address_sanitizer",
+ LangOpts.Sanitize.hasOneOf(SanitizerKind::Address |
+ SanitizerKind::KernelAddress))
.Case("attribute_analyzer_noreturn", true)
.Case("attribute_availability", true)
.Case("attribute_availability_with_message", true)
OpenPOWER on IntegriCloud