MPS issue job003899

TitleVMArenaGrow can return RESOURCE instead of COMMIT_LIMIT
Statusclosed
Priorityoptional
Assigned userGareth Rees
OrganizationRavenbrook
DescriptionWhy does this test case get the result code RESOURCE? We can't possibly be out of address space, since the initial chunk was only a few megabytes and there haven't been any extensions.

$ noaslr xci6ll/cool/amcss 138581164
Picked scale=8 grainSize=32768
...
MPS_RESERVE_BLOCK: RESOURCE: unable to obtain resources
AnalysisVMArenaGrow tries to create a new chunk in a loop, shrinking the chunk by sliceSize repeatedly until one of the following conditions is true:

1. VMChunkCreate succeeds. In this case we're done.
2. chunkSize <= chunkHalf. In this case we adjust chunkHalf and sliceSize and restart the loop.
3. chunkSize < chunkMin. In this case we (i) return the result code from the last call to VMChunkCreate, if any; or (ii) if there have been no calls to VMChunkCreate since the last adjustment to chunkHalf, we return ResRESOURCE.

It's condition 3(ii) that we're in. This happens if VMChunkCreate has failed at all sizes we've tried. But if the commit limit is very tight (only a page or two remaining), even though the VMInit succeeds, it is not possible to map in the VMChunkStruct and the sparse page table, without exceeding the commit limit. And that means that every call to VMChunkCreate (at any size) will fail with COMMIT_LIMIT. Eventually VMArenaGrow will reach case 3(ii) and return the wrong result code.

The solution is for case 3(ii) to be "if there have been no calls to VMChunkCreate at all, return ResRESOURCE."
How foundautomated_test
EvidenceNone
Created byGareth Rees
Created on2014-11-07 14:03:30
Last modified byGareth Rees
Last modified on2014-11-07 15:03:04
History2014-11-07 GDR Created.

Fixes

Change Effect Date User Description
187489 closed 2014-11-07 14:04:35 Gareth Rees VMArenaGrow now passes on the result code from VMChunkCreate, instead of substituting ResRESOURCE under the circumstances described in job003899.