Don't send a signal to a controlling thread group if one has not been set.

Reported-by: syzbot+6ffd4294901528c6fd54@syzkaller.appspotmail.com
PiperOrigin-RevId: 512678427
This commit is contained in:
Nicolas Lacasse
2023-02-27 11:21:34 -08:00
committed by gVisor bot
parent 3875c3f2ea
commit 8a1845f8b8
+8
View File
@@ -49,7 +49,15 @@ func (tg *ThreadGroup) TTY() *TTY {
func (tty *TTY) SignalForegroundProcessGroup(info *linux.SignalInfo) {
tty.mu.Lock()
defer tty.mu.Unlock()
tg := tty.tg
if tg == nil {
// This TTY is not a controlling thread group. This can happen
// if it was opened with O_NOCTTY, or if it failed the checks
// on session and leaders in SetControllingTTY(). There is
// nothing to signal.
return
}
tg.pidns.owner.mu.Lock()
tg.signalHandlers.mu.Lock()