freebsd-skq/sys
Konstantin Belousov 1d48f121d8 Ensure that when a blockable open of fifo returns success, a valid
file descriptor opened for complimentary access exists as well.

The implementation of the guarantee is done by counting the
generations of readers and writers opens.  We return success and not
EINTR or ERESTART error, when the sleep for complimentary opening is
interrupted, but the generation was changed during the sleep.

Longer explanation: assume there are two threads, A doing open("fifo",
O_RDONLY) and B doing open("fifo", O_WRONLY), and no other threads
either trying to open the fifo, nor there are any file descriptors
referencing the fifo.  Before the change, it was possible e.g. for for
thread A to return a valid file descriptor, while thread B returned
EINTR if a signal to B was delivered simultaneously with the wakeup
from A.  After the change, in this situation both A::open() and
B::open() succeed and the signal is made "as if" it was noticed
slightly later.  Note that the signal actual delivery is not changed,
it is done by ast on syscall return path, so signal handler is still
executed before first instruction after syscall.

See PR for the code demonstrating the issue.

PR:	203162
Reported by:	Victor Stinner victor.stinner@gmail.com
Reviewed by:	jilles
Tested by:	bapt, pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2015-09-20 21:18:33 +00:00
..
amd64 Add support for weak symbols to the kernel linkers. It means that 2015-09-20 01:27:59 +00:00
arm Add alternate descriptors support for if_dwc. 2015-09-20 14:13:29 +00:00
arm64 Do not execute exception handlers with disabled interrupts. 2015-09-18 17:09:59 +00:00
boot The EFI boot loader allocates a single chunk of contiguous memory to 2015-09-17 20:36:46 +00:00
bsm
cam Mark with DMA flag I/Os waiting for iSCSI write data after R2T. 2015-09-20 11:39:19 +00:00
cddl MFV r287623: 5997 FRU field not set during pool creation and never 2015-09-13 07:15:14 +00:00
compat Fixes a panic triggered by threaded Linux applications when running 2015-09-02 14:04:13 +00:00
conf Add alternate descriptors support for if_dwc. 2015-09-20 14:13:29 +00:00
contrib Revert ip_fil_freebsd.c -r287674. This should not have gone in yet. 2015-09-11 16:52:13 +00:00
crypto const'ify an arg that we don't update... 2015-07-29 23:37:15 +00:00
ddb Make kstack_pages a tunable on arm, x86, and powepc. On i386, the 2015-08-10 17:18:21 +00:00
dev Fix the build by adding the alternate descriptors and MII clock defines. 2015-09-20 14:28:06 +00:00
fs Ensure that when a blockable open of fifo returns success, a valid 2015-09-20 21:18:33 +00:00
gdb
geom Add a way to specify stripesize and stripeoffset to gnop(8). This makes 2015-09-15 18:01:59 +00:00
gnu Fixing a memory leak on module unloading. 2015-09-11 22:43:35 +00:00
i386 Add support for weak symbols to the kernel linkers. It means that 2015-09-20 01:27:59 +00:00
isa
kern Add support for weak symbols to the kernel linkers. It means that 2015-09-20 01:27:59 +00:00
kgssapi
libkern Remove checks for __ARM_EABI__, we only build for EABI now. 2015-07-09 21:02:40 +00:00
mips Add support for weak symbols to the kernel linkers. It means that 2015-09-20 01:27:59 +00:00
modules Reimplement CTL High Availability. 2015-09-10 12:40:31 +00:00
net Simplify the way of attaching IPv6 link-layer header. 2015-09-16 14:26:28 +00:00
net80211 Add an external facing function to manually set the RX A-MPDU parameters 2015-09-18 05:01:05 +00:00
netgraph Add support for PPP-Max-Payload PPPoE tag (RFC4638). 2015-09-11 09:15:27 +00:00
netinet Use proper byteswap macro. This isn't a functional change. 2015-09-17 17:27:49 +00:00
netinet6 Cleanup nd6_cache_lladdr(). No functional changes. 2015-09-19 11:50:02 +00:00
netipsec Make IPsec work with AES-GCM and AES-ICM (aka CTR) in OCF... IPsec 2015-08-04 17:47:11 +00:00
netnatm
netpfil Simplify the way of attaching IPv6 link-layer header. 2015-09-16 14:26:28 +00:00
netsmb
nfs
nfsclient
nfsserver
nlm
ofed Fix build broken by r287861. 2015-09-16 15:40:08 +00:00
opencrypto Make IPsec work with AES-GCM and AES-ICM (aka CTR) in OCF... IPsec 2015-08-04 17:47:11 +00:00
pc98 Add missing ofw_machdep.h. Make x86 ofw_machdep.h work pc98 too. 2015-08-28 15:41:09 +00:00
powerpc Use tabs for indend. 2015-09-20 01:35:51 +00:00
rpc Set curvnet context inside the RPC code in more places. 2015-08-18 18:12:46 +00:00
security fd: make 'rights' a manadatory argument to fget* functions 2015-07-05 19:05:16 +00:00
sparc64 Add support for weak symbols to the kernel linkers. It means that 2015-09-20 01:27:59 +00:00
sys Add support for weak symbols to the kernel linkers. It means that 2015-09-20 01:27:59 +00:00
teken Sync HPA and VPA implementations with CUP. 2015-08-24 07:49:27 +00:00
tools
ufs Do not consume extra reference. This is a bug in r287479. 2015-09-05 12:28:18 +00:00
vm Correct a non-fatal error in vm_pageout_worker(). vm_pageout_worker() 2015-09-20 19:20:03 +00:00
x86 Add domain support to PCI bus allocation 2015-09-16 23:34:51 +00:00
xdr
xen xen: allow disabling PV disks and nics 2015-08-21 15:53:08 +00:00
Makefile Kill EoL whitespace. 2015-05-29 14:03:07 +00:00