]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Fetch the sigfastblock value in syscalls that wait for signals
authorJonathan T. Looney <jtl@FreeBSD.org>
Fri, 12 Mar 2021 18:14:17 +0000 (18:14 +0000)
committerJonathan T. Looney <jtl@FreeBSD.org>
Fri, 12 Mar 2021 18:14:17 +0000 (18:14 +0000)
commitdbec10e08808e375365fb2a2462f306e0cdfda32
treee8b903cccb1ab15b3e24c726881f29d75d2ae74a
parent40d593d17eb6d70ea717d6546a16794858944176
Fetch the sigfastblock value in syscalls that wait for signals

We have seen several cases of processes which have become "stuck" in
kern_sigsuspend(). When this occurs, the kernel's td_sigblock_val
is set to 0x10 (one block outstanding) and the userspace copy of the
word is set to 0 (unblocked). Because the kernel's cached value
shows that signals are blocked, kern_sigsuspend() blocks almost all
signals, which means the process hangs indefinitely in sigsuspend().

It is not entirely clear what is causing this condition to occur.
However, it seems to make sense to add some protection against this
case by fetching the latest sigfastblock value from userspace for
syscalls which will sleep waiting for signals. Here, the change is
applied to kern_sigsuspend() and kern_sigtimedwait().

Reviewed by: kib
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D29225
sys/kern/kern_sig.c