summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/kernel/threads.go
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2019-07-26 15:00:49 -0700
committergVisor bot <gvisor-bot@google.com>2019-07-26 15:00:51 -0700
commitb50122379c696f1ae31d4fa914c1c14d28cae826 (patch)
tree74fd85cff244b3d905bb21f3e750dcdaa26a95fe /pkg/sentry/kernel/threads.go
parent444a9d9e545f01dc204f1863e91acb8700823c6e (diff)
parent1c5b6d9bd26ba090610d05366df90d4fee91c677 (diff)
Merge pull request #452 from zhangningdlut:chris_test_pidns
PiperOrigin-RevId: 260220279
Diffstat (limited to 'pkg/sentry/kernel/threads.go')
-rw-r--r--pkg/sentry/kernel/threads.go12
1 files changed, 9 insertions, 3 deletions
diff --git a/pkg/sentry/kernel/threads.go b/pkg/sentry/kernel/threads.go
index b21b182fc..8267929a6 100644
--- a/pkg/sentry/kernel/threads.go
+++ b/pkg/sentry/kernel/threads.go
@@ -90,9 +90,9 @@ type TaskSet struct {
}
// newTaskSet returns a new, empty TaskSet.
-func newTaskSet() *TaskSet {
- ts := &TaskSet{}
- ts.Root = newPIDNamespace(ts, nil /* parent */, auth.NewRootUserNamespace())
+func newTaskSet(pidns *PIDNamespace) *TaskSet {
+ ts := &TaskSet{Root: pidns}
+ pidns.owner = ts
return ts
}
@@ -186,6 +186,12 @@ func newPIDNamespace(ts *TaskSet, parent *PIDNamespace, userns *auth.UserNamespa
}
}
+// NewRootPIDNamespace creates the root PID namespace. 'owner' is not available
+// yet when root namespace is created and must be set by caller.
+func NewRootPIDNamespace(userns *auth.UserNamespace) *PIDNamespace {
+ return newPIDNamespace(nil, nil, userns)
+}
+
// NewChild returns a new, empty PID namespace that is a child of ns. Authority
// over the new PID namespace is controlled by userns.
func (ns *PIDNamespace) NewChild(userns *auth.UserNamespace) *PIDNamespace {