[PATCH] D91236: Extend the dfsan store/load callback with write/read address

Matt Morehouse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 12 06:15:22 PST 2020


morehouse added inline comments.


================
Comment at: llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp:173
+//   void __dfsan_load_callback(dfsan_label Label, const char* addr);
+//   void __dfsan_store_callback(dfsan_label Label, const char* addr);
 //   void __dfsan_mem_transfer_callback(dfsan_label *Start, size_t Len);
----------------
Should it be `const void*` instead?


================
Comment at: llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp:1480
     IRBuilder<> IRB(&SI);
-    IRB.CreateCall(DFSF.DFS.DFSanStoreCallbackFn, Shadow);
+    Type *Int8Ptr = Type::getInt8PtrTy(*DFSF.DFS.Ctx);
+    Value *Addr8 = IRB.CreateBitCast(SI.getPointerOperand(), Int8Ptr);
----------------
stephan.yichao.zhao wrote:
> morehouse wrote:
> > Let's reuse the `Int8Ptr` member variable.
> That one is defined in DataFlowSanitizer.
Yes let's use it.


================
Comment at: llvm/test/Instrumentation/DataFlowSanitizer/callback.ll:6
+define i8 @load8(i8* %p) {
+  ; CHECK: call void @__dfsan_load_callback(i16 %11)
+  ; CHECK: %a = load i8, i8* %p
----------------
morehouse wrote:
> The variable numbers in this test seem potentially brittle.  Can we avoid matching against them?
All the other ones too.  Look at the other tests in this directory.  They avoid specifying variable numbers since those can easily change.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D91236



More information about the llvm-commits mailing list