summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--pkg/sentry/mm/lifecycle.go6
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)
+ }
}