diff options
Diffstat (limited to 'pkg/sentry/kernel/task_clone.go')
-rw-r--r-- | pkg/sentry/kernel/task_clone.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/pkg/sentry/kernel/task_clone.go b/pkg/sentry/kernel/task_clone.go index 0c2427952..a61283267 100644 --- a/pkg/sentry/kernel/task_clone.go +++ b/pkg/sentry/kernel/task_clone.go @@ -220,18 +220,15 @@ func (t *Task) Clone(opts *CloneOptions) (ThreadID, *SyscallControl, error) { pidns = pidns.NewChild(userns) } tg := t.tg - parent := t.parent if opts.NewThreadGroup { sh := t.tg.signalHandlers if opts.NewSignalHandlers { sh = sh.Fork() } tg = NewThreadGroup(pidns, sh, opts.TerminationSignal, tg.limits.GetCopy(), t.k.monotonicClock) - parent = t } cfg := &TaskConfig{ Kernel: t.k, - Parent: parent, ThreadGroup: tg, TaskContext: tc, TaskResources: t.tr.Fork(!opts.NewFiles, !opts.NewFSContext), @@ -242,6 +239,11 @@ func (t *Task) Clone(opts *CloneOptions) (ThreadID, *SyscallControl, error) { UTSNamespace: utsns, IPCNamespace: ipcns, } + if opts.NewThreadGroup { + cfg.Parent = t + } else { + cfg.InheritParent = t + } if opts.NewNetworkNamespace { cfg.NetworkNamespaced = true } |