From owner-cvs-src@FreeBSD.ORG Mon Nov 22 15:17:08 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 65D5316A4CE; Mon, 22 Nov 2004 15:17:08 +0000 (GMT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4C33C43D6E; Mon, 22 Nov 2004 15:17:08 +0000 (GMT) (envelope-from rwatson@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id iAMFH8Ls048912; Mon, 22 Nov 2004 15:17:08 GMT (envelope-from rwatson@repoman.freebsd.org) Received: (from rwatson@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id iAMFH8e5048911; Mon, 22 Nov 2004 15:17:08 GMT (envelope-from rwatson) Message-Id: <200411221517.iAMFH8e5048911@repoman.freebsd.org> From: Robert Watson Date: Mon, 22 Nov 2004 15:17:08 +0000 (UTC) To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org X-FreeBSD-CVS-Branch: RELENG_5 Subject: cvs commit: src/sys/netinet udp_usrreq.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: Mon, 22 Nov 2004 15:17:08 -0000 rwatson 2004-11-22 15:17:08 UTC FreeBSD src repository Modified files: (Branch: RELENG_5) sys/netinet udp_usrreq.c Log: Merge udp_usrreq.c:1.168 from HEAD to RELENG_5: date: 2004/11/04 01:25:23; author: rwatson; state: Exp; lines: +24 -57 Until this change, the UDP input code used global variables udp_in, udp_in6, and udp_ip6 to pass socket address state between udp_input(), udp_append(), and soappendaddr_locked(). While fine in the default configuration, when running with multiple netisrs or direct ithread dispatch, this can result in races wherein user processes using recvmsg() get back the wrong source IP/port. To correct this and related races: - Eliminate udp_ip6, which is believed to be generated but then never used. Eliminate ip_2_ip6_hdr() as it is now unneeded. - Eliminate setting, testing, and existence of 'init' status fields for the IPv6 structures. While with multiple UDP delivery this could lead to amortization of IPv4 -> IPv6 conversion when delivering an IPv4 UDP packet to an IPv6 socket, it added substantial complexity and side effects. - Move global structures into the stack, declaring udp_in in udp_input(), and udp_in6 in udp_append() to be used if a conversion is required. Pass &udp_in into udp_append(). - Re-annotate comments to reflect updates. With this change, UDP appears to operate correctly in the presence of substantial inbound processing parallelism. This solution avoids introducing additional synchronization, but does increase the potential stack depth. Discovered by: kris (Bug Magnet) MFC after: 3 weeks Note that this bug does not effect the default configuration, only systems running with net.isr.enable=1, or with modified network stacks to increase parallelism. Revision Changes Path 1.162.2.4 +24 -57 src/sys/netinet/udp_usrreq.c