summaryrefslogtreecommitdiff
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
commit18bdfca5253d2949cee667846695102ca4f2b5e6 (patch)
treedfef972b3f15e8c52200bcfc48e705aff780cbad
parent30ce7beb1ac62e90468747a2d0ab1111467da8b4 (diff)
[asan] fix four asan tests to run in use-after-return mode
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@223181 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--test/asan/TestCases/contiguous_container.cc4
-rw-r--r--test/asan/TestCases/longjmp.cc4
-rw-r--r--test/asan/TestCases/stack-overflow.cc4
-rw-r--r--test/asan/TestCases/throw_catch.cc8
4 files changed, 15 insertions, 5 deletions
diff --git a/test/asan/TestCases/contiguous_container.cc b/test/asan/TestCases/contiguous_container.cc
index 8d8c8d049..0f3a7db5b 100644
--- a/test/asan/TestCases/contiguous_container.cc
+++ b/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/test/asan/TestCases/longjmp.cc b/test/asan/TestCases/longjmp.cc
index 547233068..8e9f2ae19 100644
--- a/test/asan/TestCases/longjmp.cc
+++ b/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/test/asan/TestCases/stack-overflow.cc b/test/asan/TestCases/stack-overflow.cc
index 9d7c72c9c..7542d56b6 100644
--- a/test/asan/TestCases/stack-overflow.cc
+++ b/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/test/asan/TestCases/throw_catch.cc b/test/asan/TestCases/throw_catch.cc
index 7e0d76d10..bce48199d 100644
--- a/test/asan/TestCases/throw_catch.cc
+++ b/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) {