summaryrefslogtreecommitdiffhomepage
path: root/pkg
diff options
context:
space:
mode:
authorgystemd <gystemd@gmail.com>2021-08-10 13:06:51 +0200
committergystemd <gystemd@gmail.com>2021-08-10 13:06:51 +0200
commitf971396c6515fc71d3cc8cdfbf60845c1d1e9e03 (patch)
tree7b97bf9660ff068b06f78981f95f74379a22f78c /pkg
parent14d6cb4436f19d0500e98179c3215517f1a77b08 (diff)
fix missing SIGTTOU signal in SetForegroundProcessGroup
Diffstat (limited to 'pkg')
-rw-r--r--pkg/sentry/kernel/thread_group.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/pkg/sentry/kernel/thread_group.go b/pkg/sentry/kernel/thread_group.go
index 2eda15303..6d865b814 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,11 @@ func (tg *ThreadGroup) SetForegroundProcessGroup(tty *TTY, pgid ProcessGroupID)
return -1, linuxerr.EPERM
}
+ //if the calling process is a member of a background group, a SIGTTOU signal is sent to all members of this background process group.
+ if tg.processGroup.session.foreground.id != tg.processGroup.id {
+ tg.processGroup.SendSignal(&linux.SignalInfo{Signo: int32(linux.SIGTTOU)})
+ }
+
tg.processGroup.session.foreground.id = pgid
return 0, nil
}