From owner-freebsd-current Sat Mar 1 7:54: 3 2003 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E6D4337B401; Sat, 1 Mar 2003 07:54:01 -0800 (PST) Received: from stork.mail.pas.earthlink.net (stork.mail.pas.earthlink.net [207.217.120.188]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4DDED43FD7; Sat, 1 Mar 2003 07:54:01 -0800 (PST) (envelope-from tlambert2@mindspring.com) Received: from pool0228.cvx40-bradley.dialup.earthlink.net ([216.244.42.228] helo=mindspring.com) by stork.mail.pas.earthlink.net with asmtp (SSLv3:RC4-MD5:128) (Exim 3.33 #1) id 18p9JE-0001PG-00; Sat, 01 Mar 2003 07:53:57 -0800 Message-ID: <3E60D73D.33D2CED2@mindspring.com> Date: Sat, 01 Mar 2003 07:52:29 -0800 From: Terry Lambert X-Mailer: Mozilla 4.79 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: Bruce Evans Cc: Maksim Yevmenkin , current@FreeBSD.ORG, wollman@FreeBSD.ORG Subject: Re: PATCH: typo in socreate() or i'm missing something References: <20030301202521.D25845-100000@gamplex.bde.org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-ELNK-Trace: b1a02af9316fbb217a47c185c03b154d40683398e744b8a457cde91328303a37f3460214ed9b7235350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Bruce Evans wrote: > On Fri, 28 Feb 2003, Maksim Yevmenkin wrote: > > sonewconn() calls soalloc(0). > > tcp_input() is a critical caller of sonewconn() and it obviously shouldn't > sleep. But sonewconn() is called from process context elsewhere. > sonewconn() has used a no-wait malloc() since at least 4.4Lite2 (in Lite2 > there is no soalloc() and the malloc() is done directly in sonewconn()). > I think the call from tcp_input() is the usual case and/or no one cared > to distinguish the other cases. The interesting case in the tcp_input() path is an outstanding "accept" call, in which a new connection is created at interrupt (in LRP) o NETISR (in traditional, livelockable FreeBSD). In general, the blocking is done in order to get a process (or now thread, I guess) context from which to obtain a cred for the newly created socket. I've discussed my own approach to this problem with both Jeffrey Hsu and Jonathan Lemon, and I think it's pretty clever: don't get the credential from the process (thread). So how do you get the same/right credential? Easy. You cannot accept except on an outstanding listen socket; so copy the cred from the listening socket, which *is* in scope, even if p == 0 (or td == 0). I believe that addresses the problem case... 8-). -- Terry To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message