summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/kernel/kernel.go
diff options
context:
space:
mode:
authorAndrei Vagin <avagin@google.com>2021-06-07 12:13:22 -0700
committergVisor bot <gvisor-bot@google.com>2021-06-07 12:15:39 -0700
commit7e4e71253ec7c06f2f4eaf387826f08a8b3373cb (patch)
treeaf4dd5f75345d96b4245622ca94540bb9c154931 /pkg/sentry/kernel/kernel.go
parentee1003bde2291d6d892701b33c23bd7dd91d44f6 (diff)
cgroupfs: don't add a task in the root cgroup if it is already there.
PiperOrigin-RevId: 377975013
Diffstat (limited to 'pkg/sentry/kernel/kernel.go')
-rw-r--r--pkg/sentry/kernel/kernel.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/pkg/sentry/kernel/kernel.go b/pkg/sentry/kernel/kernel.go
index febe7fe50..c666be2cb 100644
--- a/pkg/sentry/kernel/kernel.go
+++ b/pkg/sentry/kernel/kernel.go
@@ -1861,7 +1861,9 @@ func (k *Kernel) PopulateNewCgroupHierarchy(root Cgroup) {
return
}
t.mu.Lock()
- t.enterCgroupLocked(root)
+ // A task can be in the cgroup if it has been created after the
+ // cgroup hierarchy was registered.
+ t.enterCgroupIfNotYetLocked(root)
t.mu.Unlock()
})
k.tasks.mu.RUnlock()