From 44f722f14bdfced0c9a21711ead6c5be5a34f470 Mon Sep 17 00:00:00 2001
From: Simon South <ssouth@simonsouth.com>
Date: Wed, 7 Oct 2015 13:53:06 -0400
Subject: [PATCH] kernel: Don't send SIGTTOU if calling thread is blocking it
POSIX requires SIGTTOU to be sent to a process in a background process
group that tries to change the foreground process group ID associated
with its controlling terminal, unless the process is ignoring SIGTTOU or
the calling thread is blocking it. Previously the code checked the
former condition but not the latter, making it possible for calls to
tcsetpgrp() to get stuck in a loop and never return.
Should fix #3417.
---
src/system/kernel/team.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/system/kernel/team.cpp b/src/system/kernel/team.cpp
index 3fb33aa..83fa900 100644
a
|
b
|
team_set_foreground_process_group(int32 ttyIndex, pid_t processGroupID)
|
2948 | 2948 | // ignore or block SIGTTOU. Otherwise the group gets a SIGTTOU. |
2949 | 2949 | if (session->foreground_group != -1 |
2950 | 2950 | && session->foreground_group != team->group_id |
2951 | | && team->SignalActionFor(SIGTTOU).sa_handler != SIG_IGN) { |
| 2951 | && team->SignalActionFor(SIGTTOU).sa_handler != SIG_IGN |
| 2952 | && (thread->sig_block_mask & SIGNAL_TO_MASK(SIGTTOU)) == 0) { |
2952 | 2953 | InterruptsSpinLocker signalLocker(team->signal_lock); |
2953 | 2954 | |
2954 | 2955 | if (!is_team_signal_blocked(team, SIGTTOU)) { |