MPS issue job004102

TitlearenaFreeLandInsertSteal might pass an empty range to LandInsert
Statusclosed
Priorityoptional
Assigned userGareth Rees
OrganizationRavenbrook
DescriptionarenaFreeLandInsertSteal steals an arena grain from the range of freed addresses, and then calls LandInsert with the remainder of the range. But stealing the arena grain might leave the remainder of the range empty, and this would cause an assertion failure in LandInsert, which asserts that the range is non-empty.
AnalysisHow can this case happen? Well, the bad case arises when:

1. we are calling ArenaFree with a single grain;
2. the block pool needs to be extended;
3. we cannot allocate more memory using arenaAllocPage (because it would hit the commit limit in pagesMarkAllocated).

So the test case must ensure that there are many isolated ranges in the arena's free land (so that the block pool needs to be extended) and that the commit limit is tight (so that pagesMarkAllocated hits it).
How foundinspection
Evidence[1] https://info.ravenbrook.com/mail/2018/08/01/11-04-05/0/
Test proceduretest/function/235.c
Created byGareth Rees
Created on2018-08-01 11:36:02
Last modified byGareth Rees
Last modified on2018-08-13 14:42:25
History2018-08-01 GDR Created.

Fixes

Change Effect Date User Description
194968 closed 2018-08-13 14:42:25 Gareth Rees Merge branch/2018-08-01/land-insert-steal into the master sources.