[PATCH] D15108: [asan] Fix dynamic allocas unpoisoning on PowerPC{64}.
Yury Gribov via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 4 01:22:20 PST 2015
This revision was automatically updated to reflect the committed changes.
Closed by commit rL254707: [asan] Fix dynamic allocas unpoisoning on PowerPC64. (authored by ygribov).
Changed prior to commit:
http://reviews.llvm.org/D15108?vs=41497&id=41847#toc
Repository:
rL LLVM
http://reviews.llvm.org/D15108
Files:
llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp
Index: llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp
===================================================================
--- llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp
+++ llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp
@@ -624,9 +624,24 @@
void unpoisonDynamicAllocasBeforeInst(Instruction *InstBefore,
Value *SavedStack) {
IRBuilder<> IRB(InstBefore);
+ Value *DynamicAreaPtr = IRB.CreatePtrToInt(SavedStack, IntptrTy);
+ // When we insert _asan_allocas_unpoison before @llvm.stackrestore, we
+ // need to adjust extracted SP to compute the address of the most recent
+ // alloca. We have a special @llvm.get.dynamic.area.offset intrinsic for
+ // this purpose.
+ if (!isa<ReturnInst>(InstBefore)) {
+ Function *DynamicAreaOffsetFunc = Intrinsic::getDeclaration(
+ InstBefore->getModule(), Intrinsic::get_dynamic_area_offset,
+ {IntptrTy});
+
+ Value *DynamicAreaOffset = IRB.CreateCall(DynamicAreaOffsetFunc, {});
+
+ DynamicAreaPtr = IRB.CreateAdd(IRB.CreatePtrToInt(SavedStack, IntptrTy),
+ DynamicAreaOffset);
+ }
+
IRB.CreateCall(AsanAllocasUnpoisonFunc,
- {IRB.CreateLoad(DynamicAllocaLayout),
- IRB.CreatePtrToInt(SavedStack, IntptrTy)});
+ {IRB.CreateLoad(DynamicAllocaLayout), DynamicAreaPtr});
}
// Unpoison dynamic allocas redzones.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15108.41847.patch
Type: text/x-patch
Size: 1505 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151204/0a0d0d54/attachment.bin>
More information about the llvm-commits
mailing list