diff options
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.cpp | 12 |
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 +} |