freebsd-dev/sys
Konstantin Belousov 6b286ee8b5 Currently, when signal is delivered to the process and there is a thread
not blocking the signal, signal is placed on the thread sigqueue. If
the selected thread is in kernel executing thr_exit() or sigprocmask()
syscalls, then signal might be not delivered to usermode for arbitrary
amount of time, and for exiting thread it is lost.

Put process-directed signals to the process queue unconditionally,
selecting the thread to deliver the signal only by the thread returning
to usermode, since only then the thread can handle delivery of signal
reliably. For exiting thread or thread that has blocked some signals,
check whether the newly blocked signal is queued for the process, and
try to find a thread to wakeup for delivery, in reschedule_signal(). For
exiting thread, assume that all signals are blocked.

Change cursig() and postsig() to look both into the thread and process
signal queues. When there is a signal that thread returning to usermode
could consume, TDF_NEEDSIGCHK flag is not neccessary set now. Do
unlocked read of p_siglist and p_pendingcnt to check for queued signals.

Note that thread that has a signal unblocked might get spurious wakeup
and EINTR from the interruptible system call now, due to the possibility
of being selected by reschedule_signals(), while other thread returned
to usermode earlier and removed the signal from process queue. This
should not cause compliance issues, since the thread has not blocked a
signal and thus should be ready to receive it anyway.

Reported by:	Justin Teller <justin.teller gmail com>
Reviewed by:	davidxu, jilles
MFC after:	1 month
2009-10-11 16:49:30 +00:00
..
amd64 Define architectural load bases for PIE binaries. Addresses were selected 2009-10-10 15:31:24 +00:00
arm Define architectural load bases for PIE binaries. Addresses were selected 2009-10-10 15:31:24 +00:00
boot lindev(4) [1] is supposed to be a collection of linux-specific pseudo 2009-09-26 12:45:28 +00:00
bsm Add audit events for process descriptor system calls, which will appear in 2009-09-29 21:25:59 +00:00
cam Export disk serial numbers for adaX disks. 2009-10-09 09:29:59 +00:00
cddl Allow file system owner to modify system flags if securelevel permits. 2009-10-08 16:05:17 +00:00
compat Make sure that the primary native brandinfo always gets added 2009-10-03 11:57:21 +00:00
conf cxgb(4) updates, including: 2009-10-05 20:21:41 +00:00
contrib Use __FBSDID to embed RCS ID. 2009-09-21 08:37:57 +00:00
crypto
ddb Put square backets ([]) around process names for system processes to patch 2009-10-01 19:12:14 +00:00
dev Add support for Intel G41 chipset 2009-10-11 01:54:00 +00:00
fs Add locking around access to parent node, and bail out when the parent 2009-10-11 07:03:56 +00:00
gdb
geom If provider is open for writing when we taste it, skip it for classes that 2009-10-09 09:42:22 +00:00
gnu Fix the build by using proper format. 2009-06-25 16:48:13 +00:00
i386 Define architectural load bases for PIE binaries. Addresses were selected 2009-10-10 15:31:24 +00:00
ia64 Define architectural load bases for PIE binaries. Addresses were selected 2009-10-10 15:31:24 +00:00
isa Tweak the way that the ACPI and ISA bus drivers match hint devices to 2009-08-24 21:51:46 +00:00
kern Currently, when signal is delivered to the process and there is a thread 2009-10-11 16:49:30 +00:00
kgssapi When the KOBJMETHOD() macro was updated, it resulted in the 2009-06-14 17:33:46 +00:00
libkern done method is supposed to return int. 2009-06-22 22:09:18 +00:00
mips Define architectural load bases for PIE binaries. Addresses were selected 2009-10-10 15:31:24 +00:00
modules Fix typo which has survived amazingly long! 2009-10-10 03:32:46 +00:00
net Virtualize the pfil hooks so that different jails may chose different 2009-10-11 05:59:43 +00:00
net80211 Update 802.11s mesh support to draft 3.03. This includes a revised frame 2009-09-22 18:18:14 +00:00
netatalk Reverse misordered unlock and lock in at_control for netatalk phase I 2009-08-12 10:44:13 +00:00
netgraph Virtualize the pfil hooks so that different jails may chose different 2009-10-11 05:59:43 +00:00
netinet Fix a race condition where a mutex was destroyed while sleeping on it. 2009-10-11 12:23:56 +00:00
netinet6 Virtualize the pfil hooks so that different jails may chose different 2009-10-11 05:59:43 +00:00
netipsec Changed an IPSEC_ASSERT to a simple test, as such invalid packets 2009-10-01 15:33:53 +00:00
netipx Use queue(9) instead of hand-crafted link lists for the global IPX 2009-06-24 20:57:50 +00:00
netnatm
netncp
netsmb Don't print out a message on loading a module. 'kldload -v' and 'kldstat 2009-09-10 18:33:08 +00:00
nfs Revert rev 192323 (nfs_common.c only): 2009-07-12 03:53:52 +00:00
nfsclient Reverting the previous change for now. Some users reports the patch 2009-09-15 22:09:42 +00:00
nfsserver Ensure that tv_sec is between INT32_MIN and INT32_MAX, so ZFS won't object. 2009-09-26 18:23:16 +00:00
nlm Handle GRANTED_RES messages more gracefully: Send along a grant cookie 2009-10-07 19:50:14 +00:00
opencrypto If crypto operation is finished with EAGAIN, don't repeat operation from 2009-09-04 09:48:18 +00:00
pc98 MFi386: revision 197653 2009-10-01 10:46:22 +00:00
pci intpm/sb700: force polling mode if configured interrupt is SMI 2009-09-19 08:56:28 +00:00
powerpc Correct another typo. Actually save the condition register instead 2009-10-11 16:44:58 +00:00
rpc Set the prison in NFS anon and GSS SVC creds (as I indended to in r197581). 2009-09-28 18:55:29 +00:00
security Having thrown the cat out of the house, add a necessary include. 2009-09-08 13:24:36 +00:00
sparc64 Define architectural load bases for PIE binaries. Addresses were selected 2009-10-10 15:31:24 +00:00
sun4v Define architectural load bases for PIE binaries. Addresses were selected 2009-10-10 15:31:24 +00:00
sys Currently, when signal is delivered to the process and there is a thread 2009-10-11 16:49:30 +00:00
teken Discard Device Control Strings and Operating System Commands. 2009-10-08 10:26:49 +00:00
tools - Increase dynamic range of filter coefficients from 28bit to 30bit. 2009-07-05 18:15:06 +00:00
ufs Don't build ufs_gjournal.c at all if UFS_GJOURNAL option is not given 2009-09-22 16:22:05 +00:00
vm Align and pad the page queue and free page queue locks so that the linker 2009-10-04 18:53:10 +00:00
xdr Add a check for a NULL mbuf ptr at the beginning of xdrmbuf_inline() 2009-08-12 16:27:51 +00:00
xen Temporarily revert the new-bus locking for 8.0 release. It will be 2009-08-20 19:17:53 +00:00
Makefile