diff options
author | Walter Lee <waltl@google.com> | 2017-11-16 23:29:19 +0000 |
---|---|---|
committer | Walter Lee <waltl@google.com> | 2017-11-16 23:29:19 +0000 |
commit | 513fc069f00b3540eedab30ca188ab29bbcf4047 (patch) | |
tree | 8096ddaefbc12c825cd3b869f2b82ec920028bc0 | |
parent | 00b4931d5d05c5370418bd66f518403fced91878 (diff) | |
download | bcm5719-llvm-513fc069f00b3540eedab30ca188ab29bbcf4047.tar.gz bcm5719-llvm-513fc069f00b3540eedab30ca188ab29bbcf4047.zip |
[asan] Properly mark or disable tests that only work with shadow scale of 3
Differential Revision: https://reviews.llvm.org/D39774
llvm-svn: 318471
13 files changed, 19 insertions, 12 deletions
diff --git a/compiler-rt/lib/asan/tests/asan_asm_test.cc b/compiler-rt/lib/asan/tests/asan_asm_test.cc index 2bb37946bb4..91f8aacd6ee 100644 --- a/compiler-rt/lib/asan/tests/asan_asm_test.cc +++ b/compiler-rt/lib/asan/tests/asan_asm_test.cc @@ -12,7 +12,8 @@ //===----------------------------------------------------------------------===// #include "asan_test_utils.h" -#if defined(__linux__) +#if defined(__linux__) && \ + (!defined(ASAN_SHADOW_SCALE) || ASAN_SHADOW_SCALE == 3) // Assembly instrumentation is broken on x86 Android (x86 + PIC + shared runtime // library). See https://github.com/google/sanitizers/issues/353 diff --git a/compiler-rt/lib/asan/tests/asan_interface_test.cc b/compiler-rt/lib/asan/tests/asan_interface_test.cc index 0540ab5e0a2..69c8fe6f481 100644 --- a/compiler-rt/lib/asan/tests/asan_interface_test.cc +++ b/compiler-rt/lib/asan/tests/asan_interface_test.cc @@ -153,14 +153,15 @@ TEST(AddressSanitizerInterface, DeathCallbackTest) { __asan_set_death_callback(NULL); } -static const char* kUseAfterPoisonErrorMessage = "use-after-poison"; - #define GOOD_ACCESS(ptr, offset) \ EXPECT_FALSE(__asan_address_is_poisoned(ptr + offset)) #define BAD_ACCESS(ptr, offset) \ EXPECT_TRUE(__asan_address_is_poisoned(ptr + offset)) +#if !defined(ASAN_SHADOW_SCALE) || ASAN_SHADOW_SCALE == 3 +static const char* kUseAfterPoisonErrorMessage = "use-after-poison"; + TEST(AddressSanitizerInterface, SimplePoisonMemoryRegionTest) { char *array = Ident((char*)malloc(120)); // poison array[40..80) @@ -199,6 +200,7 @@ TEST(AddressSanitizerInterface, OverlappingPoisonMemoryRegionTest) { BAD_ACCESS(array, 96); free(array); } +#endif // !defined(ASAN_SHADOW_SCALE) || ASAN_SHADOW_SCALE == 3 TEST(AddressSanitizerInterface, PushAndPopWithPoisoningTest) { // Vector of capacity 20 @@ -219,6 +221,7 @@ TEST(AddressSanitizerInterface, PushAndPopWithPoisoningTest) { free(vec); } +#if !defined(ASAN_SHADOW_SCALE) || ASAN_SHADOW_SCALE == 3 // Make sure that each aligned block of size "2^granularity" doesn't have // "true" value before "false" value. static void MakeShadowValid(bool *shadow, int length, int granularity) { @@ -272,6 +275,7 @@ TEST(AddressSanitizerInterface, PoisoningStressTest) { } free(arr); } +#endif // !defined(ASAN_SHADOW_SCALE) || ASAN_SHADOW_SCALE == 3 TEST(AddressSanitizerInterface, GlobalRedzones) { GOOD_ACCESS(glob1, 1 - 1); diff --git a/compiler-rt/test/asan/TestCases/Linux/allocator_oom_test.cc b/compiler-rt/test/asan/TestCases/Linux/allocator_oom_test.cc index f94475f9b78..6382003781c 100644 --- a/compiler-rt/test/asan/TestCases/Linux/allocator_oom_test.cc +++ b/compiler-rt/test/asan/TestCases/Linux/allocator_oom_test.cc @@ -31,6 +31,7 @@ // ASan shadow memory on s390 is too large for this test. // AArch64 bots fail on this test. // TODO(alekseys): Android lit do not run ulimit on device. +// REQUIRES: shadow-scale-3 // UNSUPPORTED: s390,android,arm,aarch64 #include <stdlib.h> diff --git a/compiler-rt/test/asan/TestCases/Linux/asan-asm-stacktrace-test.cc b/compiler-rt/test/asan/TestCases/Linux/asan-asm-stacktrace-test.cc index cbc900decea..acbe9472676 100644 --- a/compiler-rt/test/asan/TestCases/Linux/asan-asm-stacktrace-test.cc +++ b/compiler-rt/test/asan/TestCases/Linux/asan-asm-stacktrace-test.cc @@ -1,7 +1,7 @@ // Check that a stack unwinding algorithm works corretly even with the assembly // instrumentation. -// REQUIRES: x86_64-target-arch +// REQUIRES: x86_64-target-arch, shadow-scale-3 // RUN: %clangxx_asan -g -O1 %s -fno-inline-functions -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -mllvm -asan-instrument-assembly -o %t && not %run %t 2>&1 | FileCheck %s // RUN: %clangxx_asan -g -O1 %s -fno-inline-functions -fomit-frame-pointer -momit-leaf-frame-pointer -mllvm -asan-instrument-assembly -o %t && not %run %t 2>&1 | FileCheck %s // RUN: %clangxx_asan -g0 -O1 %s -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-exceptions -fno-inline-functions -fomit-frame-pointer -momit-leaf-frame-pointer -mllvm -asan-instrument-assembly -o %t && not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-nounwind diff --git a/compiler-rt/test/asan/TestCases/Linux/asan_prelink_test.cc b/compiler-rt/test/asan/TestCases/Linux/asan_prelink_test.cc index a5808ba3a9a..e00c215e92b 100644 --- a/compiler-rt/test/asan/TestCases/Linux/asan_prelink_test.cc +++ b/compiler-rt/test/asan/TestCases/Linux/asan_prelink_test.cc @@ -10,7 +10,7 @@ // RUN: %env_asan_opts=verbosity=1 %run %t 2>&1 | FileCheck %s // GNU driver doesn't handle .so files properly. -// REQUIRES: x86_64-target-arch, Clang +// REQUIRES: x86_64-target-arch, shadow-scale-3, Clang #if BUILD_SO int G; int *getG() { diff --git a/compiler-rt/test/asan/TestCases/Linux/cuda_test.cc b/compiler-rt/test/asan/TestCases/Linux/cuda_test.cc index e87f56b0c20..e532f2ee7bf 100644 --- a/compiler-rt/test/asan/TestCases/Linux/cuda_test.cc +++ b/compiler-rt/test/asan/TestCases/Linux/cuda_test.cc @@ -1,7 +1,7 @@ // Emulate the behavior of the NVIDIA CUDA driver // that mmaps memory inside the asan's shadow gap. // -// REQUIRES: x86_64-target-arch +// REQUIRES: x86_64-target-arch, shadow-scale-3 // // RUN: %clangxx_asan %s -o %t // RUN: not %env_asan_opts=protect_shadow_gap=1 %t 2>&1 | FileCheck %s --check-prefix=CHECK-PROTECT1 @@ -33,5 +33,3 @@ int main(void) { *(char*)(Base + 1234) = 1; // CHECK-PROTECT0: AddressSanitizer: use-after-poison on address 0x0002000004d2 } - - diff --git a/compiler-rt/test/asan/TestCases/Linux/kernel-area.cc b/compiler-rt/test/asan/TestCases/Linux/kernel-area.cc index d7a544fecaf..41b507cdfe0 100644 --- a/compiler-rt/test/asan/TestCases/Linux/kernel-area.cc +++ b/compiler-rt/test/asan/TestCases/Linux/kernel-area.cc @@ -16,9 +16,8 @@ // CHECK-kernel-64-bits: || `[0x28{{0+}}, 0x3{{f+}}]` || HighShadow || // CHECK-kernel-64-bits: || `[0x24{{0+}}, 0x27{{f+}}]` || ShadowGap || // -// REQUIRES: i386-target-arch +// REQUIRES: i386-target-arch, shadow-scale-3 int main() { return 0; } - diff --git a/compiler-rt/test/asan/TestCases/Linux/nohugepage_test.cc b/compiler-rt/test/asan/TestCases/Linux/nohugepage_test.cc index ce8f17e7899..0fd7c558d6d 100644 --- a/compiler-rt/test/asan/TestCases/Linux/nohugepage_test.cc +++ b/compiler-rt/test/asan/TestCases/Linux/nohugepage_test.cc @@ -9,7 +9,7 @@ // Would be great to run the test with no_huge_pages_for_shadow=0, but // the result will depend on the OS version and settings... // -// REQUIRES: x86_64-target-arch +// REQUIRES: x86_64-target-arch, shadow-scale-3 // // WARNING: this test is very subtle and may nto work on some systems. // If this is the case we'll need to futher improve it or disable it. diff --git a/compiler-rt/test/asan/TestCases/intra-object-overflow.cc b/compiler-rt/test/asan/TestCases/intra-object-overflow.cc index 4032cc14485..56b5bb2b729 100644 --- a/compiler-rt/test/asan/TestCases/intra-object-overflow.cc +++ b/compiler-rt/test/asan/TestCases/intra-object-overflow.cc @@ -3,7 +3,7 @@ // RUN: %run %t 10 // // FIXME: fix 32-bits. -// REQUIRES: asan-64-bits +// REQUIRES: asan-64-bits, shadow-scale-3 // FIXME: Implement ASan intra-object padding in Clang's MS record layout // UNSUPPORTED: win32 #include <stdio.h> diff --git a/compiler-rt/test/asan/TestCases/small_memcpy_test.cc b/compiler-rt/test/asan/TestCases/small_memcpy_test.cc index 2d6dea60cae..ef0ac35b8a2 100644 --- a/compiler-rt/test/asan/TestCases/small_memcpy_test.cc +++ b/compiler-rt/test/asan/TestCases/small_memcpy_test.cc @@ -7,6 +7,7 @@ // RUN: not %run %t 32 48 2>&1 | FileCheck %s --check-prefix=CHECK // RUN: not %run %t 40 56 2>&1 | FileCheck %s --check-prefix=CHECK // RUN: not %run %t 48 64 2>&1 | FileCheck %s --check-prefix=CHECK +// REQUIRES: shadow-scale-3 #include <assert.h> #include <string.h> #include <stdlib.h> diff --git a/compiler-rt/test/asan/TestCases/stack-buffer-overflow-with-position.cc b/compiler-rt/test/asan/TestCases/stack-buffer-overflow-with-position.cc index 2a575f7755f..0077663d6a1 100644 --- a/compiler-rt/test/asan/TestCases/stack-buffer-overflow-with-position.cc +++ b/compiler-rt/test/asan/TestCases/stack-buffer-overflow-with-position.cc @@ -42,3 +42,4 @@ int main(int argc, char **argv) { // CHECK-63: 'CCC'{{.*}} <== {{.*}}partially underflows this variable // CHECK-73: 'CCC'{{.*}} <== {{.*}}partially overflows this variable // CHECK-74: 'CCC'{{.*}} <== {{.*}}overflows this variable +// REQUIRES: shadow-scale-3 diff --git a/compiler-rt/test/asan/TestCases/strtol_strict.c b/compiler-rt/test/asan/TestCases/strtol_strict.c index 999067e89e0..bc30c87b18c 100644 --- a/compiler-rt/test/asan/TestCases/strtol_strict.c +++ b/compiler-rt/test/asan/TestCases/strtol_strict.c @@ -21,6 +21,7 @@ // RUN: %run %t test7 2>&1 // RUN: %env_asan_opts=strict_string_checks=false %run %t test7 2>&1 // RUN: %env_asan_opts=strict_string_checks=true not %run %t test7 2>&1 | FileCheck %s --check-prefix=CHECK7 +// REQUIRES: shadow-scale-3 #include <assert.h> #include <stdlib.h> diff --git a/compiler-rt/test/asan/TestCases/strtoll_strict.c b/compiler-rt/test/asan/TestCases/strtoll_strict.c index f6a1716bcc8..93cce30f8cb 100644 --- a/compiler-rt/test/asan/TestCases/strtoll_strict.c +++ b/compiler-rt/test/asan/TestCases/strtoll_strict.c @@ -23,6 +23,7 @@ // RUN: %env_asan_opts=strict_string_checks=true not %run %t test7 2>&1 | FileCheck %s --check-prefix=CHECK7 // FIXME: Enable strtoll interceptor. +// REQUIRES: shadow-scale-3 // XFAIL: win32 #include <assert.h> |