summaryrefslogtreecommitdiff
path: root/test/sanitizer_common
diff options
context:
space:
mode:
authorPetar Jovanovic <petar.jovanovic@mips.com>2018-04-25 16:21:00 +0000
committerPetar Jovanovic <petar.jovanovic@mips.com>2018-04-25 16:21:00 +0000
commitbcf769a81d9065cb734eef6b8cf7627ef2f628b4 (patch)
tree43d48c37381c4629197117101bbad81b5fc7732b /test/sanitizer_common
parent14248e1d61900013f490d15bfdfba708638a5513 (diff)
[mips] Implement GetWriteFlag() for mips
The read/write flag is set by manually decoding the instruction that caused the exception. It is implemented this way because the cause register which contains the needed flag was removed from the signal context structure which the user handler receives from the kernel. Patch by Milos Stojanovic. Differential Revision: https://reviews.llvm.org/D45768 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@330840 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/sanitizer_common')
-rw-r--r--test/sanitizer_common/TestCases/Posix/illegal_read_test.cc14
-rw-r--r--test/sanitizer_common/TestCases/Posix/illegal_write_test.cc13
2 files changed, 27 insertions, 0 deletions
diff --git a/test/sanitizer_common/TestCases/Posix/illegal_read_test.cc b/test/sanitizer_common/TestCases/Posix/illegal_read_test.cc
new file mode 100644
index 000000000..1cfd0d694
--- /dev/null
+++ b/test/sanitizer_common/TestCases/Posix/illegal_read_test.cc
@@ -0,0 +1,14 @@
+// Test that there was an illegal READ memory access.
+// RUN: %clangxx -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s
+
+// REQUIRES: stable-runtime
+
+volatile int *null = 0;
+volatile int a;
+
+int main(int argc, char **argv) {
+ a = *null;
+ return 0;
+}
+
+// CHECK: The signal is caused by a READ memory access.
diff --git a/test/sanitizer_common/TestCases/Posix/illegal_write_test.cc b/test/sanitizer_common/TestCases/Posix/illegal_write_test.cc
new file mode 100644
index 000000000..b76e9050a
--- /dev/null
+++ b/test/sanitizer_common/TestCases/Posix/illegal_write_test.cc
@@ -0,0 +1,13 @@
+// Test that there was an illegal WRITE memory access.
+// RUN: %clangxx -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s
+
+// REQUIRES: stable-runtime
+
+volatile int *null = 0;
+
+int main(int argc, char **argv) {
+ *null = 0;
+ return 0;
+}
+
+// CHECK: The signal is caused by a WRITE memory access.