diff options
author | Andrei Vagin <avagin@google.com> | 2021-02-09 10:34:49 -0800 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-02-09 10:37:04 -0800 |
commit | fe4f4789601ddf61260271f7e1d33ba0f2756fcd (patch) | |
tree | b0d095cfb8246424bf2c2a54fa7ee4cda6914bd1 /pkg/sentry/kernel | |
parent | d6dbe6e5ca5445dac278d3b6654af8d13379878a (diff) |
kernel: reparentLocked has to update children maps of old and new parents
Reported-by: syzbot+9ffc71246fe72c73fc25@syzkaller.appspotmail.com
PiperOrigin-RevId: 356536113
Diffstat (limited to 'pkg/sentry/kernel')
-rw-r--r-- | pkg/sentry/kernel/task_exit.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/pkg/sentry/kernel/task_exit.go b/pkg/sentry/kernel/task_exit.go index 16986244c..f7765fa3a 100644 --- a/pkg/sentry/kernel/task_exit.go +++ b/pkg/sentry/kernel/task_exit.go @@ -415,6 +415,12 @@ func (tg *ThreadGroup) anyNonExitingTaskLocked() *Task { func (t *Task) reparentLocked(parent *Task) { oldParent := t.parent t.parent = parent + if oldParent != nil { + delete(oldParent.children, t) + } + if parent != nil { + parent.children[t] = struct{}{} + } // If a thread group leader's parent changes, reset the thread group's // termination signal to SIGCHLD and re-check exit notification. (Compare // kernel/exit.c:reparent_leader().) |