[PATCH] D101048: [dfsan] Fix Len argument type in call to __dfsan_mem_transfer_callback

Elia Geretto via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 22 04:21:52 PDT 2021


EliaGeretto created this revision.
EliaGeretto added reviewers: stephan.yichao.zhao, gbalats.
Herald added a subscriber: hiraditya.
EliaGeretto requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This patch is supposed to solve: https://bugs.llvm.org/show_bug.cgi?id=50075

The function `__dfsan_mem_transfer_callback` takes a `Len` argument of type `i64`; however, when processing a `MemTransferInst` such as `llvm.memcpy.p0i8.p0i8.i32`, the `len` argument has type `i32`. In order to make the type of `len` compatible with the one of the callback argument, this change zero-extends it when necessary.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D101048

Files:
  llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp


Index: llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
===================================================================
--- llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
+++ llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
@@ -2851,7 +2851,8 @@
   }
   if (ClEventCallbacks) {
     IRB.CreateCall(DFSF.DFS.DFSanMemTransferCallbackFn,
-                   {RawDestShadow, I.getLength()});
+                   {RawDestShadow,
+                    IRB.CreateZExtOrTrunc(I.getLength(), DFSF.DFS.IntptrTy)});
   }
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D101048.339552.patch
Type: text/x-patch
Size: 547 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210422/070fc54d/attachment.bin>


More information about the llvm-commits mailing list