From 1354d58f56a3468970a0a7c62260b874deb503da Mon Sep 17 00:00:00 2001 From: Vitaly Buka Date: Fri, 16 Sep 2016 01:38:43 +0000 Subject: [PATCH] Revert "[asan] Add flag to allow lifetime analysis of problematic allocas" This approach is not good enough. Working on the new solution. This reverts commit r281126. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281688 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../Instrumentation/AddressSanitizer.cpp | 6 ------ test/Instrumentation/AddressSanitizer/lifetime.ll | 15 ++++++--------- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/lib/Transforms/Instrumentation/AddressSanitizer.cpp b/lib/Transforms/Instrumentation/AddressSanitizer.cpp index e86fa8beeb9..729dc7c5567 100644 --- a/lib/Transforms/Instrumentation/AddressSanitizer.cpp +++ b/lib/Transforms/Instrumentation/AddressSanitizer.cpp @@ -183,10 +183,6 @@ static cl::opt ClExperimentalPoisoning( "asan-experimental-poisoning", cl::desc("Enable experimental red zones and scope poisoning"), cl::Hidden, cl::init(true)); -static cl::opt ClSkipAmbiguousLifetimeAllocas( - "asan-skip-ambiguous-lifetime-allocas", - cl::desc("Disabled lifetime check for allocas with ambiguous lifetime"), - cl::Hidden, cl::init(true)); // This flag may need to be replaced with -f[no]asan-globals. static cl::opt ClGlobals("asan-globals", cl::desc("Handle global objects"), cl::Hidden, @@ -894,8 +890,6 @@ public: // This is workaround for PR28267. void removeAllocasWithAmbiguousLifetime( SmallVectorImpl &PoisonCallVec) { - if (!ClSkipAmbiguousLifetimeAllocas) - return; DenseMap Checkers; for (const auto &APC : PoisonCallVec) Checkers[APC.AI].AddMarker(APC.InsBefore->getParent(), !APC.DoPoison); diff --git a/test/Instrumentation/AddressSanitizer/lifetime.ll b/test/Instrumentation/AddressSanitizer/lifetime.ll index b0c2b4c924b..9cf019aa6cc 100644 --- a/test/Instrumentation/AddressSanitizer/lifetime.ll +++ b/test/Instrumentation/AddressSanitizer/lifetime.ll @@ -1,7 +1,6 @@ ; Test handling of llvm.lifetime intrinsics. -; RUN: opt < %s -asan -asan-module -asan-use-after-scope -asan-use-after-return=0 -S | FileCheck %s --check-prefixes=CHECK,CHECK-DEFAULT -; RUN: opt < %s -asan -asan-module -asan-use-after-scope -asan-use-after-return=0 -asan-instrument-dynamic-allocas=0 -S | FileCheck %s --check-prefixes=CHECK,CHECK-NO-DYNAMIC -; RUN: opt < %s -asan -asan-module -asan-use-after-scope -asan-use-after-return=0 -asan-skip-ambiguous-lifetime-allocas=0 -S | FileCheck %s --check-prefixes=CHECK,CHECK-AMBIGUOUS +; RUN: opt < %s -asan -asan-module -asan-use-after-scope -asan-use-after-return=0 -S | FileCheck %s +; RUN: opt < %s -asan -asan-module -asan-use-after-scope -asan-use-after-return=0 -asan-instrument-dynamic-allocas=0 -S | FileCheck %s --check-prefix=CHECK-NO-DYNAMIC target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" @@ -70,14 +69,14 @@ define void @lifetime() sanitize_address { %arr.ptr = bitcast [10 x i32]* %arr to i8* call void @llvm.lifetime.start(i64 40, i8* %arr.ptr) - ; CHECK-DEFAULT: call void @__asan_unpoison_stack_memory(i64 %{{[^ ]+}}, i64 40) + ; CHECK: call void @__asan_unpoison_stack_memory(i64 %{{[^ ]+}}, i64 40) ; CHECK-NO-DYNAMIC-NOT: call void @__asan_unpoison_stack_memory(i64 %{{[^ ]+}}, i64 40) store volatile i8 0, i8* %arr.ptr ; CHECK: store volatile call void @llvm.lifetime.end(i64 40, i8* %arr.ptr) - ; CHECK-DEFAULT: call void @__asan_poison_stack_memory(i64 %{{[^ ]+}}, i64 40) + ; CHECK: call void @__asan_poison_stack_memory(i64 %{{[^ ]+}}, i64 40) ; CHECK-NO-DYNAMIC-NOT: call void @__asan_poison_stack_memory(i64 %{{[^ ]+}}, i64 40) ; One more lifetime start/end for the same variable %i. @@ -117,8 +116,7 @@ bb0: ; CHECK-LABEL: bb0: call void @llvm.lifetime.start(i64 1, i8* %j) - ; CHECK-DEFAULT-NOT: store i8 1, i8* %{{[0-9]+}} - ; CHECK-AMBIGUOUS: store i8 1, i8* %{{[0-9]+}} + ; CHECK-NOT: store i8 1, i8* %{{[0-9]+}} ; CHECK-NEXT: call void @llvm.lifetime.start br label %bb1 @@ -134,8 +132,7 @@ bb1: ; CHECK-NEXT: call void @llvm.lifetime.end call void @llvm.lifetime.end(i64 1, i8* %j) - ; CHECK-DEFAULT-NOT: store i8 -8, i8* %{{[0-9]+}} - ; CHECK-AMBIGUOUS: store i8 -8, i8* %{{[0-9]+}} + ; CHECK-NOT: store i8 -8, i8* %{{[0-9]+}} ; CHECK-NEXT: call void @llvm.lifetime.end ret void -- 2.50.1