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 [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to