From owner-freebsd-net@FreeBSD.ORG Fri Jan 16 18:39:37 2015 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 80F57E31 for ; Fri, 16 Jan 2015 18:39:37 +0000 (UTC) Received: from mail-wi0-x236.google.com (mail-wi0-x236.google.com [IPv6:2a00:1450:400c:c05::236]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 252BFC47 for ; Fri, 16 Jan 2015 18:39:37 +0000 (UTC) Received: by mail-wi0-f182.google.com with SMTP id n3so3990562wiv.3 for ; Fri, 16 Jan 2015 10:39:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=qhKJql5junt38mHnRPU+6re5CE4pnhm17bgUE0K9AhE=; b=p/vjctq5TGURc9wl00/eif/0pFoMla30RdtJ0kpIJ7tuvrPTtQIWq4N68RUDlafsXG YS2IroWDMsmQ1gzryMie6p420nPxn3azJBMK00zwiH1+t+a9WjR8/JfM5IzF+oJ/J1dk S16vbeKYNr0d2ZUDZ07g3fM9g730GWjNyUm/f/cI47DfsVCvJrv+x12rv/RVaEv7FtA4 pp/wgA1tOgLFcHtaZD+FdsZUrVDKrWVwRBTmXSJiYdZO2p166RtSCRJnLpQgKLJUmt1m RoiNI/trzelX+VjQIqxHCcLfwdDo8vSCOTBt+dQltyWGqcoW+bq5B41DyDtEjCdTWbSr 9a8g== MIME-Version: 1.0 X-Received: by 10.180.7.198 with SMTP id l6mr9054618wia.26.1421433575515; Fri, 16 Jan 2015 10:39:35 -0800 (PST) Sender: adrian.chadd@gmail.com Received: by 10.216.41.136 with HTTP; Fri, 16 Jan 2015 10:39:35 -0800 (PST) In-Reply-To: <1421428048190.48193@netapp.com> References: <1421339375968.94209@netapp.com> <1421428048190.48193@netapp.com> Date: Fri, 16 Jan 2015 10:39:35 -0800 X-Google-Sender-Auth: izRaKHfnggjxjRr8UZ1K07GOeQg Message-ID: Subject: Re: Accessing socket APIs soon after accept From: Adrian Chadd To: "Quattlebaum, Ryan" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: "freebsd-net@freebsd.org" X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jan 2015 18:39:37 -0000 Oh, I've no idea about -8. If that's what the code does then yeah, that seems wrong. Is it like that in -10 or -11 ? -adrian On 16 January 2015 at 09:07, Quattlebaum, Ryan wrote: > Hi, Adrian. Thanks for taking a look at this. > > We're using FreeBSD 8.2 and httpd-2.4.10 with arp-1.5.1 and apr-util-1.5.= 4. > > The problem we're seeing is pretty intermittent, so I hope this test case= can shine a little bit of light on th= e problem. We tried debugging this on our own by adding calls to getsocknam= e() right after the accept call (in srclib/apr/network_io/unix/sockets.c: a= pr_socket_accept()) and logging the output. That's where we saw invalid dat= a. > > I took a look at the source code for the TCP syncache module and the acce= pt syscall. It looks like the new child socket is available for the applica= tion to accept after the call to sonewconn returns, but the address informa= tion isn't set until further down in the function. Wouldn't this open a win= dow where an application could accept on a socket that the syncache code is= n't done configuring? > > - Ryan Quattlebaum > ________________________________________ > From: adrian.chadd@gmail.com on behalf of Adrian= Chadd > Sent: Thursday, January 15, 2015 1:20 PM > To: Quattlebaum, Ryan > Cc: freebsd-net@freebsd.org > Subject: Re: Accessing socket APIs soon after accept > > On 15 January 2015 at 08:29, Quattlebaum, Ryan > wrote: >> Is there anything preventing applications from calling functions e.g. ge= tsockname() right after accept()? Or is there a recommended pattern that ap= plications should use to ensure they get correct data? We recently upgraded= to a new version of Apache and are seeing uninitialized data coming back f= rom a few of these calls. > > I'm under the impression that once you get the FD from accept(), it > should be fully formed and ready. > > Which version of FreeBSD/apache is it? can you come up with a test > case that shows that it's happening? > > > > -adrian > >> Thanks, >> >> Ryan Quattlebaum >> Software Developer, NetApp, Inc. >> _______________________________________________ >> freebsd-net@freebsd.org mailing list >> http://lists.freebsd.org/mailman/listinfo/freebsd-net >> To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org"