[asan] Fix size of shadow incorrectly calculated in r279178

Summary: r279178 generates 8 times more stores than necessary.

Reviewers: eugenis

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D23708

llvm-svn: 279222
This commit is contained in:
Vitaly Buka 2016-08-19 08:33:53 +00:00
parent 6d6310dd4a
commit b81960a6c8
2 changed files with 3 additions and 4 deletions

View File

@ -2237,10 +2237,8 @@ void FunctionStackPoisoner::poisonStack() {
IRBuilder<> IRBPoison(ThenTerm); IRBuilder<> IRBPoison(ThenTerm);
if (StackMallocIdx <= 4) { if (StackMallocIdx <= 4) {
int ClassSize = kMinStackMallocSize << StackMallocIdx; int ClassSize = kMinStackMallocSize << StackMallocIdx;
if ((int)ShadowBytesAfterReturn.size() != ClassSize) { ShadowBytesAfterReturn.resize(ClassSize >> Mapping.Scale,
ShadowBytesAfterReturn.resize(ClassSize,
kAsanStackUseAfterReturnMagic); kAsanStackUseAfterReturnMagic);
}
poisonRedZones(ShadowBytesAfterReturn, IRBPoison, ShadowBase, true); poisonRedZones(ShadowBytesAfterReturn, IRBPoison, ShadowBase, true);
Value *SavedFlagPtrPtr = IRBPoison.CreateAdd( Value *SavedFlagPtrPtr = IRBPoison.CreateAdd(
FakeStack, FakeStack,

View File

@ -44,6 +44,7 @@ entry:
; CHECK-UAR: store i64 -723401728380766731 ; CHECK-UAR: store i64 -723401728380766731
; CHECK-UAR: store i64 -723401728380766731 ; 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: store i8 0
; CHECK-UAR-NOT: store ; CHECK-UAR-NOT: store
; CHECK-UAR: label ; CHECK-UAR: label