-
Notifications
You must be signed in to change notification settings - Fork 11.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[asan] Suppress duplicated errors in ASan recovery mode.
Patch by Max Ostapenko. Differential Revision: http://reviews.llvm.org/D15080 llvm-svn: 255228
- Loading branch information
Yury Gribov
committed
Dec 10, 2015
1 parent
a3c0e8e
commit 6bfade1
Showing
5 changed files
with
83 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
compiler-rt/test/asan/TestCases/halt_on_error_suppress_equal_pcs.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// Test reports dedupication for recovery mode. | ||
// | ||
// RUN: %clang_asan -fsanitize-recover=address %s -o %t | ||
// | ||
// Check for reports dedupication. | ||
// RUN: %env_asan_opts=halt_on_error=false %run %t 2>&1 | FileCheck %s | ||
// | ||
// Check that we die after reaching different reports number threshold. | ||
// RUN: %env_asan_opts=halt_on_error=false not %run %t 1 > %t1.log 2>&1 | ||
// RUN: [ $(grep -c 'ERROR: AddressSanitizer: stack-buffer-overflow' %t1.log) -eq 25 ] | ||
// | ||
// Check suppress_equal_pcs=true behavior is equal to default one. | ||
// RUN: %env_asan_opts=halt_on_error=false:suppress_equal_pcs=true %run %t 2>&1 | FileCheck %s | ||
// | ||
// Check suppress_equal_pcs=false behavior isn't equal to default one. | ||
// RUN: %env_asan_opts=halt_on_error=false:suppress_equal_pcs=false %run %t > %t2.log 2>&1 | ||
// RUN: [ $(grep -c 'ERROR: AddressSanitizer: stack-buffer-overflow' %t2.log) -eq 30 ] | ||
|
||
#define ACCESS_ARRAY_FIVE_ELEMENTS(array, i) \ | ||
array[i] = i; \ | ||
array[i + 1] = i + 1; \ | ||
array[i + 2] = i + 2; \ | ||
array[i + 3] = i + 3; \ | ||
array[i + 4] = i + 4; \ | ||
|
||
volatile int ten = 10; | ||
unsigned kNumIterations = 10; | ||
|
||
int main(int argc, char **argv) { | ||
char a[10]; | ||
char b[10]; | ||
|
||
if (argc == 1) { | ||
for (int i = 0; i < kNumIterations; ++i) { | ||
// CHECK: READ of size 1 | ||
volatile int res = a[ten + i]; | ||
// CHECK: WRITE of size 1 | ||
a[i + ten] = res + 3; | ||
// CHECK: READ of size 1 | ||
res = a[ten + i]; | ||
// CHECK-NOT: ERROR | ||
} | ||
} else { | ||
for (int i = 0; i < kNumIterations; ++i) { | ||
ACCESS_ARRAY_FIVE_ELEMENTS(a, ten); | ||
ACCESS_ARRAY_FIVE_ELEMENTS(a, ten + 5); | ||
ACCESS_ARRAY_FIVE_ELEMENTS(a, ten + 10); | ||
ACCESS_ARRAY_FIVE_ELEMENTS(b, ten); | ||
ACCESS_ARRAY_FIVE_ELEMENTS(b, ten + 5); | ||
ACCESS_ARRAY_FIVE_ELEMENTS(b, ten + 10); | ||
} | ||
} | ||
return 0; | ||
} | ||
|