[PATCH] D55119: [KMSAN] Enable -msan-handle-asm-conservative by default

Alexander Potapenko via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 30 04:27:37 PST 2018


glider created this revision.
glider added reviewers: dvyukov, eugenis.
Herald added a subscriber: llvm-commits.

This change enables conservative assembly instrumentation in KMSAN builds by default.
It's still possible to disable it with -msan-handle-asm-conservative=0 if something breaks.
It's now impossible to enable conservative instrumentation for userspace builds, but it's not used anyway.


Repository:
  rL LLVM

https://reviews.llvm.org/D55119

Files:
  lib/Transforms/Instrumentation/MemorySanitizer.cpp


Index: lib/Transforms/Instrumentation/MemorySanitizer.cpp
===================================================================
--- lib/Transforms/Instrumentation/MemorySanitizer.cpp
+++ lib/Transforms/Instrumentation/MemorySanitizer.cpp
@@ -255,10 +255,13 @@
 // passed into an assembly call. Note that this may cause false positives.
 // Because it's impossible to figure out the array sizes, we can only unpoison
 // the first sizeof(type) bytes for each type* pointer.
+// The instrumentation is only enabled in KMSAN builds, and only if
+// -msan-handle-asm-conservative is on. This is done because we may want to
+// quickly disable assembly instrumentation when it breaks.
 static cl::opt<bool> ClHandleAsmConservative(
     "msan-handle-asm-conservative",
     cl::desc("conservative handling of inline assembly"), cl::Hidden,
-    cl::init(false));
+    cl::init(true));
 
 // This flag controls whether we check the shadow of the address
 // operand of load or store. Such bugs are very rare, since load from
@@ -3118,7 +3121,7 @@
       // outputs as clean. Note that any side effects of the inline asm that are
       // not immediately visible in its constraints are not handled.
       if (Call->isInlineAsm()) {
-        if (ClHandleAsmConservative)
+        if (ClHandleAsmConservative && MS.CompileKernel)
           visitAsmInstruction(I);
         else
           visitInstruction(I);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55119.176089.patch
Type: text/x-patch
Size: 1402 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181130/926164f4/attachment.bin>


More information about the llvm-commits mailing list