summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry
diff options
context:
space:
mode:
authorgystemd <gystemd@gmail.com>2021-08-17 22:57:39 +0200
committergystemd <gystemd@gmail.com>2021-08-17 23:40:25 +0200
commit482de52b60d9ac0bc40f264c82c8eb094401a119 (patch)
tree74968e962129b1bbbcc30bf86eab88b6c98dbfaf /pkg/sentry
parenta5f2ef66d3c7e5ed1fd90cc8670b3e3891ad8af9 (diff)
Added a SIGTTOU block check in SetForegroundProcessGroup
Diffstat (limited to 'pkg/sentry')
-rw-r--r--pkg/sentry/kernel/thread_group.go11
1 files changed, 7 insertions, 4 deletions
diff --git a/pkg/sentry/kernel/thread_group.go b/pkg/sentry/kernel/thread_group.go
index c16b9eb37..0f741602d 100644
--- a/pkg/sentry/kernel/thread_group.go
+++ b/pkg/sentry/kernel/thread_group.go
@@ -511,10 +511,13 @@ func (tg *ThreadGroup) SetForegroundProcessGroup(tty *TTY, pgid ProcessGroupID)
return -1, linuxerr.EPERM
}
- sa:= 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.
- if tg.processGroup.id != tg.processGroup.session.foreground.id && sa.Handler!=linux.SIG_IGN{
+ 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)
}