Skip to content

Commit 3a84651

Browse files
nixprimegvisor-bot
authored andcommitted
mm: don't call platform.AddressSpace.MapFile(precommit=true) over 1 GiB
PiperOrigin-RevId: 812990256
1 parent 9bf96c1 commit 3a84651

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pkg/sentry/mm/address_space.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,12 @@ func (mm *MemoryManager) Deactivate() {
174174
// - ar must be page-aligned.
175175
// - pseg == mm.pmas.LowerBoundSegment(ar.Start).
176176
func (mm *MemoryManager) mapASLocked(ctx context.Context, pseg pmaIterator, ar hostarch.AddrRange, platformEffect memmap.MMapPlatformEffect) error {
177+
if platformEffect == memmap.PlatformEffectCommit && ar.Length() > (1<<30) {
178+
// FIXME(b/445932215, b/445939339): Don't precommit very large ranges
179+
// via platform.AddressSpace.MapFile() for now, since holding locks
180+
// while doing so causes problems.
181+
platformEffect = memmap.PlatformEffectPopulate
182+
}
177183
// By default, map entire pmas at a time, under the assumption that there
178184
// is no cost to mapping more of a pma than necessary.
179185
mapAR := hostarch.AddrRange{0, ^hostarch.Addr(hostarch.PageSize - 1)}

0 commit comments

Comments
 (0)