diff options
author | Dmitry Vyukov <dvyukov@google.com> | 2014-04-23 07:01:02 +0000 |
---|---|---|
committer | Dmitry Vyukov <dvyukov@google.com> | 2014-04-23 07:01:02 +0000 |
commit | 3657ebe59eb8bcc2b1ca8c9568b8bf939fbbdd27 (patch) | |
tree | ea52c3c956c3f235714991378fa8f28f74942c43 /test/tsan/mmap_large.cc | |
parent | a9013804aea9c1e6f9d1d664e1c8cf37e2330717 (diff) |
tsan: more precise check for "app memory" in COMPAT mode
this fires when a user makes mmap with fixed address (see the test)
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@206952 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/tsan/mmap_large.cc')
-rw-r--r-- | test/tsan/mmap_large.cc | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/tsan/mmap_large.cc b/test/tsan/mmap_large.cc new file mode 100644 index 000000000..dfe649e1f --- /dev/null +++ b/test/tsan/mmap_large.cc @@ -0,0 +1,19 @@ +// RUN: %clang_tsan -O1 %s -o %t && %t 2>&1 | FileCheck %s +#include <stdint.h> +#include <stdio.h> +#include <sys/mman.h> + +int main() { + const size_t kLog2Size = 40; + const uintptr_t kLocation = 0x40ULL << kLog2Size; + void *p = mmap( + reinterpret_cast<void*>(kLocation), + 1ULL << kLog2Size, + PROT_READ|PROT_WRITE, + MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, + -1, 0); + fprintf(stderr, "DONE %p\n", p); + return p == MAP_FAILED; +} + +// CHECK: DONE |