freebsd-dev/sys/netinet
Mark Johnston c17b531bed sctp: Fix races around sctp_inpcb_free()
sctp_close() and sctp_abort() disassociate the PCB from its socket.
As a part of this, they attempt to free the PCB, which may end up
lingering.  Fix some bugs in this area:

- For some reason, sctp_close() and sctp_abort() set
  SCTP_PCB_FLAGS_SOCKET_GONE using an atomic compare-and-set without the
  PCB lock held.  This is racy since sctp_flags is normally updated
  without atomics, using the PCB lock to synchronize.  So, the update
  can be lost, which can cause all sort of races with other SCTP
  components which look for the _GONE flag.  Fix the problem simply by
  acquiring the PCB lock in order to set the flag.  Note that we have to
  drop and re-acquire the lock again in sctp_inpcb_free(), but I don't
  see a good way around that for now.  If it's a real problem, the _GONE
  flag could be split out of sctp_flags and into a dedicated sctp_inpcb
  field.
- In sctp_inpcb_free(), load sctp_socket after acquiring the PCB lock,
  to avoid possible races with parallel sctp_inpcb_free() calls.
- Add an assertion sctp_inpcb_free() to verify that _ALLGONE is not set.

Reviewed by:	tuexen
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D31811
2021-09-07 11:19:29 -04:00
..
cc tcp: fix two bugs in new reno 2021-06-11 15:40:34 +02:00
khelp
libalias libalias: fix divide by zero causing panic 2021-07-10 13:08:18 +02:00
netdump netdump: send key before dump, in case dump fails 2021-08-11 10:54:56 -05:00
tcp_stacks tcp: Add support for DSACK based reordering window to rack. 2021-08-17 16:29:22 -04:00
accf_data.c
accf_dns.c
accf_http.c
dccp.h
icmp6.h
icmp_var.h
if_ether.c Use lltable calculated header when sending lle holdchain after successful lle resolution. 2021-08-05 20:44:36 +00:00
if_ether.h
igmp_var.h
igmp.c igmp: Avoid an out-of-bounds access when zeroing counters 2021-05-05 17:12:51 -04:00
igmp.h
in_cksum.c
in_debug.c
in_fib_algo.c Fix IPv4 fib bsearch4() lookup array construction. 2021-01-17 20:32:26 +00:00
in_fib_dxr.c Introduce DXR as an IPv4 longest prefix matching / FIB module 2021-05-05 13:45:52 +02:00
in_fib.c Fix some common typos in comments 2021-08-08 10:16:06 +02:00
in_fib.h Refactor fib4/fib6 functions. 2020-11-29 13:41:49 +00:00
in_gif.c
in_jail.c
in_kdtrace.c
in_kdtrace.h
in_mcast.c Always use inp fib in the inp_lookup_mcast_ifp(). 2021-04-10 13:47:49 +00:00
in_pcb.c Add missing sockaddr length and family validation to various protocols 2021-05-03 13:35:19 -04:00
in_pcb.h tcp: HPTS performance enhancements 2021-07-07 07:22:35 -04:00
in_pcbgroup.c inet(3): Fix a few common typos in source code comments 2021-08-28 18:53:02 +02:00
in_prot.c
in_proto.c capsicum: Limit socket operations in capability mode 2021-04-07 14:32:56 -04:00
in_rmx.c
in_rss.c
in_rss.h
in_systm.h
in_var.h net: remove legacy in_addmulti() 2021-02-25 10:13:52 +01:00
in.c lltable: do not require prefix lookup when checking lle allocation rules. 2021-09-06 21:03:22 +00:00
in.h
ip6.h net: Introduce IPV6_DSCP(), IPV6_ECN() and IPV6_TRAFFIC_CLASS() macros 2021-03-04 20:56:48 +01:00
ip_carp.c Further refactor IPv4 interface route creation. 2021-01-21 21:48:49 +00:00
ip_carp.h
ip_divert.c socket: Implement SO_RERROR 2021-07-28 09:35:09 -07:00
ip_divert.h
ip_dummynet.h ipfw: use unsigned int for dummynet bandwidth 2021-08-19 10:48:53 +02:00
ip_ecn.c
ip_ecn.h
ip_encap.c
ip_encap.h
ip_fastfwd.c routing: Allow using IPv6 next-hops for IPv4 routes (RFC 5549). 2021-08-22 22:56:08 +00:00
ip_fw.h Allow setting alias port ranges in libalias and ipfw. This will allow a system 2021-02-02 13:24:17 -08:00
ip_gre.c
ip_icmp.c
ip_icmp.h
ip_id.c
ip_input.c routing: Allow using IPv6 next-hops for IPv4 routes (RFC 5549). 2021-08-22 22:56:08 +00:00
ip_mroute.c mroute: fix locking issues 2021-08-13 11:06:17 +02:00
ip_mroute.h ip_mroute: rework ip_mroute 2021-05-31 05:48:15 +02:00
ip_options.c
ip_options.h
ip_output.c routing: Allow using IPv6 next-hops for IPv4 routes (RFC 5549). 2021-08-22 22:56:08 +00:00
ip_reass.c ip_reass: do less work in ipreass_slowtimo if possible 2021-08-14 18:50:12 +02:00
ip_var.h
ip.h
pim_var.h
pim.h
raw_ip.c ipsec: Handle ICMP NEEDFRAG message. 2021-08-09 12:01:46 +02:00
sctp_asconf.c sctp: Fix errno in case of association setup failures 2021-07-09 23:19:25 +02:00
sctp_asconf.h
sctp_auth.c
sctp_auth.h
sctp_bsd_addr.c Don't pass RFPROC to kproc_create(), it is redundant. 2021-03-12 09:48:10 -08:00
sctp_bsd_addr.h
sctp_cc_functions.c sctp: remove some set, but unused variables 2021-08-09 15:58:46 +02:00
sctp_constants.h sctp: Fix errno in case of association setup failures 2021-07-09 23:19:25 +02:00
sctp_crc32.c
sctp_crc32.h
sctp_header.h
sctp_indata.c sctp: Fix errno in case of association setup failures 2021-07-09 23:19:25 +02:00
sctp_indata.h
sctp_input.c sctp: Always check for a vanishing inpcb when processing COOKIE-ECHO 2021-09-01 10:28:17 -04:00
sctp_input.h
sctp_kdtrace.c
sctp_kdtrace.h
sctp_lock_bsd.h sctp: Add macros to assert on inp info lock state 2021-09-01 10:06:18 -04:00
sctp_module.c
sctp_os_bsd.h
sctp_os.h
sctp_output.c Fix a common typo in source code comments 2021-09-04 12:56:57 +02:00
sctp_output.h
sctp_pcb.c sctp: Fix races around sctp_inpcb_free() 2021-09-07 11:19:29 -04:00
sctp_pcb.h sctp: Implement sctp_inpcb_bind_locked() 2021-09-01 10:06:18 -04:00
sctp_peeloff.c
sctp_peeloff.h
sctp_ss_functions.c Fix a few typos in comments 2021-03-13 16:37:28 +01:00
sctp_structs.h sctp: improve consistency 2021-01-24 00:07:41 +01:00
sctp_syscalls.c Convert remaining cap_rights_init users to cap_rights_init_one 2021-01-12 13:16:10 +00:00
sctp_sysctl.c
sctp_sysctl.h
sctp_timer.c sctp: Fix errno in case of association setup failures 2021-07-09 23:19:25 +02:00
sctp_timer.h
sctp_uio.h
sctp_usrreq.c sctp: Fix races around sctp_inpcb_free() 2021-09-07 11:19:29 -04:00
sctp_var.h
sctp.h
sctputil.c sctp: improve input validation of mapped addresses in sctp_connectx() 2021-08-07 15:12:09 +02:00
sctputil.h sctp: Fix errno in case of association setup failures 2021-07-09 23:19:25 +02:00
siftr.c
tcp_accounting.h This brings into sync FreeBSD with the netflix versions of rack and bbr. 2021-05-06 11:22:26 -04:00
tcp_debug.c
tcp_debug.h
tcp_fastopen.c
tcp_fastopen.h
tcp_fsm.h tcp: Remove unused v6 state definitions 2021-08-27 08:31:32 -04:00
tcp_hostcache.c tcp_hostcache: use SMR for lookups, mutex(9) for updates. 2021-04-20 10:02:20 -07:00
tcp_hpts.c tcp: Fix 32 bit platform breakage 2021-07-08 08:16:45 -04:00
tcp_hpts.h tcp: HPTS performance enhancements 2021-07-07 07:22:35 -04:00
tcp_input.c tcp: Add PRR cwnd reduction for non-SACK loss 2021-06-19 19:25:22 +02:00
tcp_log_buf.c
tcp_log_buf.h tcp: Add support for DSACK based reordering window to rack. 2021-08-17 16:29:22 -04:00
tcp_lro.c tcp: make network epoch expectations of LRO explicit 2021-08-25 17:12:36 +02:00
tcp_lro.h Update the TCP LRO code to handle both encrypted and un-encrypted traffic. 2021-08-06 11:28:44 +02:00
tcp_offload.c Path MTU discovery hooks for offloaded TCP connections. 2021-04-21 13:00:16 -07:00
tcp_offload.h Path MTU discovery hooks for offloaded TCP connections. 2021-04-21 13:00:16 -07:00
tcp_output.c tcp: Preparation for allowing hardware TLS to be able to kick a tcp connection that is retransmitting too much out of hardware and back to software. 2021-06-25 09:30:54 -04:00
tcp_pcap.c
tcp_pcap.h
tcp_ratelimit.c This brings into sync FreeBSD with the netflix versions of rack and bbr. 2021-05-06 11:22:26 -04:00
tcp_ratelimit.h This takes Warners suggested approach to making it so that 2021-05-07 17:32:32 -04:00
tcp_reass.c tcp: A better fix for the previously attempted fix of the ack-war issue with tcp. 2021-06-04 05:26:43 -04:00
tcp_sack.c tcp: SACK Lost Retransmission Detection (LRD) 2021-05-10 19:06:20 +02:00
tcp_seq.h
tcp_stats.c
tcp_subr.c tcp: TCP_LRO getting bad checksums and sending it in to TCP incorrectly. 2021-07-13 12:45:15 -04:00
tcp_syncache.c Unbreak TFO, that was broken with 8d5719aa74. These two assignments 2021-06-22 16:03:44 -07:00
tcp_syncache.h tcp: add support for TCP over UDP 2021-04-18 16:16:42 +02:00
tcp_timer.c
tcp_timer.h kern: net: remove TCP_LINGERTIME 2021-02-18 22:36:01 -06:00
tcp_timewait.c tcp_twcheck(): use correct unlock macro. 2021-05-06 10:19:21 -07:00
tcp_usrreq.c tcp, udp: improve input validation in handling bind() 2021-08-05 13:48:44 +02:00
tcp_var.h ktls: Move KERN_TLS ifdef to tcp_var.h 2021-08-05 19:17:35 -04:00
tcp.h tcp: Add support for DSACK based reordering window to rack. 2021-08-17 16:29:22 -04:00
tcpip.h
toecore.c routing: Allow using IPv6 next-hops for IPv4 routes (RFC 5549). 2021-08-22 22:56:08 +00:00
toecore.h Path MTU discovery hooks for offloaded TCP connections. 2021-04-21 13:00:16 -07:00
udp_usrreq.c tcp, udp: improve input validation in handling bind() 2021-08-05 13:48:44 +02:00
udp_var.h
udp.h
udplite.h