Nmap Development mailing list archives

Re: [NSE] Patch to NSE Nsock library binding to eliminate dependency on GC for freeing of socket locks


From: Patrick Donnelly <batrick () batbytes com>
Date: Mon, 29 Jun 2009 08:02:48 -0600

Hello folks,

This has now been committed (r13965). There have been some minor
changes made to the patch since that time. I have attached the last
two iterations of the patch for record purposes.

Patch 2 calls nsock_loop after running all the threads in the running
queue (this only makes a difference for the first iteration of the
outer loop, nsock_loop was called at the beginning when there would be
no events pending). Pending threads are moved to the running queue at
the end of the same outer loop to prevent the rare (and incorrect)
terminating loop condition of having pending threads but no
running/waiting threads. Both of these changes are linked in that
calling nsock_loop may result in moving threads from the waiting queue
to the pending queue. We must then move these pending threads to
running afterwards.

Patch iteration 3 is necessary to the recent commit of the child
coroutine patch [1]. Because multiple child threads can utilize
sockets, we must change how we account what script owns the allocated
sockets by using the "base thread", or rather, the thread which
started the script. This fixes a possible deadlock where child
coroutines attempt to connect sockets when the parent would be able to
allocate (connect more) sockets.

[1] http://seclists.org/nmap-dev/2009/q2/0586.html

-- 
-Patrick Donnelly

"Let all men know thee, but no man know thee thoroughly: Men freely
ford that see the shallows."

- Benjamin Franklin

Attachment: nsock_minus_gc2.patch
Description:

Attachment: nsock_minus_gc3.patch
Description:


_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://SecLists.Org

Current thread: