kernel - Fix signal masking race assertion panic w/vkernel
authorMatthew Dillon <dillon@apollo.backplane.com>
Sun, 1 Apr 2012 01:30:13 +0000 (18:30 -0700)
committerVenkatesh Srinivas <me@endeavour.zapto.org>
Fri, 13 Apr 2012 02:46:30 +0000 (19:46 -0700)
commit53d9c08eb0d6e87cd71c76749423a65f0e4a59e2
tree3d79ec12f3ad0b3eaf2e0d8162717249a86a4021
parent2e32384e0af838fa8889394f1bd9bdb84180454b
kernel - Fix signal masking race assertion panic w/vkernel

* sigsuspend() and pselect() record the old signal mask in order to
  allow an interrupting signal to run its handler before the old mask
  is restored.

* When multiple threads are present a race can ensue where another thread
  changes the signal handler after sigsuspend() or pselect() have interrupted,
  but before they are able to process the signal.

* If the signal is no longer enabled the old signal mask is not restored
  on system call return, resulting in an assertion and panic.

* Fix the problem by checking the flag and restoring the old signal mask
  on return (rather than asserting when the flag is found to be non-zero
  on return).

Reported-by: Venkatesh Srinivas
sys/platform/pc32/i386/trap.c
sys/platform/pc64/x86_64/trap.c
sys/platform/vkernel/i386/trap.c
sys/platform/vkernel64/x86_64/trap.c