[PATCH] D12704: [ASan] Don't instrument promotable dynamic allocas.

Maxim Ostapenko via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 10 09:01:29 PDT 2015


m.ostepenko added a comment.

Thanks for fixing this! Just one question below.


================
Comment at: lib/Transforms/Instrumentation/AddressSanitizer.cpp:1800
@@ -1792,1 +1799,3 @@
+  }
+
   if (ClInstrumentAllocas && DynamicAllocaVec.size() > 0) {
----------------
> lifetime intrinsics may refer to dynamic allocas, so we need to emit instrumentation before these dynamic allocas would be replaced.

Well, if we instrument dynamic alloca related to some lifetime intrinsic first time and instrument it in handleDynamicAllocaCall() second time, we may end up with redzones would be mixed, right? Anyway, looking to poisonAlloca(...) function:
```
void FunctionStackPoisoner::poisonAlloca(Value *V, uint64_t Size,
                                         IRBuilder<> &IRB, bool DoPoison) {
  // For now just insert the call to ASan runtime.
  Value *AddrArg = IRB.CreatePointerCast(V, IntptrTy);
  Value *SizeArg = ConstantInt::get(IntptrTy, Size);
  IRB.CreateCall(
      DoPoison ? AsanPoisonStackMemoryFunc : AsanUnpoisonStackMemoryFunc,
      {AddrArg, SizeArg});
}
```
Size parameter is uint64_t, so it seems we can poison static allocas only.

So, I'm wondering, is that the case?


http://reviews.llvm.org/D12704





More information about the llvm-commits mailing list