summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/asan/lit_tests/TestCases/Linux/syscalls.cc
diff options
context:
space:
mode:
Diffstat (limited to 'compiler-rt/lib/asan/lit_tests/TestCases/Linux/syscalls.cc')
-rw-r--r--compiler-rt/lib/asan/lit_tests/TestCases/Linux/syscalls.cc22
1 files changed, 22 insertions, 0 deletions
diff --git a/compiler-rt/lib/asan/lit_tests/TestCases/Linux/syscalls.cc b/compiler-rt/lib/asan/lit_tests/TestCases/Linux/syscalls.cc
new file mode 100644
index 00000000000..b2edcfb9237
--- /dev/null
+++ b/compiler-rt/lib/asan/lit_tests/TestCases/Linux/syscalls.cc
@@ -0,0 +1,22 @@
+// RUN: %clangxx_asan -m64 -O0 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s
+// RUN: %clangxx_asan -m64 -O3 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s
+
+#include <assert.h>
+#include <errno.h>
+#include <glob.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <sanitizer/linux_syscall_hooks.h>
+
+/* Test the presence of __sanitizer_syscall_ in the tool runtime, and general
+ sanity of their behaviour. */
+
+int main(int argc, char *argv[]) {
+ char buf[1000];
+ __sanitizer_syscall_pre_recvmsg(0, buf - 1, 0);
+ // CHECK: AddressSanitizer: stack-buffer-{{.*}}erflow
+ // CHECK: READ of size {{.*}} at {{.*}} thread T0
+ // CHECK: #0 {{.*}} in __sanitizer_syscall_pre_recvmsg
+ return 0;
+}
OpenPOWER on IntegriCloud