diff options
author | Jamie Liu <jamieliu@google.com> | 2018-06-25 16:49:47 -0700 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2018-06-25 16:50:38 -0700 |
commit | 16882484f96f9d75348904bd5a4e2a53acb67378 (patch) | |
tree | 8ba486e7a40345cd69b217ad1d26f9e1c6912915 /pkg/sentry/mm/lifecycle.go | |
parent | 4ac79312b093f2831079d0d71846747a4996d9ad (diff) |
Check for empty applicationAddrRange in MM.DecUsers.
PiperOrigin-RevId: 202043776
Change-Id: I4373abbcf735dc1cf4bebbbbb0c7124df36e9e78
Diffstat (limited to 'pkg/sentry/mm/lifecycle.go')
-rw-r--r-- | pkg/sentry/mm/lifecycle.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/pkg/sentry/mm/lifecycle.go b/pkg/sentry/mm/lifecycle.go index de7f29b04..a4b5cb443 100644 --- a/pkg/sentry/mm/lifecycle.go +++ b/pkg/sentry/mm/lifecycle.go @@ -214,5 +214,9 @@ func (mm *MemoryManager) DecUsers(ctx context.Context) { mm.mappingMu.Lock() defer mm.mappingMu.Unlock() - mm.unmapLocked(ctx, mm.applicationAddrRange()) + // If mm is being dropped before mm.SetMmapLayout was called, + // mm.applicationAddrRange() will be empty. + if ar := mm.applicationAddrRange(); ar.Length() != 0 { + mm.unmapLocked(ctx, ar) + } } |