]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Fix a race in tty_signal_sessleader() with unlocked read of s_leader.
authorkib <kib@FreeBSD.org>
Thu, 17 Dec 2020 19:51:39 +0000 (19:51 +0000)
committerkib <kib@FreeBSD.org>
Thu, 17 Dec 2020 19:51:39 +0000 (19:51 +0000)
commita4803cd1d39a9bb4cd45ceb41986df722bf5f8d8
tree5d17034dc32d257c8c89e7adbe6e9f7ba2f65fef
parentaac4f2b12864ae0c7b94eb99eb494b1dc2546ddb
Fix a race in tty_signal_sessleader() with unlocked read of s_leader.

Since we do not own the session lock, a parallel killjobc() might
reset s_leader to NULL after we checked it.  Read s_leader only once
and ensure that compiler is not allowed to reload.

While there, make access to t_session somewhat more pretty by using
local variable.

PR: 251915
Submitted by: Jakub Piecuch <j.piecuch96@gmail.com>
MFC after: 1 week
sys/kern/tty.c