]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Assign process group of the TTY under the "proctree_lock".
authorhselasky <hselasky@FreeBSD.org>
Fri, 15 May 2020 12:47:39 +0000 (12:47 +0000)
committerhselasky <hselasky@FreeBSD.org>
Fri, 15 May 2020 12:47:39 +0000 (12:47 +0000)
commit5079660689ae430b6aa709fcfb735b6d69a37adf
treefef1368f4364e597119eb226c0ee08f627723276
parentcd7df7d17dd013c4f3079218e503142f5bd9ef80
Assign process group of the TTY under the "proctree_lock".

This fixes a race where concurrent calls to doenterpgrp() and
leavepgrp() while TIOCSCTTY is executing may result in tp->t_pgrp
changing value so that tty_rel_pgrp() misses clearing it to NULL. For
more details refer to the use of pgdelete() in the kernel.

No functional change intended.

Panic backtrace:
__mtx_lock_sleep() # page fault due to using destroyed mutex
tty_signal_pgrp()
tty_ioctl()
ptsdev_ioctl()
kern_ioctl()
sys_ioctl()
amd64_syscall()

MFC after: 1 week
Sponsored by: Mellanox Technologies
sys/kern/tty.c