diff options
author | Nicolas Lacasse <nlacasse@google.com> | 2021-08-27 13:09:28 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-08-27 13:18:49 -0700 |
commit | f7281c6cb9bbf3e5757adf52a7820499b5a7483b (patch) | |
tree | 58bcf863ec15020cadfc87fd6157ac9b057b1a9a /pkg/sentry/kernel/task_exit.go | |
parent | 0db19ea910def9848d0f53f65f993270ed579a8f (diff) |
Fix lock order violations: mm.mappingMu > Task.mu.
Document this ordering in mm/mm.go.
PiperOrigin-RevId: 393413203
Diffstat (limited to 'pkg/sentry/kernel/task_exit.go')
-rw-r--r-- | pkg/sentry/kernel/task_exit.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/pkg/sentry/kernel/task_exit.go b/pkg/sentry/kernel/task_exit.go index 342e5debe..b3931445b 100644 --- a/pkg/sentry/kernel/task_exit.go +++ b/pkg/sentry/kernel/task_exit.go @@ -230,9 +230,16 @@ func (*runExitMain) execute(t *Task) taskRunState { t.tg.pidns.owner.mu.Lock() t.updateRSSLocked() t.tg.pidns.owner.mu.Unlock() + + // Release the task image resources. Accessing these fields must be + // done with t.mu held, but the mm.DecUsers() call must be done outside + // of that lock. t.mu.Lock() - t.image.release() + mm := t.image.MemoryManager + t.image.MemoryManager = nil + t.image.fu = nil t.mu.Unlock() + mm.DecUsers(t) // Releasing the MM unblocks a blocked CLONE_VFORK parent. t.unstopVforkParent() |