summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/kernel
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2019-07-17 21:46:51 +0000
committergVisor bot <gvisor-bot@google.com>2019-07-17 21:46:51 +0000
commit55b44419bc553cb248a9bf2011004454d7491d7a (patch)
treee1c5b4e72b346e0e1f9431770f57bf23639c2693 /pkg/sentry/kernel
parentf262d78f6a4b487c9ba4d087ec5482f1751ffea2 (diff)
parent609cd91e3fc3359af263b52f494116ddbc800f77 (diff)
Merge 609cd91e (automated)
Diffstat (limited to 'pkg/sentry/kernel')
-rwxr-xr-xpkg/sentry/kernel/seqatomic_taskgoroutineschedinfo_unsafe.go5
-rw-r--r--pkg/sentry/kernel/task_start.go16
2 files changed, 17 insertions, 4 deletions
diff --git a/pkg/sentry/kernel/seqatomic_taskgoroutineschedinfo_unsafe.go b/pkg/sentry/kernel/seqatomic_taskgoroutineschedinfo_unsafe.go
index be6b07629..24528b66a 100755
--- a/pkg/sentry/kernel/seqatomic_taskgoroutineschedinfo_unsafe.go
+++ b/pkg/sentry/kernel/seqatomic_taskgoroutineschedinfo_unsafe.go
@@ -1,11 +1,12 @@
package kernel
import (
+ "strings"
+ "unsafe"
+
"fmt"
"gvisor.dev/gvisor/third_party/gvsync"
"reflect"
- "strings"
- "unsafe"
)
// SeqAtomicLoad returns a copy of *ptr, ensuring that the read does not race
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
}