HomeFreeBSD

Fetch the sigfastblock value in syscalls that wait for signals

Description

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().

Approved by: re (gjb)

(cherry picked from commit dbec10e08808e375365fb2a2462f306e0cdfda32)
(cherry picked from commit a25c17022e2d6344dcbc6192af276d2798d76d44)

Details

Provenance
jtlAuthored on Mar 12 2021, 6:14 PM
Parents
rG6605a2a1634f: Teach DTrace that unaligned accesses are OK on aarch64, not just x86.
Branches
Unknown
Tags
Unknown