summaryrefslogtreecommitdiffhomepage
path: root/pkg
diff options
context:
space:
mode:
authorgystemd <gystemd@gmail.com>2021-08-16 16:33:57 +0200
committergystemd <gystemd@gmail.com>2021-08-16 16:33:57 +0200
commit7c5ab794f140dda031ba015d79892a79dd523d50 (patch)
tree0672e441b123daece03dcf43c18c6111a366c301 /pkg
parentf971396c6515fc71d3cc8cdfbf60845c1d1e9e03 (diff)
fix sending of SIGTTOU signal in SetForegroundProcessGroup
Changed sendSignal to sendSignalLocked because tg.pidns.owner.mu and tg.signalHandlers.mu are already locked in SetForegroundProcess Added a control to verify whether the calling process is ignoring SIGTTOU before sending the signal
Diffstat (limited to 'pkg')
-rw-r--r--pkg/sentry/kernel/thread_group.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/pkg/sentry/kernel/thread_group.go b/pkg/sentry/kernel/thread_group.go
index 6d865b814..c16b9eb37 100644
--- a/pkg/sentry/kernel/thread_group.go
+++ b/pkg/sentry/kernel/thread_group.go
@@ -511,9 +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)})
+ 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{
+ tg.leader.sendSignalLocked(SignalInfoPriv(linux.SIGTTOU),true)
}
tg.processGroup.session.foreground.id = pgid