Skip to content

Commit c7f4b3e

Browse files
authored
[scudo] Fix the misused Exhausted in region allocation (#89852)
`Region->Exhausted` indicates that we don't have more pages to create new blocks in the region. It has different meaning from region allocation failure. Also fix a minor lint in popBlocks()
1 parent c8edf11 commit c7f4b3e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

compiler-rt/lib/scudo/standalone/primary64.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -884,9 +884,10 @@ template <typename Config> class SizeClassAllocator64 {
884884
ScopedLock ML(Region->MMLock);
885885

886886
const bool RegionIsExhausted = Region->Exhausted;
887-
if (!RegionIsExhausted)
887+
if (!RegionIsExhausted) {
888888
PopCount = populateFreeListAndPopBlocks(C, ClassId, Region, ToArray,
889889
MaxBlockCount);
890+
}
890891
ReportRegionExhausted = !RegionIsExhausted && Region->Exhausted;
891892

892893
{
@@ -1019,7 +1020,6 @@ template <typename Config> class SizeClassAllocator64 {
10191020
MAP_ALLOWNOMEM))) {
10201021
Printf("Can't reserve pages for size class %zu.\n",
10211022
getSizeByClassId(ClassId));
1022-
Region->Exhausted = true;
10231023
return 0U;
10241024
}
10251025
initRegion(Region, ClassId,

0 commit comments

Comments
 (0)