[PATCH] D60806: [HWASan] Added no-FP unit test for register dump.
Mitch Phillips via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 19 10:41:04 PDT 2019
hctim added a comment.
Fyi - I accidentally committed using the wrong branch, just means that all of my local commits are going up one-by-one.
See `d43dc9e78b2cd9ba7c578f25e47c54cf532c5ef4`, `371f43a6c0f542eb20150c90341aaed09b78fc92`, `371f43a6c0f542eb20150c90341aaed09b78fc92`, `026781c96200c9afad31847a5f3cced947520604`.
The final committed diff from all of these patches is (as was reviewed):
--- /dev/null
+++ b/compiler-rt/test/hwasan/TestCases/register-dump-no-fp.cc
@@ -0,0 +1,28 @@
+// RUN: %clangxx_hwasan -fomit-frame-pointer -momit-leaf-frame-pointer \
+// RUN: -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s --check-prefixes=CHECK
+// RUN: %clangxx_hwasan -fomit-frame-pointer -momit-leaf-frame-pointer \
+// RUN: -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s --check-prefixes=CHECK
+// RUN: %clangxx_hwasan -fomit-frame-pointer -momit-leaf-frame-pointer \
+// RUN: -O2 %s -o %t && not %run %t 2>&1 | FileCheck %s --check-prefixes=CHECK
+// RUN: %clangxx_hwasan -fomit-frame-pointer -momit-leaf-frame-pointer \
+// RUN: -O3 %s -o %t && not %run %t 2>&1 | FileCheck %s --check-prefixes=CHECK
+
+// This test ensures that the CFA is implemented properly for slow
+// (non-frame-pointer) unwinding.
+#include <sanitizer/hwasan_interface.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+__attribute__((noinline)) void f(int *p) { *p = 3; }
+
+// CHECK: ERROR: HWAddressSanitizer:
+// CHECK: #0 {{.*}} in f(int*) {{.*}}register-dump-no-fp.cc:[[@LINE-3]]
+
+int main() {
+ __hwasan_enable_allocator_tagging();
+
+ int *volatile a = new int;
+ a = (int *)__hwasan_tag_pointer(a, 0);
+ f(a);
+ // CHECK: #1 {{.*}} in main {{.*}}register-dump-no-fp.cc:[[@LINE-1]]
+}
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D60806/new/
https://reviews.llvm.org/D60806
More information about the llvm-commits
mailing list