[PATCH] D23708: [asan] Fix size of shadow incorrectly calculated in r279178

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 19 01:41:57 PDT 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL279222: [asan] Fix size of shadow incorrectly calculated in r279178 (authored by vitalybuka).

Changed prior to commit:
  https://reviews.llvm.org/D23708?vs=68658&id=68659#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D23708

Files:
  llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp
  llvm/trunk/test/Instrumentation/AddressSanitizer/stack-poisoning.ll

Index: llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp
===================================================================
--- llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp
+++ llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp
@@ -2237,10 +2237,8 @@
       IRBuilder<> IRBPoison(ThenTerm);
       if (StackMallocIdx <= 4) {
         int ClassSize = kMinStackMallocSize << StackMallocIdx;
-        if ((int)ShadowBytesAfterReturn.size() != ClassSize) {
-          ShadowBytesAfterReturn.resize(ClassSize,
-                                        kAsanStackUseAfterReturnMagic);
-        }
+        ShadowBytesAfterReturn.resize(ClassSize >> Mapping.Scale,
+                                      kAsanStackUseAfterReturnMagic);
         poisonRedZones(ShadowBytesAfterReturn, IRBPoison, ShadowBase, true);
         Value *SavedFlagPtrPtr = IRBPoison.CreateAdd(
             FakeStack,
Index: llvm/trunk/test/Instrumentation/AddressSanitizer/stack-poisoning.ll
===================================================================
--- llvm/trunk/test/Instrumentation/AddressSanitizer/stack-poisoning.ll
+++ llvm/trunk/test/Instrumentation/AddressSanitizer/stack-poisoning.ll
@@ -44,6 +44,7 @@
   ; CHECK-UAR: store i64 -723401728380766731
   ; CHECK-UAR: store i64 -723401728380766731
   ; CHECK-UAR: store i64 -723401728380766731
+  ; CHECK-UAR-NOT: store i64
   ; CHECK-UAR: store i8 0
   ; CHECK-UAR-NOT: store
   ; CHECK-UAR: label


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23708.68659.patch
Type: text/x-patch
Size: 1476 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160819/dbbce4bf/attachment.bin>


More information about the llvm-commits mailing list