Nmap Development mailing list archives

Re: Sergey. [Status report 12/17]


From: Patrick Donnelly <batrick () batbytes com>
Date: Fri, 22 Jul 2016 18:47:33 -0400

On Fri, Jul 22, 2016 at 5:53 PM, Sergey Khegay <g.sergeykhegay () gmail com> wrote:
Assertion failed: ((L->status == 0) && "cannot do calls on non-normal
thread"), function lua_pcallk, file lapi.c, line 956.
[...]
Do you have any ideas what might be wrong? Where should I concentrate
now? Apparently I cannot debug nse_libssh2.c before this bug is fixed.

Should I check if this bug was present before transition to Lua 5.2?

Oh, this is apparently a new check since Lua 5.2. Before it was
quietly allowed to run things on a yielded thread (which nse_nsock.cc
does). The fix for that is to have an auxiliary thread for nse_nsock
which runs all nsock event handling. Specifically, here:

https://github.com/nmap/nmap/blob/98d5fd7625e9247eb0e55117880825e54885a7c8/nse_nsock.cc#L374

(And other nsock callbacks where we process nsock events.) The problem
is that nse_nsock.cc:callback calls nse_main.cc:nse_restore which does
lua_callk (into nse_main.lua).

Instead of saving the thread we're about to yield (i.e. the script
thread), we should be using an auxiliary thread (saved somewhere in
the nsock library, maybe another upvalue to all nsock functions).

I can make the change or you can. However, I don't know when I'll have
some spare time to fix it (probably a few days...).

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


Current thread: