diff options
author | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2017-12-20 19:05:44 +0000 |
---|---|---|
committer | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2017-12-20 19:05:44 +0000 |
commit | f7d5f654410fbdd20a81ba879d5f96df709a8ef8 (patch) | |
tree | 0df7983c68a6e91a8a279abc000b07381a52a3b9 /test | |
parent | 1d871d6cd3fed01cd50dd63e743bd2ea6e65eab6 (diff) |
[hwasan] Implement -fsanitize-recover=hwaddress.
Summary: Very similar to AddressSanitizer, with the exception of the error type encoding.
Reviewers: kcc, alekseyshl
Subscribers: cfe-commits, kubamracek, llvm-commits, hiraditya
Differential Revision: https://reviews.llvm.org/D41417
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@321203 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/hwasan/TestCases/halt-on-error.cc | 38 |
1 files changed, 27 insertions, 11 deletions
diff --git a/test/hwasan/TestCases/halt-on-error.cc b/test/hwasan/TestCases/halt-on-error.cc index 7c3cc5c68..fdf6d27d7 100644 --- a/test/hwasan/TestCases/halt-on-error.cc +++ b/test/hwasan/TestCases/halt-on-error.cc @@ -1,4 +1,19 @@ -// RUN: %clangxx_hwasan -O0 %s -o %t && not %env_hwasan_opts=halt_on_error=0 %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_hwasan -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s --check-prefixes=COMMON +// RUN: %clangxx_hwasan -O0 %s -o %t && not %env_hwasan_opts=halt_on_error=1 %run %t 2>&1 | FileCheck %s --check-prefix=COMMON +// RUN: %clangxx_hwasan -O0 %s -o %t && not %env_hwasan_opts=halt_on_error=0 %run %t 2>&1 | FileCheck %s --check-prefix=COMMON + +// RUN: %clangxx_hwasan -O0 %s -o %t -fsanitize-recover=hwaddress && not %run %t 2>&1 | FileCheck %s --check-prefix=COMMON +// RUN: %clangxx_hwasan -O0 %s -o %t -fsanitize-recover=hwaddress && not %env_hwasan_opts=halt_on_error=1 %run %t 2>&1 | FileCheck %s --check-prefix=COMMON +// RUN: %clangxx_hwasan -O0 %s -o %t -fsanitize-recover=hwaddress && not %env_hwasan_opts=halt_on_error=0 %run %t 2>&1 | FileCheck %s --check-prefixes=COMMON,RECOVER + +// RUN: %clangxx_hwasan -mllvm -hwasan-instrument-with-calls=1 -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s --check-prefix=COMMON +// RUN: %clangxx_hwasan -mllvm -hwasan-instrument-with-calls=1 -O0 %s -o %t && not %env_hwasan_opts=halt_on_error=1 %run %t 2>&1 | FileCheck %s --check-prefix=COMMON +// RUN: %clangxx_hwasan -mllvm -hwasan-instrument-with-calls=1 -O0 %s -o %t && not %env_hwasan_opts=halt_on_error=0 %run %t 2>&1 | FileCheck %s --check-prefix=COMMON + +// RUN: %clangxx_hwasan -mllvm -hwasan-instrument-with-calls=1 -O0 %s -o %t -fsanitize-recover=hwaddress && not %run %t 2>&1 | FileCheck %s --check-prefix=COMMON +// RUN: %clangxx_hwasan -mllvm -hwasan-instrument-with-calls=1 -O0 %s -o %t -fsanitize-recover=hwaddress && not %env_hwasan_opts=halt_on_error=1 %run %t 2>&1 | FileCheck %s --check-prefix=COMMON +// RUN: %clangxx_hwasan -mllvm -hwasan-instrument-with-calls=1 -O0 %s -o %t -fsanitize-recover=hwaddress && not %env_hwasan_opts=halt_on_error=0 %run %t 2>&1 | FileCheck %s --check-prefixes=COMMON,RECOVER + // REQUIRES: stable-runtime #include <stdlib.h> @@ -10,17 +25,18 @@ int main() { free(x); __hwasan_disable_allocator_tagging(); return x[2] + ((char *)x)[6] + ((char *)x)[9]; - // CHECK: READ of size 4 at - // CHECK: #0 {{.*}} in main {{.*}}halt-on-error.cc:12 - // CHECK: SUMMARY: HWAddressSanitizer: tag-mismatch {{.*}} in main + // COMMON: READ of size 4 at + // When instrumenting with callbacks, main is actually #1, and #0 is __hwasan_load4. + // COMMON: #{{.*}} in main {{.*}}halt-on-error.cc:27 + // COMMON: SUMMARY: HWAddressSanitizer: tag-mismatch {{.*}} in - // CHECK: READ of size 1 at - // CHECK: #0 {{.*}} in main {{.*}}halt-on-error.cc:12 - // CHECK: SUMMARY: HWAddressSanitizer: tag-mismatch {{.*}} in main + // RECOVER: READ of size 1 at + // RECOVER: #{{.*}} in main {{.*}}halt-on-error.cc:27 + // RECOVER: SUMMARY: HWAddressSanitizer: tag-mismatch {{.*}} in - // CHECK: READ of size 1 at - // CHECK: #0 {{.*}} in main {{.*}}halt-on-error.cc:12 - // CHECK: SUMMARY: HWAddressSanitizer: tag-mismatch {{.*}} in main + // RECOVER: READ of size 1 at + // RECOVER: #{{.*}} in main {{.*}}halt-on-error.cc:27 + // RECOVER: SUMMARY: HWAddressSanitizer: tag-mismatch {{.*}} in - // CHECK-NOT: tag-mismatch + // COMMON-NOT: tag-mismatch } |