Development record
A SIGTSTP sent from outside (kill -TSTP, not the Ctrl-Z key, which raw mode delivers as a byte) stops an abcd process that holds a term.RawSession with the terminal still raw; SIGTTIN and SIGTTOU sent from outside do the same. On SIGCONT the session enters raw mode again and redraws, so only the stopped interval is affected. The fix the security review of the answer loop proposed (catch SIGTSTP with signal.Notify, then signal.Reset and kill(self, SIGTSTP) to stop) does not work in Go: a scratch probe (Notify, Reset, then kill(getpid, SIGTSTP)) showed the process is never stopped, because the runtime keeps its own handler installed for SIGTSTP once it has been notified (runtime sigdisable leaves it while sigInstallGoHandler is true) and that handler drops an unwanted SIGTSTP. Catching it would therefore make SIGTSTP ignored for the rest of the process, Ctrl-Z in cooked mode after the interview included, and would swallow the kill(0, SIGTSTP) RawSession.Suspend stops with.
A SIGTSTP sent from outside (kill -TSTP, not the Ctrl-Z key, which raw mode delivers as a byte) stops an abcd process that holds a term.RawSession with the terminal still raw; SIGTTIN and SIGTTOU sent from outside do the same. On SIGCONT the session enters raw mode again and redraws, so only the stopped interval is affected. The fix the security review of the answer loop proposed (catch SIGTSTP with signal.Notify, then signal.Reset and kill(self, SIGTSTP) to stop) does not work in Go: a scratch probe (Notify, Reset, then kill(getpid, SIGTSTP)) showed the process is never stopped, because the runtime keeps its own handler installed for SIGTSTP once it has been notified (runtime sigdisable leaves it while sigInstallGoHandler is true) and that handler drops an unwanted SIGTSTP. Catching it would therefore make SIGTSTP ignored for the rest of the process, Ctrl-Z in cooked mode after the interview included, and would swallow the kill(0, SIGTSTP) RawSession.Suspend stops with.
Grounds
- declined: catching SIGTSTP in Go leaves the runtime's handler installed and drops the signal (probe in the fix round), so the review's fix would disable job control process-wide; the shell already restores the terminal across a stop
Frontmatter
| id | iss-2610032115023656 |
|---|---|
| type | issue |
| lifecycle | wontfix |
| severity | minor |
.abcd/work/issues/wontfix/iss-2610032115023656-a-sigtstp-sent-from-outside-kill-tstp.md
open on GitHub ↗ · commit history ↗
mentions1
- dcn-26100300000000032026-10-03 — Decided without a question (the person's ruling that an obvious answer is decided; recorded by abcd-e8): iss-2610032115023656, a SIGTSTP sent from outside stopping the plain-Terminal answer loop with the terminal raw, is won't-fix under its remedy A. An interactive job-control shell restores its own terminal state when a foreground job stops, and the session re-enters raw mode and redraws once on SIGCONT (pinned by the fix round's pty case). Remedy B, process-wide stop handling in internal/term with the kernel's orphaned-process-group rule reimplemented, risks a stopped abcd that nobody continues. The security review's own fix does not work in Go, because the runtime keeps its handler and drops the signal. Alternative not taken: remedy B.