From fe4f4789601ddf61260271f7e1d33ba0f2756fcd Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Tue, 9 Feb 2021 10:34:49 -0800 Subject: kernel: reparentLocked has to update children maps of old and new parents Reported-by: syzbot+9ffc71246fe72c73fc25@syzkaller.appspotmail.com PiperOrigin-RevId: 356536113 --- pkg/sentry/kernel/task_exit.go | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'pkg') 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().) -- cgit v1.2.3