diff options
author | gVisor bot <gvisor-bot@google.com> | 2021-08-24 23:50:40 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-08-24 23:50:40 +0000 |
commit | 13baaa1016ccd678321874018dc692b4826bb5c3 (patch) | |
tree | a0f6637c7512cd1cc18d1cee8a9109bc7c552b00 /pkg | |
parent | 906150fc839000c3c04b0cfec366adcd4591c0a5 (diff) | |
parent | 18beb67703aa1d7a682bd851894632f2d1a0a730 (diff) |
Merge release-20210816.0-37-g18beb6770 (automated)
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/sentry/kernel/thread_group.go | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/pkg/sentry/kernel/thread_group.go b/pkg/sentry/kernel/thread_group.go index 2eda15303..5814a4eca 100644 --- a/pkg/sentry/kernel/thread_group.go +++ b/pkg/sentry/kernel/thread_group.go @@ -489,11 +489,6 @@ func (tg *ThreadGroup) SetForegroundProcessGroup(tty *TTY, pgid ProcessGroupID) tg.signalHandlers.mu.Lock() defer tg.signalHandlers.mu.Unlock() - // TODO(gvisor.dev/issue/6148): "If tcsetpgrp() is called by a member of a - // background process group in its session, and the calling process is not - // blocking or ignoring SIGTTOU, a SIGTTOU signal is sent to all members of - // this background process group." - // tty must be the controlling terminal. if tg.tty != tty { return -1, linuxerr.ENOTTY @@ -516,6 +511,16 @@ func (tg *ThreadGroup) SetForegroundProcessGroup(tty *TTY, pgid ProcessGroupID) return -1, linuxerr.EPERM } + signalAction := tg.signalHandlers.actions[linux.SIGTTOU] + // If the calling process is a member of a background group, a SIGTTOU + // signal is sent to all members of this background process group. + // We need also need to check whether it is ignoring or blocking SIGTTOU. + ignored := signalAction.Handler == linux.SIG_IGN + blocked := tg.leader.signalMask == linux.SignalSetOf(linux.SIGTTOU) + if tg.processGroup.id != tg.processGroup.session.foreground.id && !ignored && !blocked { + tg.leader.sendSignalLocked(SignalInfoPriv(linux.SIGTTOU), true) + } + tg.processGroup.session.foreground.id = pgid return 0, nil } |