]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit - sys/kern/tty.c
Check for process group change in tty_wait_background().
authorKonstantin Belousov <kib@FreeBSD.org>
Wed, 28 Oct 2020 22:12:47 +0000 (22:12 +0000)
committerKonstantin Belousov <kib@FreeBSD.org>
Wed, 28 Oct 2020 22:12:47 +0000 (22:12 +0000)
commit3cbf9dc81c0436b11fca7829c55bcc94fdb4e52c
tree4f69a57860aab30fcfe147b5f2747d7a08ae288e
parent1ef64e3da5fb023436893a635e336e591aba120a
Check for process group change in tty_wait_background().

The calling process's process group can change between PROC_UNLOCK(p)
and PGRP_LOCK(pg) in tty_wait_background(), e.g. by a setpgid() call
from another process. If that happens, the signal is not sent to the
calling process, even if the prior checks determine that one should be
sent.  Re-check that the process group hasn't changed after acquiring
the pgrp lock, and if it has, redo the checks.

PR: 250701
Submitted by: Jakub Piecuch <j.piecuch96@gmail.com>
MFC after: 2 weeks
sys/kern/tty.c