Nmap Development mailing list archives

Re: Help debugging hang with epoll_engine


From: Patrick Donnelly <batrick () batbytes com>
Date: Thu, 7 Jun 2012 15:53:24 -0400

On Thu, Jun 7, 2012 at 3:38 PM, Daniel Miller <bonsaiviking () gmail com> wrote:
Ok, I did a debug build, and I've traced the loop to somewhere in Lua-land,
but I can't figure it out. Here are some relevant excerpts from my debug
session:

NSE Timing: About 98.75% done; ETC: 13:28 (0:00:05 remaining)
NSE: Waiting: 'http-title' (thread: 0x9ac3a18)
       stack traceback:
               [C]: in function 'connect'
               ./nselib/dns.lua:91: in function 'sendPackets'
               ./nselib/dns.lua:320: in function 'query'
               ./scripts/http-title.nse:180: in function 'is_vhost'
               ./scripts/http-title.nse:116: in function 'rule'
               ./scripts/http-title.nse:158: in function 'redirect_ok'
               ./scripts/http-title.nse:57: in function
<./scripts/http-title.nse:47>
               (...tail calls...)
Program received signal SIGINT, Interrupt.
0x00132416 in __kernel_vsyscall ()
(gdb) bt
#0  0x00132416 in __kernel_vsyscall ()
#1  0x005c6658 in __epoll_wait_nocancel () at
../sysdeps/unix/syscall-template.S:82
#2  0x082684da in epoll_loop (nsp=0x8c5ac10, msec_timeout=50) at
engine_epoll.c:287
#3  0x08262768 in nsock_loop (nsp=0x8c5ac10, msec_timeout=50) at
nsock_core.c:909
#4  0x08240e71 in l_loop (L=0x8c56ad8) at nse_nsock.cc:401

This is the "infinite loop". nse_main.lua is repeatedly calling l_loop
which calls nsock_loop because there is a thread which has not
finished. In this case, it's http-title. nse_main.lua by default calls
nsock_loop when there is nothing to do. NSE does not and cannot know
why the thread is not being resumed.

The next place to look for in debugging this is (a) is there an nsock
event we're legitimately waiting for (no "bug"); (b) there is a bug in
nsock which is causing this infinite wait for the callback; or (c)
there is a bug in the nse_nsock.cc binding where the callback (or
nsock_connect_udp) was inappropriately handled.


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

Current thread: