Date: Fri, 22 May 2020 09:00:22 +0000 (UTC) From: Hans Petter Selasky <hselasky@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r361357 - stable/11/sys/kern Message-ID: <202005220900.04M90Me5016491@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: hselasky Date: Fri May 22 09:00:22 2020 New Revision: 361357 URL: https://svnweb.freebsd.org/changeset/base/361357 Log: MFC r361075: 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() Sponsored by: Mellanox Technologies Modified: stable/11/sys/kern/tty.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/tty.c ============================================================================== --- stable/11/sys/kern/tty.c Fri May 22 08:59:12 2020 (r361356) +++ stable/11/sys/kern/tty.c Fri May 22 09:00:22 2020 (r361357) @@ -1807,7 +1807,6 @@ tty_generic_ioctl(struct tty *tp, u_long cmd, void *da tp->t_session = p->p_session; tp->t_session->s_ttyp = tp; tp->t_sessioncnt++; - sx_xunlock(&proctree_lock); /* Assign foreground process group. */ tp->t_pgrp = p->p_pgrp; @@ -1815,6 +1814,7 @@ tty_generic_ioctl(struct tty *tp, u_long cmd, void *da p->p_flag |= P_CONTROLT; PROC_UNLOCK(p); + sx_xunlock(&proctree_lock); return (0); } case TIOCSPGRP: {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202005220900.04M90Me5016491>