summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2014-12-03 00:08:41 +0000
committerKostya Serebryany <kcc@google.com>2014-12-03 00:08:41 +0000
commitc93c84e882d763584ce4c8d911db50f2a0eacb9b (patch)
tree9784b133faab3f29a4ae363fa1f3ba40bf5ffe08
parent4a8ac260cc6f810718fed8f7ed37632807f56c42 (diff)
downloadbcm5719-llvm-c93c84e882d763584ce4c8d911db50f2a0eacb9b.tar.gz
bcm5719-llvm-c93c84e882d763584ce4c8d911db50f2a0eacb9b.zip
[asan] fix four asan tests to run in use-after-return mode
llvm-svn: 223181
-rw-r--r--compiler-rt/test/asan/TestCases/contiguous_container.cc4
-rw-r--r--compiler-rt/test/asan/TestCases/longjmp.cc4
-rw-r--r--compiler-rt/test/asan/TestCases/stack-overflow.cc4
-rw-r--r--compiler-rt/test/asan/TestCases/throw_catch.cc8
4 files changed, 15 insertions, 5 deletions
diff --git a/compiler-rt/test/asan/TestCases/contiguous_container.cc b/compiler-rt/test/asan/TestCases/contiguous_container.cc
index 8d8c8d04914..0f3a7db5b06 100644
--- a/compiler-rt/test/asan/TestCases/contiguous_container.cc
+++ b/compiler-rt/test/asan/TestCases/contiguous_container.cc
@@ -59,7 +59,9 @@ void TestThrow() {
assert(!__asan_address_is_poisoned(x + 13));
// FIXME: invert the assertion below once we fix
// https://code.google.com/p/address-sanitizer/issues/detail?id=258
- assert(!__asan_address_is_poisoned(x + 14));
+ // This assertion works only w/o UAR.
+ if (!__asan_get_current_fake_stack())
+ assert(!__asan_address_is_poisoned(x + 14));
__sanitizer_annotate_contiguous_container(x, x + 32, x + 14, x + 32);
assert(!__asan_address_is_poisoned(x + 13));
assert(!__asan_address_is_poisoned(x + 14));
diff --git a/compiler-rt/test/asan/TestCases/longjmp.cc b/compiler-rt/test/asan/TestCases/longjmp.cc
index 5472330683b..8e9f2ae195c 100644
--- a/compiler-rt/test/asan/TestCases/longjmp.cc
+++ b/compiler-rt/test/asan/TestCases/longjmp.cc
@@ -19,5 +19,7 @@ int main() {
__asan_address_is_poisoned(x + 32));
// FIXME: Invert this assertion once we fix
// https://code.google.com/p/address-sanitizer/issues/detail?id=258
- assert(!__asan_address_is_poisoned(x + 32));
+ // This assertion works only w/o UAR.
+ if (!__asan_get_current_fake_stack())
+ assert(!__asan_address_is_poisoned(x + 32));
}
diff --git a/compiler-rt/test/asan/TestCases/stack-overflow.cc b/compiler-rt/test/asan/TestCases/stack-overflow.cc
index 9d7c72c9c8a..7542d56b6db 100644
--- a/compiler-rt/test/asan/TestCases/stack-overflow.cc
+++ b/compiler-rt/test/asan/TestCases/stack-overflow.cc
@@ -22,6 +22,7 @@
#include <unistd.h>
#include <sys/time.h>
#include <sys/resource.h>
+#include <sanitizer/asan_interface.h>
const int BS = 1024;
volatile char x;
@@ -65,7 +66,8 @@ void recursive_func(char *p) {
z13 = t13;
#else
char buf[BS];
- if (p)
+ // Check that the stack grows in the righ direction, unless we use fake stack.
+ if (p && !__asan_get_current_fake_stack())
assert(p - buf >= BS);
buf[rand() % BS] = 1;
buf[rand() % BS] = 2;
diff --git a/compiler-rt/test/asan/TestCases/throw_catch.cc b/compiler-rt/test/asan/TestCases/throw_catch.cc
index 7e0d76d1083..bce48199dbf 100644
--- a/compiler-rt/test/asan/TestCases/throw_catch.cc
+++ b/compiler-rt/test/asan/TestCases/throw_catch.cc
@@ -34,7 +34,9 @@ void TestThrow() {
__asan_address_is_poisoned(x + 32));
// FIXME: Invert this assertion once we fix
// https://code.google.com/p/address-sanitizer/issues/detail?id=258
- assert(!__asan_address_is_poisoned(x + 32));
+ // This assertion works only w/o UAR.
+ if (!__asan_get_current_fake_stack())
+ assert(!__asan_address_is_poisoned(x + 32));
}
void TestThrowInline() {
@@ -51,7 +53,9 @@ void TestThrowInline() {
__asan_address_is_poisoned(x + 32));
// FIXME: Invert this assertion once we fix
// https://code.google.com/p/address-sanitizer/issues/detail?id=258
- assert(!__asan_address_is_poisoned(x + 32));
+ // This assertion works only w/o UAR.
+ if (!__asan_get_current_fake_stack())
+ assert(!__asan_address_is_poisoned(x + 32));
}
int main(int argc, char **argv) {
OpenPOWER on IntegriCloud