[ASan] Initial support for Kernel AddressSanitizer
authorAlexander Potapenko <glider@google.com>
Fri, 19 Jun 2015 12:19:07 +0000 (12:19 +0000)
committerAlexander Potapenko <glider@google.com>
Fri, 19 Jun 2015 12:19:07 +0000 (12:19 +0000)
commitb9b73ef9067371fbe78c34e0f3b23d014413a2f8
tree879cacb4b816acf453a145cdec863e6150070ece
parent284a750c5ff95a29cd8cc9130d3eb7ec6d25e352
[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
17 files changed:
clang/include/clang/Basic/Sanitizers.def
clang/include/clang/Basic/Sanitizers.h
clang/lib/AST/Decl.cpp
clang/lib/Basic/Sanitizers.cpp
clang/lib/CodeGen/BackendUtil.cpp
clang/lib/CodeGen/CGDeclCXX.cpp
clang/lib/CodeGen/CodeGenFunction.cpp
clang/lib/CodeGen/CodeGenModule.cpp
clang/lib/CodeGen/SanitizerMetadata.cpp
clang/lib/Driver/SanitizerArgs.cpp
clang/lib/Lex/PPMacroExpansion.cpp
clang/test/CodeGen/address-safety-attr-kasan.cpp [new file with mode: 0644]
clang/test/Driver/asan.c
clang/test/Driver/fsanitize.c
clang/test/Lexer/has_feature_address_sanitizer.cpp
llvm/include/llvm/Transforms/Instrumentation.h
llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp