[PATCH] D105201: [hwasan] Detect use after scope within function.
Florian Mayer via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 16 02:22:07 PDT 2021
fmayer added inline comments.
================
Comment at: llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp:1286-1291
bool HWAddressSanitizer::instrumentStack(
- SmallVectorImpl<AllocaInst *> &Allocas,
+ MapVector<AllocaInst *, AllocaInfo> &AllocasToInstrument,
+ SmallVector<Instruction *, 4> &UnrecognizedLifetimes,
DenseMap<AllocaInst *, std::vector<DbgVariableIntrinsic *>> &AllocaDbgMap,
- SmallVectorImpl<Instruction *> &RetVec, Value *StackTag) {
+ SmallVectorImpl<Instruction *> &RetVec, Value *StackTag, DominatorTree *DT,
+ PostDominatorTree *PDT) {
----------------
vitalybuka wrote:
> only if you wish to that later, but it would be nice to refactor HWAddressSanitizer into module and function classes
> so we can have all these arguments as member of function one
>
>
Will keep in mind.
================
Comment at: llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp:1350
+ }
+ if (!StandardLifetime) {
+ for (auto &II : Info.LifetimeStart)
----------------
eugenis wrote:
> vitalybuka wrote:
> > can we avoid removing them? it can break other optimizations.
> > I guess the goal is to avoid them in tagLifetimeEnd, but recalculating them in StandardLifetime there is cheap.
> We can't. Tagging before/after lifetime is UB - consider that this memory may be reused for another alloca with different tag value.
Yes, like eugenis said, this is fixing a bug that we would potentially use the alloca outside of its lifetime.
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