mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
kernel: use the kernel context to run task destroy actions
A task context can be used only if actions are executed in a task goroutine. In addition, these actions are executed asynchronously, so the task can be destroyed. Reported-by: syzbot+a9f3e03ea801374b8089@syzkaller.appspotmail.com PiperOrigin-RevId: 706078457
This commit is contained in:
@@ -798,13 +798,14 @@ func (t *Task) execOnDestroyActions() {
|
||||
if len(actions) == 0 {
|
||||
return
|
||||
}
|
||||
ctx := t.k.SupervisorContext()
|
||||
// Block S/R until all actions is executed.
|
||||
t.k.tasks.aioGoroutines.Add(1)
|
||||
// Run in another goroutine to avoid extra lock dependencies.
|
||||
go func() {
|
||||
defer t.k.tasks.aioGoroutines.Done()
|
||||
for act := range actions {
|
||||
act.TaskDestroyAction(t)
|
||||
act.TaskDestroyAction(ctx)
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user