[PATCH] D83337: [MSAN] Instrument libatomic load/store calls

Evgenii Stepanov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 7 14:55:08 PDT 2020


eugenis added inline comments.


================
Comment at: compiler-rt/test/msan/libatomic.c:37
+#endif
+}
----------------
guiand wrote:
> One thing that turned out a little strange is that because I have to insert instructions *after* the atomic load, including the origin update, the msan reporter decides that the origin is one line below the call. Is there anything I can do about this?
use SetCurrentDebugLocation on the builder


================
Comment at: llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp:3550
+        getShadowOriginPtr(DstPtr, NextIRB, NextIRB.getInt8Ty(), AlignOne,
+                           /*isStore*/ false)
+            .first;
----------------
I think isStore needs to be true here.


================
Comment at: llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp:3554
+    NextIRB.CreateMemCpy(DstShadowPtr, AlignOne, SrcShadowOriginPair.first,
+                         AlignOne, Size);
+    if (MS.TrackOrigins) {
----------------
How about we do the same thing that happens to memcpy() calls in the user code, i.e. emit a call to __msan_memcpy?
It will take care of everything.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D83337/new/

https://reviews.llvm.org/D83337





More information about the llvm-commits mailing list