[llvm-commits] [PATCH] AddressSanitizer: handle llvm.lifetime intrinsics (LLVM part)

Alexey Samsonov samsonov at google.com
Wed Nov 28 23:33:25 PST 2012


  Well, steps (1)-(2) is essentially what I do (collecting lifetime intrinsics for static allocas we are interested in), see comment about llvm.lifetime.start inline. Unpoisoning the grand alloca at function end sounds like a good idea.


================
Comment at: lib/Transforms/Instrumentation/AddressSanitizer.cpp:1055
@@ +1054,3 @@
+// (3) if %size is constant, unpoison underlying shadow memory
+//     for llvm.lifetime.start and poison it for llvm.lifetime.end.
+// (4) store the maximal value of %size argument for each %alloca
----------------
Kostya Serebryany wrote:
> Do we actually need to unpoison on llvm.lifetime.start ? 
> Isn't the memory unpoisoned already? 
What about the loops? Two function calls for each local variable for each loop iteration ultimately suck, we need to think of some optimizations here...

================
Comment at: lib/Transforms/Instrumentation/AddressSanitizer.cpp:1057
@@ +1056,3 @@
+// (4) store the maximal value of %size argument for each %alloca
+//     to make sure we unpoison all the poisoned memory at function exit.
+void AddressSanitizer::handleValueLifetime(Value *V, Value *Origin,
----------------
Kostya Serebryany wrote:
> I am still not getting this. 
> Why would any alloca be mentioned in multiple llvm.lifetime.start?
> Does this happen? 
This is allowed, but unlikely. No, I haven't seen such cases.


http://llvm-reviews.chandlerc.com/D140



More information about the llvm-commits mailing list