[compiler-rt] e456df7 - [scudo][standalone] Fix Primary's ReleaseToOS test

Kostya Kortchinsky via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 29 08:26:56 PDT 2020


Author: Kostya Kortchinsky
Date: 2020-09-29T08:26:38-07:00
New Revision: e456df77c2a5a2bf905f6848a09faf69b49c5752

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

LOG: [scudo][standalone] Fix Primary's ReleaseToOS test

Said test was flaking on Fuchsia for non-obvious reasons, and only
for ASan variants (the release was returning 0).

It turned out that the templating was off, `true` being promoted to
a `s32` and used as the minimum interval argument. This meant that in
some circumstances, the normal release would occur, and the forced
release would have nothing to release, hence the 0 byte released.

The symbols are giving it away (note the 1):
```
scudo::SizeClassAllocator64<scudo::FixedSizeClassMap<scudo::DefaultSizeClassConfig>,24ul,1,2147483647,false>::releaseToOS(void)
```

This also probably means that there was no MTE version of that test!

Differential Revision: https://reviews.llvm.org/D88457

Added: 
    

Modified: 
    compiler-rt/lib/scudo/standalone/tests/primary_test.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/scudo/standalone/tests/primary_test.cpp b/compiler-rt/lib/scudo/standalone/tests/primary_test.cpp
index 605ce44d4973..67d1fe52acef 100644
--- a/compiler-rt/lib/scudo/standalone/tests/primary_test.cpp
+++ b/compiler-rt/lib/scudo/standalone/tests/primary_test.cpp
@@ -58,7 +58,8 @@ TEST(ScudoPrimaryTest, BasicPrimary) {
   testPrimary<scudo::SizeClassAllocator32<SizeClassMap, 18U>>();
 #endif
   testPrimary<scudo::SizeClassAllocator64<SizeClassMap, 24U>>();
-  testPrimary<scudo::SizeClassAllocator64<SizeClassMap, 24U, true>>();
+  testPrimary<scudo::SizeClassAllocator64<SizeClassMap, 24U, INT32_MIN,
+                                          INT32_MAX, true>>();
 }
 
 // The 64-bit SizeClassAllocator can be easily OOM'd with small region sizes.
@@ -144,7 +145,8 @@ TEST(ScudoPrimaryTest, PrimaryIterate) {
   testIteratePrimary<scudo::SizeClassAllocator32<SizeClassMap, 18U>>();
 #endif
   testIteratePrimary<scudo::SizeClassAllocator64<SizeClassMap, 24U>>();
-  testIteratePrimary<scudo::SizeClassAllocator64<SizeClassMap, 24U, true>>();
+  testIteratePrimary<scudo::SizeClassAllocator64<SizeClassMap, 24U, INT32_MIN,
+                                                 INT32_MAX, true>>();
 }
 
 static std::mutex Mutex;
@@ -205,7 +207,8 @@ TEST(ScudoPrimaryTest, PrimaryThreaded) {
   testPrimaryThreaded<scudo::SizeClassAllocator32<SizeClassMap, 18U>>();
 #endif
   testPrimaryThreaded<scudo::SizeClassAllocator64<SizeClassMap, 24U>>();
-  testPrimaryThreaded<scudo::SizeClassAllocator64<SizeClassMap, 24U, true>>();
+  testPrimaryThreaded<scudo::SizeClassAllocator64<SizeClassMap, 24U, INT32_MIN,
+                                                  INT32_MAX, true>>();
 }
 
 // Through a simple allocation that spans two pages, verify that releaseToOS
@@ -236,5 +239,6 @@ TEST(ScudoPrimaryTest, ReleaseToOS) {
   testReleaseToOS<scudo::SizeClassAllocator32<SizeClassMap, 18U>>();
 #endif
   testReleaseToOS<scudo::SizeClassAllocator64<SizeClassMap, 24U>>();
-  testReleaseToOS<scudo::SizeClassAllocator64<SizeClassMap, 24U, true>>();
+  testReleaseToOS<scudo::SizeClassAllocator64<SizeClassMap, 24U, INT32_MIN,
+                                              INT32_MAX, true>>();
 }


        


More information about the llvm-commits mailing list