Skip to content

Commit e7f7948

Browse files
committed
Revert "[asan] Enable StackSafetyAnalysis by default"
This reverts commit 51fbab1. This causes the compiler to crash. Will file a issue to track the status.
1 parent 3e82663 commit e7f7948

File tree

10 files changed

+19
-26
lines changed

10 files changed

+19
-26
lines changed

compiler-rt/test/asan/TestCases/alloca_vla_interact.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ __attribute__((noinline)) void foo(int len) {
3333
if (i) assert(!__asan_region_is_poisoned(bot, 96));
3434
// VLA is unpoisoned at the end of iteration.
3535
volatile char array[i];
36-
// Ensure that asan-use-stack-safety does not optimize out the poisoning.
37-
if (i) array[0] = 0;
3836
assert(!(reinterpret_cast<uintptr_t>(array) & 31L));
3937
// Alloca is unpoisoned at the end of iteration,
4038
// because dominated by VLA.

compiler-rt/test/asan/TestCases/scariness_score_test.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
// Test how we produce the scariness score.
22

33
// UAR Mode: runtime
4-
// Case 26 loads a __asan_poison_memory_region-poisoned local variable, which is
5-
// only instrumented when StackSafetyAnalysis is disabled.
6-
// RUN: %clangxx_asan -O0 -mllvm -asan-use-stack-safety=0 %s -o %t
4+
// RUN: %clangxx_asan -O0 %s -o %t
75
// On OSX and Windows, alloc_dealloc_mismatch=1 isn't 100% reliable, so it's
86
// off by default. It's safe for these tests, though, so we turn it on.
97
// RUN: export %env_asan_opts=symbolize=0:detect_stack_use_after_return=1:handle_abort=1:print_scariness=1:alloc_dealloc_mismatch=1
@@ -38,7 +36,7 @@
3836
// RUN: not %run %t 27 2>&1 | FileCheck %s --check-prefix=CHECK27
3937
//
4038
// UAR Mode: always
41-
// RUN: %clangxx_asan -O0 %s -o %t -fsanitize-address-use-after-return=always -mllvm -asan-use-stack-safety=0
39+
// RUN: %clangxx_asan -O0 %s -o %t -fsanitize-address-use-after-return=always
4240
// On OSX and Windows, alloc_dealloc_mismatch=1 isn't 100% reliable, so it's
4341
// off by default. It's safe for these tests, though, so we turn it on.
4442
// RUN: export %env_asan_opts=symbolize=0:handle_abort=1:print_scariness=1:alloc_dealloc_mismatch=1

llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ static cl::opt<bool> ClInstrumentWrites(
216216
cl::Hidden, cl::init(true));
217217

218218
static cl::opt<bool>
219-
ClUseStackSafety("asan-use-stack-safety", cl::Hidden, cl::init(true),
219+
ClUseStackSafety("asan-use-stack-safety", cl::Hidden, cl::init(false),
220220
cl::Hidden, cl::desc("Use Stack Safety analysis results"),
221221
cl::Optional);
222222

llvm/test/Instrumentation/AddressSanitizer/asan-stack-safety.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
; REQUIRES: x86-registered-target
22

33
; RUN: opt < %s -S -asan-instrumentation-with-call-threshold=0 -passes=asan -asan-use-stack-safety=0 -o - | FileCheck %s --implicit-check-not="call {{.*}} @__asan_{{load|store|stack}}" --check-prefixes=CHECK,NOSAFETY
4-
; RUN: opt < %s -S -asan-instrumentation-with-call-threshold=0 -passes=asan | FileCheck %s --implicit-check-not="call {{.*}} @__asan_{{load|store|stack}}"
4+
; RUN: opt < %s -S -asan-instrumentation-with-call-threshold=0 -passes=asan -asan-use-stack-safety=1 -o - | FileCheck %s --implicit-check-not="call {{.*}} @__asan_{{load|store|stack}}"
55

66
; CHECK-LABEL: define i32 @load
77
define i32 @load() sanitize_address {

llvm/test/Instrumentation/AddressSanitizer/debug_info.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; RUN: opt < %s -passes=asan -asan-use-after-return=never -asan-use-stack-safety=0 -S | FileCheck %s
1+
; RUN: opt < %s -passes=asan -asan-use-after-return=never -S | FileCheck %s
22

33
; Checks that llvm.dbg.declare instructions are updated
44
; accordingly as we merge allocas.

llvm/test/Instrumentation/AddressSanitizer/lifetime-uar-uas.ll

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,29 +11,26 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3
1111
declare void @llvm.lifetime.start.p0(i64, ptr nocapture) nounwind
1212
declare void @llvm.lifetime.end.p0(i64, ptr nocapture) nounwind
1313

14-
define i32 @basic_test(i64 %i) sanitize_address {
15-
; CHECK-LABEL: define i32 @basic_test(
14+
define i32 @basic_test() sanitize_address {
15+
; CHECK-LABEL: define i32 @basic_test()
1616

1717
entry:
1818
%retval = alloca i32, align 4
19-
%c = alloca [2 x i8], align 1
19+
%c = alloca i8, align 1
2020

2121
; Memory is poisoned in prologue: F1F1F1F104F3F8F2
2222
; CHECK-UAS: store i64 -866676825215864335, ptr %{{[0-9]+}}
23-
; CHECK-UAS-SS-NOT: store i64
2423

2524
call void @llvm.lifetime.start.p0(i64 1, ptr %c)
2625
; Memory is unpoisoned at llvm.lifetime.start: 01
27-
; CHECK-UAS: store i8 2, ptr %{{[0-9]+}}
26+
; CHECK-UAS: store i8 1, ptr %{{[0-9]+}}
2827

29-
%ci = getelementptr inbounds [2 x i8], ptr %c, i64 0, i64 %i
3028
store volatile i32 0, ptr %retval
31-
store volatile i8 0, ptr %ci, align 1
29+
store volatile i8 0, ptr %c, align 1
3230

3331
call void @llvm.lifetime.end.p0(i64 1, ptr %c)
3432
; Memory is poisoned at llvm.lifetime.end: F8
3533
; CHECK-UAS: store i8 -8, ptr %{{[0-9]+}}
36-
; CHECK-UAS-SS-NOT: store i8 -8,
3734

3835
; Unpoison memory at function exit in UAS mode.
3936
; CHECK-UAS: store i64 0, ptr %{{[0-9]+}}

llvm/test/Instrumentation/AddressSanitizer/lifetime.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
; Test handling of llvm.lifetime intrinsics.
2-
; RUN: opt < %s -passes=asan -asan-use-after-scope -asan-use-after-return=never -asan-use-stack-safety=0 -S | FileCheck %s --check-prefixes=CHECK,CHECK-DEFAULT
3-
; RUN: opt < %s -passes=asan -asan-use-after-scope -asan-use-after-return=never -asan-use-stack-safety=0 -asan-instrument-dynamic-allocas=0 -S | FileCheck %s --check-prefixes=CHECK,CHECK-NO-DYNAMIC
2+
; RUN: opt < %s -passes=asan -asan-use-after-scope -asan-use-after-return=never -S | FileCheck %s --check-prefixes=CHECK,CHECK-DEFAULT
3+
; RUN: opt < %s -passes=asan -asan-use-after-scope -asan-use-after-return=never -asan-instrument-dynamic-allocas=0 -S | FileCheck %s --check-prefixes=CHECK,CHECK-NO-DYNAMIC
44

55
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"
66
target triple = "x86_64-unknown-linux-gnu"

llvm/test/Instrumentation/AddressSanitizer/local_stack_base.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; RUN: opt -S -passes=asan -asan-use-stack-safety=0 -asan-skip-promotable-allocas=0 %s -o - | FileCheck %s
1+
; RUN: opt -S -passes=asan -asan-skip-promotable-allocas=0 %s -o - | FileCheck %s
22
; Generated from:
33
; int bar(int y) {
44
; return y + 2;

llvm/test/Instrumentation/AddressSanitizer/stack_dynamic_alloca.ll

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
; RUN: opt < %s -passes=asan -asan-stack-dynamic-alloca -asan-use-stack-safety=0 \
1+
; RUN: opt < %s -passes=asan -asan-stack-dynamic-alloca \
22
; RUN: -asan-use-after-return=runtime -S | FileCheck %s \
33
; RUN: --check-prefixes=CHECK,CHECK-RUNTIME
4-
; RUN: opt < %s -passes=asan -asan-stack-dynamic-alloca -asan-mapping-scale=5 -asan-use-stack-safety=0 \
4+
; RUN: opt < %s -passes=asan -asan-stack-dynamic-alloca -asan-mapping-scale=5 \
55
; RUN: -asan-use-after-return=runtime -S | FileCheck %s \
66
; RUN: --check-prefixes=CHECK,CHECK-RUNTIME
7-
; RUN: opt < %s -passes=asan -asan-stack-dynamic-alloca -asan-use-stack-safety=0 \
7+
; RUN: opt < %s -passes=asan -asan-stack-dynamic-alloca \
88
; RUN: -asan-use-after-return=always -S | FileCheck %s \
99
; RUN: --check-prefixes=CHECK,CHECK-ALWAYS \
1010
; RUN: --implicit-check-not=__asan_option_detect_stack_use_after_return
11-
; RUN: opt < %s -passes=asan -asan-stack-dynamic-alloca -asan-use-stack-safety=0 \
11+
; RUN: opt < %s -passes=asan -asan-stack-dynamic-alloca \
1212
; RUN: -asan-use-after-return=always -S | FileCheck %s \
1313
; RUN: --check-prefixes=CHECK,CHECK-ALWAYS \
1414
; RUN: --implicit-check-not=__asan_option_detect_stack_use_after_return

llvm/test/Instrumentation/AddressSanitizer/stack_layout.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
; Test the ASan's stack layout.
22
; More tests in tests/Transforms/Utils/ASanStackFrameLayoutTest.cpp
3-
; RUN: opt < %s -passes=asan -asan-use-stack-safety=0 -asan-stack-dynamic-alloca=0 -asan-use-after-scope -S \
3+
; RUN: opt < %s -passes=asan -asan-stack-dynamic-alloca=0 -asan-use-after-scope -S \
44
; RUN: | FileCheck %s --check-prefixes=CHECK,CHECK-STATIC
5-
; RUN: opt < %s -passes=asan -asan-use-stack-safety=0 -asan-stack-dynamic-alloca=1 -asan-use-after-scope -S \
5+
; RUN: opt < %s -passes=asan -asan-stack-dynamic-alloca=1 -asan-use-after-scope -S \
66
; RUN: | FileCheck %s --check-prefixes=CHECK,CHECK-DYNAMIC
77

88
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"

0 commit comments

Comments
 (0)