diff options
author | gVisor bot <gvisor-bot@google.com> | 2019-07-17 14:38:22 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2019-07-17 14:38:22 -0700 |
commit | 609cd91e3fc3359af263b52f494116ddbc800f77 (patch) | |
tree | c5fa458730b79c6359e19e92e8bb981884848311 | |
parent | 542fbd01a7ed38baca941f88c0b254adef691188 (diff) | |
parent | 0dbdca349cd90fff4353650efcb0198b4ad6cb6d (diff) |
Merge pull request #355 from zhuangel:master
PiperOrigin-RevId: 258643966
-rw-r--r-- | pkg/sentry/kernel/task_start.go | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/pkg/sentry/kernel/task_start.go b/pkg/sentry/kernel/task_start.go index a88bf3951..d60cd62c7 100644 --- a/pkg/sentry/kernel/task_start.go +++ b/pkg/sentry/kernel/task_start.go @@ -250,8 +250,20 @@ func (ns *PIDNamespace) allocateTID() (ThreadID, error) { } // Is it available? - _, ok := ns.tasks[tid] - if !ok { + tidInUse := func() bool { + if _, ok := ns.tasks[tid]; ok { + return true + } + if _, ok := ns.processGroups[ProcessGroupID(tid)]; ok { + return true + } + if _, ok := ns.sessions[SessionID(tid)]; ok { + return true + } + return false + }() + + if !tidInUse { ns.last = tid return tid, nil } |