[compiler-rt] fb19400 - tsan: fix mmap_lots test

Dmitry Vyukov via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 17 10:03:25 PST 2021


Author: Dmitry Vyukov
Date: 2021-02-17T19:03:17+01:00
New Revision: fb19400d4e4c421ce61907bf92a92be8d937e584

URL: https://github.com/llvm/llvm-project/commit/fb19400d4e4c421ce61907bf92a92be8d937e584
DIFF: https://github.com/llvm/llvm-project/commit/fb19400d4e4c421ce61907bf92a92be8d937e584.diff

LOG: tsan: fix mmap_lots test

If tsan runtime will try to allocate something during exit handling,
the allocation will fail because there is no VA whatsoever.
It's observed to fail with the following error in some cases:
failed to allocate 0x1000 (4096) bytes of DTLS_NextBlock.
So terminate the process immediately.

Reviewed-in: https://reviews.llvm.org/D96874

Added: 
    

Modified: 
    compiler-rt/test/tsan/mmap_lots.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/test/tsan/mmap_lots.cpp b/compiler-rt/test/tsan/mmap_lots.cpp
index e1e8ac157bda..a397de0fadd2 100644
--- a/compiler-rt/test/tsan/mmap_lots.cpp
+++ b/compiler-rt/test/tsan/mmap_lots.cpp
@@ -24,6 +24,12 @@ int main() {
     fprintf(stderr, "allocated %zu with size %zu\n", allocated, mmap_size);
   }
   fprintf(stderr, "DONE\n");
+  // If tsan runtime will try to allocate something during exit handling,
+  // the allocation will fail because there is no VA whatsoever.
+  // It's observed to fail with the following error in some cases:
+  // failed to allocate 0x1000 (4096) bytes of DTLS_NextBlock.
+  // So terminate the process immediately.
+  _exit(0);
 }
 
 // CHECK: DONE


        


More information about the llvm-commits mailing list