[PATCH] [ASan] Initial support for Kernel AddressSanitizer

Alexander Potapenko glider at google.com
Wed Jun 17 11:38:40 PDT 2015


================
Comment at: lib/Transforms/Instrumentation/AddressSanitizer.cpp:120
@@ +119,3 @@
+static cl::opt<bool> ClEnableKasan(
+    "enable-kasan", cl::desc("Enable KernelAddressSanitizer instrumentation"),
+    cl::Hidden, cl::init(false));
----------------
samsonov wrote:
> Um, `asan-kernel`? Looks like most of the flags in this file start with `asan-`, it makes sense to keep it.
Done

================
Comment at: lib/Transforms/Instrumentation/AddressSanitizer.cpp:394
@@ -385,1 +393,3 @@
+      : FunctionPass(ID), CompileKernel(CompileKernel || ClEnableKasan),
+        AsanCtorFunction(NULL), AsanInitFunction(NULL) {
     initializeAddressSanitizerPass(*PassRegistry::getPassRegistry());
----------------
samsonov wrote:
> nullptr
> You can also consider using brace-or-equal initializer here.
Added them for the ctor/init functions. What's the policy regarding those in the code?

================
Comment at: lib/Transforms/Instrumentation/AddressSanitizer.cpp:1384
@@ -1369,1 +1383,3 @@
+      const std::string SuffixStr = CompileKernel ? "N" : "_n";
+      const std::string EndingStr = CompileKernel ? "_noabort" : "";
       const Type *ExpType = Exp ? Type::getInt32Ty(*C) : nullptr;
----------------
dvyukov wrote:
> we also need to make them actually noabort
Removed the noabort suffixes for error reporting functions.
Per patch description, only out-of-line instrumentation is supported anyway.

================
Comment at: tools/clang/test/Driver/kasan.c:1
@@ +1,2 @@
+// RUN: %clang     -target i386-unknown-unknown -fsanitize=kernel-address %s -S -emit-llvm -o - | FileCheck %s
+// RUN: %clang -O1 -target i386-unknown-unknown -fsanitize=kernel-address %s -S -emit-llvm -o - | FileCheck %s
----------------
samsonov wrote:
> Please use linux as a target (http://reviews.llvm.org/D10467). You can also merge it into asan.c to keep a single test case (I'm fine either way).
Done, united the tests.

http://reviews.llvm.org/D10411

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the cfe-commits mailing list