[llvm] r278818 - [Asan] Unpoison red zones even if use-after-scope was disabled with runtime flag
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 16 09:24:10 PDT 2016
Author: vitalybuka
Date: Tue Aug 16 11:24:10 2016
New Revision: 278818
URL: http://llvm.org/viewvc/llvm-project?rev=278818&view=rev
Log:
[Asan] Unpoison red zones even if use-after-scope was disabled with runtime flag
Summary: PR27453
Reviewers: eugenis
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D23481
Modified:
llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp
llvm/trunk/test/Instrumentation/AddressSanitizer/lifetime-uar-uas.ll
llvm/trunk/test/Instrumentation/AddressSanitizer/lifetime.ll
Modified: llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp?rev=278818&r1=278817&r2=278818&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp (original)
+++ llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp Tue Aug 16 11:24:10 2016
@@ -2186,12 +2186,13 @@ void FunctionStackPoisoner::poisonStack(
poisonRedZones(L.ShadowBytes, IRB, ShadowBase, true);
auto UnpoisonStack = [&](IRBuilder<> &IRB) {
+ // Do this always as poisonAlloca can be disabled with
+ // detect_stack_use_after_scope=0.
+ poisonRedZones(L.ShadowBytes, IRB, ShadowBase, false);
if (HavePoisonedStaticAllocas) {
// If we poisoned some allocas in llvm.lifetime analysis,
// unpoison whole stack frame now.
poisonAlloca(LocalStackBase, LocalStackSize, IRB, false);
- } else {
- poisonRedZones(L.ShadowBytes, IRB, ShadowBase, false);
}
};
Modified: llvm/trunk/test/Instrumentation/AddressSanitizer/lifetime-uar-uas.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/AddressSanitizer/lifetime-uar-uas.ll?rev=278818&r1=278817&r2=278818&view=diff
==============================================================================
--- llvm/trunk/test/Instrumentation/AddressSanitizer/lifetime-uar-uas.ll (original)
+++ llvm/trunk/test/Instrumentation/AddressSanitizer/lifetime-uar-uas.ll Tue Aug 16 11:24:10 2016
@@ -28,9 +28,9 @@ entry:
; CHECK-UAS: call void @__asan_poison_stack_memory(i64 %{{[^ ]+}}, i64 1)
; Unpoison memory at function exit in UAS mode.
- ; CHECK-UAS: call void @__asan_unpoison_stack_memory(i64 %{{[^ ]+}}, i64 64)
- ; CHECK-UAS: ret void
-
+ ; CHECK-UAS: store i64 0
+ ; CHECK-UAS-NEXT: call void @__asan_unpoison_stack_memory(i64 %{{[^ ]+}}, i64 64)
+ ; CHECK-UAS: ret i32 0
ret i32 0
}
Modified: llvm/trunk/test/Instrumentation/AddressSanitizer/lifetime.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/AddressSanitizer/lifetime.ll?rev=278818&r1=278817&r2=278818&view=diff
==============================================================================
--- llvm/trunk/test/Instrumentation/AddressSanitizer/lifetime.ll (original)
+++ llvm/trunk/test/Instrumentation/AddressSanitizer/lifetime.ll Tue Aug 16 11:24:10 2016
@@ -108,7 +108,11 @@ entry:
; CHECK: __asan_poison_stack_memory
ret void
- ; CHECK: __asan_unpoison_stack_memory
+ ; CHECK: store i64 0
+ ; CHECK: store i64 0
+ ; CHECK: store i64 0
+ ; CHECK: store i32 0
+ ; CHECK-NEXT: __asan_unpoison_stack_memory
}
define void @zero_sized(i64 %a) #0 {
More information about the llvm-commits
mailing list