[PATCH] D77182: [AddressSanitizer] Fix for wrong argument values appearing in backtraces

Vedant Kumar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 1 12:22:36 PDT 2020


vsk planned changes to this revision.
vsk marked an inline comment as done.
vsk added inline comments.


================
Comment at: llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp:3023
+      InitInsts.push_back(cast<Instruction>(Val));
+    InitInsts.push_back(Store);
+  }
----------------
eugenis wrote:
> What happens with
> 
> ```
> a = alloca
> store arg, a
> load a
> store arg2, a
> ```
> will the second store be moved across the aliasing load?
> 
Yes, thanks for catching this.

I plan to address this by stopping the loop when an unknown instruction is seen. I.e., make it bail out if "I" is not a StoreInst or a CastInst that matches the known argument init cases. Does that sound ok?

Another more expensive/general option is to use the `isSafeToMoveBefore` utility from CodeMoverUtils (this requires DependenceInfo, DomTree, and PostDomTree).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77182





More information about the llvm-commits mailing list