[PATCH] [ASan] Initial support for Kernel AddressSanitizer

Alexander Potapenko glider at google.com
Fri Jun 19 02:46:31 PDT 2015


================
Comment at: lib/Transforms/Instrumentation/AddressSanitizer.cpp:1387
@@ -1370,1 +1386,3 @@
+      // TODO(glider): add _noabort to error reporting functions, make them
+      // actually noabort.
       AsanErrorCallbackSized[AccessIsWrite][Exp] =
----------------
ygribov wrote:
> Do you mean to add noabort variants to compiler-rt? That would be nice, especially if you could add -fsanitize-recover to enable those in userspace as well.
No, I meant just emitting _noabort calls under KASan. I've updated the comment to reflect that.
-fsanitize-recover is kind of orthogonal to this patch.

================
Comment at: tools/clang/lib/AST/Decl.cpp:3684
@@ -3683,2 +3683,3 @@
   ASTContext &Context = getASTContext();
-  if (!Context.getLangOpts().Sanitize.has(SanitizerKind::Address) ||
+  if (!(Context.getLangOpts().Sanitize.hasOneOf(
+          SanitizerKind::Address | SanitizerKind::KernelAddress)) ||
----------------
samsonov wrote:
> remove extra parens around `hasOneOf` call
Indeed.

================
Comment at: tools/clang/test/CodeGen/address-safety-attr-kasan.cpp:10
@@ +9,3 @@
+}
+// CHECK-NOASAN: [[Function Attrs: nounwind$]]
+// CHECK-ASAN: Function Attrs: nounwind sanitize_address
----------------
samsonov wrote:
> Please check this syntax. I thought that [[]] is used to define FileCheck variables, while {{}} are used for regular expressions.
Yeah, that's right.

================
Comment at: tools/clang/test/Driver/asan.c:1
@@ -1,5 +1,2 @@
-// RUN: %clang     -target i386-unknown-unknown -fsanitize=address %s -S -emit-llvm -o - | FileCheck %s
-// RUN: %clang -O1 -target i386-unknown-unknown -fsanitize=address %s -S -emit-llvm -o - | FileCheck %s
-// RUN: %clang -O2 -target i386-unknown-unknown -fsanitize=address %s -S -emit-llvm -o - | FileCheck %s
-// RUN: %clang -O3 -target i386-unknown-unknown -fsanitize=address %s -S -emit-llvm -o - | FileCheck %s
-// Verify that -fsanitize=address invokes asan instrumentation.
+// RUN: %clang     -target i386-unknown-unknown -fsanitize=address %s -S -emit-llvm -o - | FileCheck %s --check-prefix=CHECK-ASAN
+// RUN: %clang -O1 -target i386-unknown-unknown -fsanitize=address %s -S -emit-llvm -o - | FileCheck %s --check-prefix=CHECK-ASAN
----------------
samsonov wrote:
> while you're here, please add linux to original RUN-lines as well.
Done

http://reviews.llvm.org/D10411

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






More information about the llvm-commits mailing list