diff options
author | Jamie Liu <jamieliu@google.com> | 2018-12-05 14:26:24 -0800 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2018-12-05 14:27:23 -0800 |
commit | 23438b36327524ba3e71b6416d71863fb4dfa166 (patch) | |
tree | a73a0dc7f19af7ddf95f6d34ff90ba1cac4e915e /pkg/sentry/mm | |
parent | fda4557e3dc19c72f857b107a52359723cd37216 (diff) |
Update MM.usageAS when mremap copies or moves a mapping.
PiperOrigin-RevId: 224221509
Change-Id: I7aaea74629227d682786d3e435737364921249bf
Diffstat (limited to 'pkg/sentry/mm')
-rw-r--r-- | pkg/sentry/mm/syscalls.go | 8 |
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 |