diff options
author | Jamie Liu <jamieliu@google.com> | 2018-07-09 16:15:14 -0700 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2018-07-09 16:16:19 -0700 |
commit | 41aeb680b1882c9416e25e100b5ff5eebead36de (patch) | |
tree | 455f9a1451fa030888d7e6a6c4b448b776998b67 /pkg/sentry/kernel/task_start.go | |
parent | bf0fa0953763035df6af6fdf7eab3b8c163d90e0 (diff) |
Inherit parent in clone(CLONE_THREAD) under TaskSet.mu.
PiperOrigin-RevId: 203849534
Change-Id: I4d81513bfd32e0b7fc40c8a4c194eba7abc35a83
Diffstat (limited to 'pkg/sentry/kernel/task_start.go')
-rw-r--r-- | pkg/sentry/kernel/task_start.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/pkg/sentry/kernel/task_start.go b/pkg/sentry/kernel/task_start.go index 801cb3395..c97dee8fc 100644 --- a/pkg/sentry/kernel/task_start.go +++ b/pkg/sentry/kernel/task_start.go @@ -31,6 +31,10 @@ type TaskConfig struct { // Parent is the new task's parent. Parent may be nil. Parent *Task + // If InheritParent is not nil, use InheritParent's parent as the new + // task's parent. + InheritParent *Task + // ThreadGroup is the ThreadGroup the new task belongs to. *ThreadGroup @@ -133,6 +137,9 @@ func (ts *TaskSet) newTask(cfg *TaskConfig) (*Task, error) { // IDs). t.updateLogPrefixLocked() + if cfg.InheritParent != nil { + t.parent = cfg.InheritParent.parent + } if t.parent != nil { t.parent.children[t] = struct{}{} } |