lkml.org 
[lkml]   [2002]   [Jan]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] removed socket buffer in unix domain socket


On Mon, 7 Jan 2002, Yasuma Takeda wrote:

>
> Hi,
>
> I found a problem to unix domain socket.
>
> The unix_gc function removes socket buffers of the socket
> which is connectted but not acceptted yet.
>
> After one process executes "Mark phase" of unix_gc function,
> another process registers socket buffer by using sendmsg with SCM_RIGHTS.
> At the next moment, the socket buffer is removed.
>
> I attached the test program.
> When I execute one server and two clients on SMP machine
> (kernel 2.4.16 and PentiumIII x 2), I can reporduce this problem.
>
> Following is a patch to avoid this problem.

It looks bogus. Are you sure that listening socket is not garbage at that
point in your testcase?

Your patch is definitely wrong - consider the case when we send fd1 to
ourselves (fd2 would be receiving end), then send fd2 (fd3 would be
receiving end), then close fd3. We want _both_ packets (carrying fd1
and fd2 resp.) to be taken out of queues in that loop. So added check
is broken.

We scan the queues of listening sockets, all right, but only if listening
socket itself becomes a garbage. I.e. only if connection is never going
to be accepted...

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:15    [from the cache]
©2003-2011 Jasper Spaans