[PATCH] D47146: Memorysanitizer fix mmap test

David CARLIER via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 21 09:17:30 PDT 2018


devnexen created this revision.
Herald added subscribers: Sanitizers, llvm-commits, fedor.sergeev, krytarowski.

- fix the unit test mmap flag as MMAP_NORESERVE is linux (also solaris but not concerned) specific


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D47146

Files:
  test/msan/mmap.cc


Index: test/msan/mmap.cc
===================================================================
--- test/msan/mmap.cc
+++ test/msan/mmap.cc
@@ -63,9 +63,13 @@
   const size_t kMapSize = 0x1000000000ULL;
 #endif
   int success_count = 0;
+  int flags = MAP_PRIVATE | MAP_ANONYMOUS;
+#if defined(__linux__)
+  flags |= MAP_NORESERVE;
+#endif
   while (true) {
     void *p = mmap(0, kMapSize, PROT_WRITE,
-                   MAP_PRIVATE | MAP_ANONYMOUS | MAP_NORESERVE, -1, 0);
+                   flags, -1, 0);
     printf("%p\n", p);
     if (p == MAP_FAILED) {
       assert(errno == ENOMEM);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47146.147799.patch
Type: text/x-patch
Size: 592 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180521/53e8aab9/attachment-0001.bin>


More information about the llvm-commits mailing list