summaryrefslogtreecommitdiffhomepage
path: root/pkg
diff options
context:
space:
mode:
Diffstat (limited to 'pkg')
-rw-r--r--pkg/sentry/mm/syscalls.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/pkg/sentry/mm/syscalls.go b/pkg/sentry/mm/syscalls.go
index 9519c7390..1a46c2105 100644
--- a/pkg/sentry/mm/syscalls.go
+++ b/pkg/sentry/mm/syscalls.go
@@ -463,6 +463,7 @@ func (mm *MemoryManager) MRemap(ctx context.Context, oldAddr usermem.Addr, oldSi
vma.id.IncRef()
}
mm.vmas.Add(newAR, vma)
+ mm.usageAS += uint64(newAR.Length())
return newAR.Start, nil
}
@@ -479,14 +480,13 @@ func (mm *MemoryManager) MRemap(ctx context.Context, oldAddr usermem.Addr, oldSi
// oldAR, so calling RemoveMapping could cause us to miss an invalidation
// overlapping oldAR.
//
- // Call vseg.Value() (rather than vseg.ValuePtr()) first to make a copy of
- // the vma.
+ // Call vseg.Value() (rather than vseg.ValuePtr()) to make a copy of the
+ // vma.
vseg = mm.vmas.Isolate(vseg, oldAR)
vma := vseg.Value()
mm.vmas.Remove(vseg)
-
- // Insert the new vma, transferring the reference on vma.id.
mm.vmas.Add(newAR, vma)
+ mm.usageAS = mm.usageAS - uint64(oldAR.Length()) + uint64(newAR.Length())
// Move pmas. This is technically optional for non-private pmas, which
// could just go through memmap.Mappable.Translate again, but it's required