mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Clean up tty.CheckChange and call it in SetForegroundProcessGroup.
Previously, CheckChange (corresponding to Linux's tty/tty_check_change()) was only used the host TTY implementation, not the devpts implementation. Furthermore, ThreadGroup.SetForegroundProcessGroup() duplicated some of the logic in CheckChange, notably sending SIGTTOU to background tasks. This means that, for host TTYs, we could send SIGTTOU multiple times. In some circumstances, this leads the ioctl returning ERESTARTSYS in an infinite loop. PiperOrigin-RevId: 735934036
This commit is contained in:
committed by
gVisor bot
parent
93536059ca
commit
f9b1ce2f7d
@@ -198,7 +198,7 @@ func (mfd *masterFileDescription) Ioctl(ctx context.Context, io usermem.IO, sysn
|
||||
if _, err := pgid.CopyIn(t, args[2].Pointer()); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return 0, t.ThreadGroup().SetForegroundProcessGroupID(mfd.t.masterKTTY, kernel.ProcessGroupID(pgid))
|
||||
return 0, t.ThreadGroup().SetForegroundProcessGroupID(ctx, mfd.t.masterKTTY, kernel.ProcessGroupID(pgid))
|
||||
default:
|
||||
maybeEmitUnimplementedEvent(ctx, sysno, cmd)
|
||||
return 0, linuxerr.ENOTTY
|
||||
|
||||
@@ -188,7 +188,7 @@ func (rfd *replicaFileDescription) Ioctl(ctx context.Context, io usermem.IO, sys
|
||||
if _, err := pgid.CopyIn(t, args[2].Pointer()); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return 0, t.ThreadGroup().SetForegroundProcessGroupID(rfd.inode.t.replicaKTTY, kernel.ProcessGroupID(pgid))
|
||||
return 0, t.ThreadGroup().SetForegroundProcessGroupID(ctx, rfd.inode.t.replicaKTTY, kernel.ProcessGroupID(pgid))
|
||||
default:
|
||||
maybeEmitUnimplementedEvent(ctx, sysno, cmd)
|
||||
return 0, linuxerr.ENOTTY
|
||||
|
||||
Reference in New Issue
Block a user