[llvm] [msan] Unpoison indirect outputs for userspace when -msan-handle-asm-conservative is specified (PR #77393)

Florian Mayer via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 19 15:18:25 PST 2024


================
@@ -4557,7 +4561,13 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
       return;
     Value *SizeVal =
       IRB.CreateTypeSize(MS.IntptrTy, DL.getTypeStoreSize(ElemTy));
-    IRB.CreateCall(MS.MsanInstrumentAsmStoreFn, {Operand, SizeVal});
+    if (MS.CompileKernel) {
+      IRB.CreateCall(MS.MsanInstrumentAsmStoreFn, {Operand, SizeVal});
+    } else {
+      auto [ShadowPtr, _] =
+          getShadowOriginPtrUserspace(Operand, IRB, IRB.getInt8Ty(), Align(1));
+      IRB.CreateAlignedStore(getCleanShadow(ElemTy), ShadowPtr, Align(1));
----------------
fmayer wrote:

Can you add this as a comment? This is quite subtle and very likely lost on cursory readers.

https://github.com/llvm/llvm-project/pull/77393


More information about the llvm-commits mailing list