summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/kernel/task_start.go
diff options
context:
space:
mode:
authorDean Deng <deandeng@google.com>2020-10-14 00:11:00 -0700
committergVisor bot <gvisor-bot@google.com>2020-10-14 00:13:21 -0700
commita7b7b7b9804e9968c1fed5f7b3849233f585a88b (patch)
treed876f7ec3627e3f155b1a2d5bab8ee6c215889f7 /pkg/sentry/kernel/task_start.go
parent631dd5330d438729a7a8f6e00b279386924de640 (diff)
Fix shm reference leak.
All shm segments in an IPC namespace should be released once that namespace is destroyed. Add reference counting to IPCNamespace so that once the last task with a reference on it exits, we can trigger a destructor that will clean up all shm segments that have not been explicitly freed by the application. PiperOrigin-RevId: 337032977
Diffstat (limited to 'pkg/sentry/kernel/task_start.go')
-rw-r--r--pkg/sentry/kernel/task_start.go1
1 files changed, 1 insertions, 0 deletions
diff --git a/pkg/sentry/kernel/task_start.go b/pkg/sentry/kernel/task_start.go
index 64c1e120a..6e2ff573a 100644
--- a/pkg/sentry/kernel/task_start.go
+++ b/pkg/sentry/kernel/task_start.go
@@ -104,6 +104,7 @@ func (ts *TaskSet) NewTask(cfg *TaskConfig) (*Task, error) {
cfg.TaskContext.release()
cfg.FSContext.DecRef(t)
cfg.FDTable.DecRef(t)
+ cfg.IPCNamespace.DecRef(t)
if cfg.MountNamespaceVFS2 != nil {
cfg.MountNamespaceVFS2.DecRef(t)
}