[PATCH] [ASan] Initial support for Kernel AddressSanitizer

Alexey Samsonov vonosmas at gmail.com
Tue Jun 16 11:07:29 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));
----------------
Um, `asan-kernel`? Looks like most of the flags in this file start with `asan-`, it makes sense to keep it.

================
Comment at: lib/Transforms/Instrumentation/AddressSanitizer.cpp:394
@@ -385,1 +393,3 @@
+      : FunctionPass(ID), CompileKernel(CompileKernel || ClEnableKasan),
+        AsanCtorFunction(NULL), AsanInitFunction(NULL) {
     initializeAddressSanitizerPass(*PassRegistry::getPassRegistry());
----------------
nullptr
You can also consider using brace-or-equal initializer here.

================
Comment at: tools/clang/include/clang/Basic/Sanitizers.h:56
@@ +55,3 @@
+  /// \brief Check if either ASan or KASan is enabled.
+  bool hasAsanOrKasan() const;
+
----------------
glider wrote:
> samsonov wrote:
> > Um, no, I mean to add `hasOneOf` method that would take ArrayRef of sanitizer kinds and return true iff at least one of them is enabled. Then you could call it as...
> This is basically the `has()` method without the `llvm::countPopulation(K) == 1` check.
> Why not use a mask instead of an ArrayRef?
Yeah, using the mask is also ok. But let's make the name different, so that `has()` method would still always accept a single sanitizer.

http://reviews.llvm.org/D10411

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






More information about the cfe-commits mailing list