kernel - Don't block in tstop() with locks held
commitba69e3575bf077f1f9b6a38b9bf6782025f1b8e9
authorMatthew Dillon <dillon@backplane.com>
Wed, 29 May 2019 21:33:07 +0000 (29 14:33 -0700)
committerMatthew Dillon <dillon@backplane.com>
Thu, 30 May 2019 05:35:28 +0000 (29 22:35 -0700)
treecf65c6f67997038f97f1784cec561c0999cad579
parent14454ceb81d57b7d7ba4c3582fc83f1165e1e3ed
kernel - Don't block in tstop() with locks held

* There are several places where the kernel improperly blocks on a
  STOP signal while locks might be held.  This is a particular problem
  when PCATCH is specified e.g. in the middle of the NFS code.  It is
  meant to catch INTR but it also improperly allowed STOP to function
  and left the vnode lock held.

  Several other places in the kernel also use PCATCH and don't expect
  the kernel to actually block indefinitely on a STOP.

* Don't block in STOP in these situations.  Simply mark the thread as
  stopped and wait until it tries to return to userland before actually
  stopping.

  Any kernel subsystems which desire to act on the STOP in-line instead
  of upon return to userland can do so manually, as long as they release
  all locks for the duration.
sys/kern/kern_exit.c
sys/kern/kern_sig.c