[PATCH] D21202: Unpoison stack memory in use-after-return + use-after-scope mode
Kostya Serebryany via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 9 15:18:38 PDT 2016
kcc accepted this revision.
kcc added a comment.
This revision is now accepted and ready to land.
LGTM
================
Comment at: lib/Transforms/Instrumentation/AddressSanitizer.cpp:2183-2195
@@ -2179,9 +2182,15 @@
IRBuilder<> IRBElse(ElseTerm);
- poisonRedZones(L.ShadowBytes, IRBElse, ShadowBase, false);
+ if (HavePoisonedAllocas) {
+ // If we fallback to static alloca at runtime, we still need to
+ // unpoison allocas poisoned for llvm.lifetime analysis.
+ poisonAlloca(LocalStackBase, LocalStackSize, IRBElse, false);
+ } else {
+ poisonRedZones(L.ShadowBytes, IRBElse, ShadowBase, false);
+ }
} else if (HavePoisonedAllocas) {
// If we poisoned some allocas in llvm.lifetime analysis,
// unpoison whole stack frame now.
poisonAlloca(LocalStackBase, LocalStackSize, IRBRet, false);
} else {
poisonRedZones(L.ShadowBytes, IRBRet, ShadowBase, false);
}
----------------
we have a bit of code duplication here. Up to you if you want to eliminate it or keep it as is.
http://reviews.llvm.org/D21202
More information about the llvm-commits
mailing list