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

Matt Morehouse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 11 07:48:05 PST 2020


morehouse added a comment.

Please also update the event_callbacks.c test.



================
Comment at: llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp:173
 //   void __dfsan_load_callback(dfsan_label Label);
 //   void __dfsan_store_callback(dfsan_label Label);
 //   void __dfsan_mem_transfer_callback(dfsan_label *Start, size_t Len);
----------------
Please update this comment.


================
Comment at: llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp:370
+  FunctionType *DFSanLoadCmpCallbackFnTy;
+  FunctionType *DFSanStoreCallbackFnTy;
   FunctionType *DFSanMemTransferCallbackFnTy;
----------------
Rather than diverging loads/stores, can we also add the address to the load callback?


================
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);
----------------
Let's reuse the `Int8Ptr` member variable.


================
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
----------------
The variable numbers in this test seem potentially brittle.  Can we avoid matching against them?


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