[PATCH] Implement variable-sized alloca instrumentation.

Kostya Serebryany kcc at google.com
Thu Nov 6 14:11:25 PST 2014


================
Comment at: lib/Transforms/Instrumentation/AddressSanitizer.cpp:547
@@ +546,3 @@
+
+  void handleDynamicAllocaCall(AllocaInst *AI) {
+    IRBuilder<> IRBefore(AI);
----------------
ygribov wrote:
> kcc wrote:
> > This will not create a left red zone, right? 
> > And even if it will (due to alignment) it will not poison it. 
> > 
> > I would prefer to create both left and right redzones and [un]poison them inline with one 4-byte store for the left rz and one or two 4-byte stores for the right one. 
> > Make sure to make the new size 0 mod 32
> > 
> > 
> I think Max's idea was to create thricely left, right and partial. As for inlining, it would be a mess for partial redzone - it's size is unknown until runtime so we won't be able to use 4-byte stores and will have to use an ugly loop instead.
A loop? Come on, I am sure you can construct the appropriate 32-bit constant to poison the partial 32-byte zon just using arithmetic (masks and shifts)

http://reviews.llvm.org/D6055






More information about the llvm-commits mailing list