[PATCH] D105201: [hwasan] Detect use after scope within function.

Evgenii Stepanov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 22 12:45:18 PDT 2021


eugenis added a comment.

Yes a couple an IR test would be great. It does not need to cover the analysis logic, that is done separately, just the fact that a "safe" alloca is not tagged.



================
Comment at: llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp:1476
+      if (LocalDT == nullptr) {
+        DeleteDT = std::make_unique<DominatorTree>(F);
+        LocalDT = DeleteDT.get();
----------------
vitalybuka wrote:
> fmayer wrote:
> > vitalybuka wrote:
> > > why we need these empty Trees?
> > They aren't empty, they are constructed from the function.
> > 
> > We need the unique_ptrs because sometimes we borrow the LocalDT from the passmanager, and sometimes we construct it ourselves, in which case we need to destruct it again.
> I think it's very unusuall, you should get if from pass manager with getAnalysis<DominatorTreeWrapperPass>() 
> and addRequired or getResult<DominatorTreeAnalysis>
> @eugenis ?
This is a copy of the code from AArch64StackTagging. The idea is to implement on-demand function analysis in the old pass manager so that, in the common case when none of the functions in a module have a sanitize_* attribute, the analysis is not run.

We get the analysis from the passmanager if it is available, otherwise we run one locally and then destroy it with unique_ptr.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105201



More information about the llvm-commits mailing list