freebsd-dev/sys
Bjoern A. Zeeb eafaa1bc35 After parts of the locking fixes in r346595, syzkaller found
another one in udp_output(). This one is a race condition.
We do check on the laddr and lport without holding a lock in
order to determine whether we want a read or a write lock
(this is in the "sendto/sendmsg" cases where addr (sin) is given).

Instrumenting the kernel showed that after taking the lock, we
had bound to a local port from a parallel thread on the same socket.

If we find that case, unlock, and retry again. Taking the write
lock would not be a problem in first place (apart from killing some
parallelism). However the retry is needed as later on based on
similar condition checks we do acquire the pcbinfo lock and if the
conditions have changed, we might find ourselves with a lock
inconsistency, hence at the end of the function when trying to
unlock, hitting the KASSERT.

Reported by:	syzbot+bdf4caa36f3ceeac198f@syzkaller.appspotmail.com
Reviewed by:	markj
MFC after:	6 weeks
Event:		Waterloo Hackathon 2019
2019-06-01 14:57:42 +00:00
..
amd64 Simplify flow of pmap_demote_pde_locked() and add more comprehensive 2019-05-31 18:53:04 +00:00
arm Implement the ffs and fls functions, and their longer counterparts, in 2019-05-28 15:47:00 +00:00
arm64 makesyscalls.sh: always use absolute path for syscalls.conf 2019-05-30 20:56:23 +00:00
bsm
cam Simplify math added in r310524. 2019-05-22 15:39:35 +00:00
cddl Fix assertion in ZFS TRIM code 2019-05-29 20:34:35 +00:00
compat makesyscalls.sh: always use absolute path for syscalls.conf 2019-05-30 20:56:23 +00:00
conf random(4): Fix RANDOM_LOADABLE build 2019-06-01 01:22:21 +00:00
contrib Adjust ENA driver to the new ena-com 2019-05-30 13:01:46 +00:00
crypto aesni(4): Fix trivial type typo 2019-05-27 00:47:51 +00:00
ddb Extract eventfilter declarations to sys/_eventfilter.h 2019-05-20 00:38:23 +00:00
dev Improve error/debug messages in sdhci.c 2019-06-01 14:39:12 +00:00
dts arm64: Add support for NanoPI NEO2 2019-05-02 12:56:13 +00:00
fs Get rid of extraneous initialization. 2019-05-31 03:13:09 +00:00
gdb
geom When using the destroy option to shut down a nop GEOM module, I/O 2019-05-25 00:07:49 +00:00
gnu dts: Import files from Linux 5.1 2019-05-08 19:27:30 +00:00
i386 makesyscalls.sh: always use absolute path for syscalls.conf 2019-05-30 20:56:23 +00:00
isa
kern makesyscalls.sh: always use absolute path for syscalls.conf 2019-05-30 20:56:23 +00:00
kgssapi * Handle SIGPIPE in gssd 2019-02-21 01:30:37 +00:00
libkern random(4): depessimize arc4random 2019-05-12 06:32:46 +00:00
mips Display CPU model in dmesg on mips targets 2019-05-24 01:43:35 +00:00
modules Update ENA version to v2.0.0 2019-05-30 13:52:32 +00:00
net iflib: provide probe wrapper for vendor drivers 2019-05-29 22:24:10 +00:00
net80211 Restructure mbuf send tags to provide stronger guarantees. 2019-05-24 22:30:40 +00:00
netgraph Remove 'dir' argument in ng_ipfw_input, since ip_fw_args now has this info. 2019-03-14 22:30:05 +00:00
netinet After parts of the locking fixes in r346595, syzkaller found 2019-06-01 14:57:42 +00:00
netinet6 Restructure mbuf send tags to provide stronger guarantees. 2019-05-24 22:30:40 +00:00
netipsec Add deprecation warnings for IPsec algorithms deprecated in RFC 8221. 2019-05-23 22:06:57 +00:00
netpfil Remove an uneeded indentation introduced in r223637 to silence gcc warnging 2019-05-25 23:58:09 +00:00
netsmb
nfs
nfsclient
nfsserver
nlm
ofed Include eventhandler.h in more compilation units 2019-05-21 01:18:43 +00:00
opencrypto cryptodeflate: Drop z_stream zbuf.state->dummy from SDT probe. 2019-05-24 02:44:15 +00:00
powerpc powerpc/moea: Fix moea64 native VA invalidation 2019-06-01 01:40:14 +00:00
riscv Include ktr.h in more compilation units 2019-05-21 20:38:48 +00:00
rpc Fix malloc stats for the RPCSEC_GSS server code when DEBUG is enabled. 2019-04-04 01:23:06 +00:00
security Extract eventfilter declarations to sys/_eventfilter.h 2019-05-20 00:38:23 +00:00
sparc64 FCP-101: Remove wb(4) 2019-05-17 15:24:34 +00:00
sys Complete LOCAL_PEERCRED support. Cache pid of the remote process in the 2019-05-30 14:24:26 +00:00
teken Attempt to complete fixing programmable function keys for syscons. 2019-02-20 02:14:41 +00:00
tests
tools Avoid literal @generated tag in file-generating scripts 2019-05-08 13:35:51 +00:00
ufs Add a missing bresle() in seldom-used error return. 2019-05-28 17:31:35 +00:00
vm The function vm_phys_free_contig invokes vm_phys_free_pages for every 2019-05-31 21:02:42 +00:00
x86 Add a constant for the LS config MSR on AMD CPUs. 2019-05-23 23:37:11 +00:00
xdr
xen
Makefile