From owner-cvs-src@FreeBSD.ORG Thu Oct 21 09:30:48 2004 Return-Path: Delivered-To: cvs-src@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B44D116A4CE; Thu, 21 Oct 2004 09:30:48 +0000 (GMT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 90B4C43D2D; Thu, 21 Oct 2004 09:30:48 +0000 (GMT) (envelope-from rwatson@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.11/8.12.11) with ESMTP id i9L9UmUf030343; Thu, 21 Oct 2004 09:30:48 GMT (envelope-from rwatson@repoman.freebsd.org) Received: (from rwatson@localhost) by repoman.freebsd.org (8.12.11/8.12.11/Submit) id i9L9Umio030342; Thu, 21 Oct 2004 09:30:48 GMT (envelope-from rwatson) Message-Id: <200410210930.i9L9Umio030342@repoman.freebsd.org> From: Robert Watson Date: Thu, 21 Oct 2004 09:30:48 +0000 (UTC) To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org X-FreeBSD-CVS-Branch: RELENG_5_3 Subject: cvs commit: src/sys/kern kern_descrip.c uipc_socket.c uipc_usrreq.c src/sys/net raw_cb.c raw_usrreq.c src/sys/netatalk ddp_pcb.c src/sys/netatm atm_socket.cng_btsocket_l2cap.c ... X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Oct 2004 09:30:48 -0000 rwatson 2004-10-21 09:30:48 UTC FreeBSD src repository Modified files: (Branch: RELENG_5_3) sys/kern kern_descrip.c uipc_socket.c uipc_usrreq.c sys/net raw_cb.c raw_usrreq.c sys/netatalk ddp_pcb.c sys/netatm atm_socket.c sys/netgraph/bluetooth/socket ng_btsocket_hci_raw.c ng_btsocket_l2cap.c ng_btsocket_l2cap_raw.c ng_btsocket_rfcomm.c sys/netinet in_pcb.c tcp_subr.c sys/netinet6 in6_pcb.c sys/netipx ipx_pcb.c ipx_usrreq.c sys/netnatm natm.c sys/sys socketvar.h Log: Merge kern_descrip.c:1.246, uipc_socket.c:1.214, uipc_usrreq.c:1.141, raw_cb.c:1.30, raw_usrreq.c:1.35, ddp_pcb.c:1.45, atm_socket.c:1.21, ng_btsocket_hci_raw.c:1.16, ng_btsocket_l2cap.c:1.14, ng_btsocket_l2cap_raw.c:1.13, ng_btsocket_rfcomm.c:1.13, in_pcb.c:1.156, tcp_subr.c:1.205, in6_pcb.c:1.61, ipx_pcb.c:1.29, ipx_usrreq.c:1.41, natm.c:1.35, socketvar.h:1.135 from HEAD to RELENG_5_3: Push acquisition of the accept mutex out of sofree() into the caller (sorele()/sotryfree()): - This permits the caller to acquire the accept mutex before the socket mutex, avoiding sofree() having to drop the socket mutex and re-order, which could lead to races permitting more than one thread to enter sofree() after a socket is ready to be free'd. - This also covers clearing of the so_pcb weak socket reference from the protocol to the socket, preventing races in clearing and evaluation of the reference such that sofree() might be called more than once on the same socket. This appears to close a race I was able to easily trigger by repeatedly opening and resetting TCP connections to a host, in which the tcp_close() code called as a result of the RST raced with the close() of the accepted socket in the user process resulting in simultaneous attempts to de-allocate the same socket. The new locking increases the overhead for operations that may potentially free the socket, so we will want to revise the synchronization strategy here as we normalize the reference counting model for sockets. The use of the accept mutex in freeing of sockets that are not listen sockets is primarily motivated by the potential need to remove the socket from the incomplete connection queue on its parent (listen) socket, so cleaning up the reference model here may allow us to substantially weaken the synchronization requirements. RELENG_5_3 candidate. MFC after: 3 days Reviewed by: dwhite Discussed with: gnn, dwhite, green Reported by: Marc UBM Bocklet Reported by: Vlad Approved by: re (scottl) Revision Changes Path 1.243.2.2.2.1 +1 -0 src/sys/kern/kern_descrip.c 1.208.2.3.2.1 +4 -3 src/sys/kern/uipc_socket.c 1.138.2.2.2.1 +1 -0 src/sys/kern/uipc_usrreq.c 1.29.4.1 +1 -0 src/sys/net/raw_cb.c 1.34.4.1 +1 -0 src/sys/net/raw_usrreq.c 1.44.4.1 +1 -0 src/sys/netatalk/ddp_pcb.c 1.20.4.1 +1 -0 src/sys/netatm/atm_socket.c 1.15.4.1 +1 -0 src/sys/netgraph/bluetooth/socket/ng_btsocket_hci_raw.c 1.13.4.1 +2 -0 src/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c 1.12.4.1 +1 -0 src/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap_raw.c 1.12.4.1 +1 -0 src/sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c 1.153.2.1.2.1 +1 -0 src/sys/netinet/in_pcb.c 1.201.2.1.2.1 +1 -0 src/sys/netinet/tcp_subr.c 1.59.2.1.2.1 +1 -0 src/sys/netinet6/in6_pcb.c 1.28.4.1 +1 -0 src/sys/netipx/ipx_pcb.c 1.40.4.1 +1 -0 src/sys/netipx/ipx_usrreq.c 1.34.4.1 +2 -0 src/sys/netnatm/natm.c 1.133.2.1.2.1 +10 -2 src/sys/sys/socketvar.h