summaryrefslogtreecommitdiffstats
path: root/compiler-rt/test/sanitizer_common/TestCases/Linux/mmap_write_exec.cpp
diff options
context:
space:
mode:
authorVitaly Buka <vitalybuka@google.com>2018-03-16 21:25:09 +0000
committerVitaly Buka <vitalybuka@google.com>2018-03-16 21:25:09 +0000
commitd2aca7bf89a1bf71dca6f80e657916c5f8aa1c24 (patch)
tree2c358f0e73ffa2a341230c00710f79a20ea0a08a /compiler-rt/test/sanitizer_common/TestCases/Linux/mmap_write_exec.cpp
parentbbe253172ff853650575e35929c5418d7aa65208 (diff)
downloadbcm5719-llvm-d2aca7bf89a1bf71dca6f80e657916c5f8aa1c24.tar.gz
bcm5719-llvm-d2aca7bf89a1bf71dca6f80e657916c5f8aa1c24.zip
Mmap interceptor new option, Write Exec runtime detector
Summary: Following-up the refactoring of mmap interceptors, adding a new common option to detect PROT_WRITE|PROT_EXEC pages request. Patch by David CARLIER Reviewers: vitalybuka, vsk Reviewed By: vitalybuka Subscribers: krytarowski, #sanitizers Differential Revision: https://reviews.llvm.org/D44194 llvm-svn: 327747
Diffstat (limited to 'compiler-rt/test/sanitizer_common/TestCases/Linux/mmap_write_exec.cpp')
-rw-r--r--compiler-rt/test/sanitizer_common/TestCases/Linux/mmap_write_exec.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/compiler-rt/test/sanitizer_common/TestCases/Linux/mmap_write_exec.cpp b/compiler-rt/test/sanitizer_common/TestCases/Linux/mmap_write_exec.cpp
new file mode 100644
index 00000000000..2758322c53e
--- /dev/null
+++ b/compiler-rt/test/sanitizer_common/TestCases/Linux/mmap_write_exec.cpp
@@ -0,0 +1,12 @@
+// RUN: %clangxx %s -o %t
+// RUN: %env_tool_opts=detect_write_exec=1 %run %t 2>&1 | FileCheck %s
+// ubsan and lsan do not install mmap interceptors
+// UNSUPPORTED: ubsan, lsan
+
+#include <sys/mman.h>
+
+int main(int argc, char **argv) {
+ char *p = (char *)mmap(0, 1024, PROT_READ | PROT_WRITE | PROT_EXEC,
+ MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
+ // CHECK: WARNING: {{.*}}Sanitizer: writable-executable page usage
+}
OpenPOWER on IntegriCloud