summaryrefslogtreecommitdiff
path: root/test/sanitizer_common
diff options
context:
space:
mode:
authorVitaly Buka <vitalybuka@google.com>2018-03-07 00:13:54 +0000
committerVitaly Buka <vitalybuka@google.com>2018-03-07 00:13:54 +0000
commit03e114b188efa25ce9371cd4c1e212477e0981d3 (patch)
treeeec1e0c811ef634d23838b4e89df4790d74b6859 /test/sanitizer_common
parent6702fa4a371471894dbf0e7e63cdcffb744f1620 (diff)
[sanitizer] Move mmap interceptors into sanitizer_common
Reviewers: devnexen, krytarowski, eugenis Subscribers: kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D44125 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@326851 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/sanitizer_common')
-rw-r--r--test/sanitizer_common/TestCases/Linux/mmap64_test.c13
-rw-r--r--test/sanitizer_common/TestCases/Posix/mmap_test.c11
2 files changed, 24 insertions, 0 deletions
diff --git a/test/sanitizer_common/TestCases/Linux/mmap64_test.c b/test/sanitizer_common/TestCases/Linux/mmap64_test.c
new file mode 100644
index 000000000..f4c009d84
--- /dev/null
+++ b/test/sanitizer_common/TestCases/Linux/mmap64_test.c
@@ -0,0 +1,13 @@
+// RUN: %clang %s -o %t && %run %t
+
+#define _LARGEFILE64_SOURCE 1
+
+#include <assert.h>
+#include <sys/mman.h>
+
+int main() {
+ char *buf = (char *)mmap64(0, 100000, PROT_READ | PROT_WRITE,
+ MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
+ assert(buf);
+ munmap(buf, 100000);
+}
diff --git a/test/sanitizer_common/TestCases/Posix/mmap_test.c b/test/sanitizer_common/TestCases/Posix/mmap_test.c
new file mode 100644
index 000000000..3c272f95a
--- /dev/null
+++ b/test/sanitizer_common/TestCases/Posix/mmap_test.c
@@ -0,0 +1,11 @@
+// RUN: %clang %s -o %t && %run %t
+
+#include <assert.h>
+#include <sys/mman.h>
+
+int main() {
+ char *buf = (char *)mmap(0, 100000, PROT_READ | PROT_WRITE,
+ MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
+ assert(buf);
+ munmap(buf, 100000);
+}