freebsd-dev/sys
Konstantin Belousov 84cdea97e5 Right now, the process' p_boundary_count counter is decremented by the
suspended thread itself, on the return path from
thread_suspend_check().  A consequence is that return from
thread_single_end(SINGLE_BOUNDARY) may leave p_boundary_count
non-zero, it might be even equal to the threads count.

Now, assume that we have two threads in the process, both calling
execve(2).  Suppose that the first thread won the race to be the
suspension thread, and that afterward its exec failed for any reason.
After the first thread did thread_single_end(SINGLE_BOUNDARY), second
thread becomes the process suspension thread and checks
p_boundary_count.  The non-zero value of the count allows the
suspension loop to finish without actually suspending some threads.
In other words, we enter exec code with some threads not suspended.

Fix this by decrementing p_boundary_count in the
thread_single_end()->thread_unsuspend_one() during marking the thread
as runnable.  This way, a return from thread_single_end() guarantees
that the counter is cleared.  We do not care whether the unsuspended
thread has a chance to run.

Add some asserts to ensure the state of the process when single
boundary suspension is lifted.  Also make thread_unuspend_one()
static.

In collaboration with:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2015-05-15 07:54:31 +00:00
..
amd64 Add nvme and nvd drivers to GENERIC for amd64 and i386. 2015-05-14 20:19:22 +00:00
arm It appears to be armv7_sleep is a duplication of armv7_cpu_sleep. 2015-05-15 00:39:51 +00:00
arm64 Build GENERIC with RACCT/RCTL support by default. Note that it still 2015-05-14 14:03:55 +00:00
boot Remove OUTPUT_FORMAT from theARM EFI linker script, it breaks building 2015-05-14 12:43:39 +00:00
bsm
cam Handle EDQUOT backend storage errors same as ENOSPC. 2015-05-06 19:47:31 +00:00
cddl Add copyright info missing from r282205 2015-05-14 08:13:01 +00:00
compat On exec, single-threading must be enforced before arguments space is 2015-05-10 09:00:40 +00:00
conf Build GENERIC with RACCT/RCTL support by default. Note that it still 2015-05-14 14:03:55 +00:00
contrib Move ALTQ from contrib to net/altq. The ALTQ code is for many years 2015-04-16 20:22:40 +00:00
crypto In the version of gcc in the FreeBSD tree, this modification was made to 2015-04-16 17:42:52 +00:00
ddb
dev sfxge: split sfxge_tx_qdpl_put() into *_locked() and *_unlocked() 2015-05-15 06:50:59 +00:00
fs Do not promote large async writes to sync. 2015-05-14 10:04:42 +00:00
gdb
geom Add apple-boot, apple-hfs and apple-ufs aliases to MBR scheme. 2015-05-05 09:33:02 +00:00
gnu The GNU Amlogic DTS files have some errors (e.g. bad register 2015-04-11 08:17:39 +00:00
i386 Add nvme and nvd drivers to GENERIC for amd64 and i386. 2015-05-14 20:19:22 +00:00
isa
kern Right now, the process' p_boundary_count counter is decremented by the 2015-05-15 07:54:31 +00:00
kgssapi
libkern Move zlib.c from net to libkern. 2015-04-22 14:38:58 +00:00
mips The add_bounce_page() function can be called when loading physical 2015-04-28 06:12:37 +00:00
modules Include makefiles necessary to make ixgbe build with the new code. 2015-04-30 22:56:43 +00:00
net Add new socket ioctls SIOC[SG]TUNFIB to set FIB number of encapsulated 2015-05-12 07:37:27 +00:00
net80211 Do not check sequence number for QoS Null frames; set it for generated QoS Null 2015-05-12 16:55:50 +00:00
netgraph Move zlib.c from net to libkern. 2015-04-22 14:38:58 +00:00
netinet Ensure that the COOKIE-ACK can be sent over UDP if the COOKIE-ECHO was 2015-05-12 08:08:16 +00:00
netinet6 - Remove ND6_IFF_IGNORELOOP. This functionality was useless in practice 2015-05-12 03:31:57 +00:00
netipsec Fix the comment. We will not do SPD lookup again, because 2015-04-28 11:03:47 +00:00
netnatm
netpfil bugfix (only affecting the "lookup" option in the userspace version of ipfw): 2015-05-13 11:53:25 +00:00
netsmb
nfs Avoid closing unallocated socket in case socreate fails. 2015-02-28 20:30:29 +00:00
nfsclient Remove some oldnfs remnants. 2015-04-18 16:08:06 +00:00
nfsserver
nlm
ofed Apply proper locking when iterating the multicast addresses and add a 2015-05-12 11:52:34 +00:00
opencrypto Move zlib.c from net to libkern. 2015-04-22 14:38:58 +00:00
pc98 Build GENERIC with RACCT/RCTL support by default. Note that it still 2015-05-14 14:03:55 +00:00
powerpc Build GENERIC with RACCT/RCTL support by default. Note that it still 2015-05-14 14:03:55 +00:00
rpc Remove hard limits on number of accepting NFS connections. 2015-04-07 10:25:27 +00:00
security cred: add proc_set_cred helper 2015-03-16 00:10:03 +00:00
sparc64 Build GENERIC with RACCT/RCTL support by default. Note that it still 2015-05-14 14:03:55 +00:00
sys Right now, the process' p_boundary_count counter is decremented by the 2015-05-15 07:54:31 +00:00
teken
tools
ufs Limit the number of cylinder groups that will be searched when 2015-04-24 23:27:50 +00:00
vm Satisfy vm_object uma zone destructor requirements after r282660 when 2015-05-10 08:21:03 +00:00
x86 Rewrite amd64 PCID implementation to follow an algorithm described in 2015-05-09 19:11:01 +00:00
xdr
xen xen: introduce a newbus function to allocate unused memory 2015-05-08 14:48:40 +00:00
Makefile