[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:29 PDT 2016
vitalybuka created this revision.
vitalybuka added a reviewer: eugenis.
vitalybuka added a subscriber: llvm-commits.
r279178 generates 8 times more stores than necessary.
https://reviews.llvm.org/D23708
Files:
lib/Transforms/Instrumentation/AddressSanitizer.cpp
test/Instrumentation/AddressSanitizer/stack-poisoning.ll
Index: test/Instrumentation/AddressSanitizer/stack-poisoning.ll
===================================================================
--- test/Instrumentation/AddressSanitizer/stack-poisoning.ll
+++ 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
Index: lib/Transforms/Instrumentation/AddressSanitizer.cpp
===================================================================
--- lib/Transforms/Instrumentation/AddressSanitizer.cpp
+++ 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,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23708.68658.patch
Type: text/x-patch
Size: 1410 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160819/6facf668/attachment.bin>
More information about the llvm-commits
mailing list