lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 1/26/06, Roberto Ierusalimschy <roberto@inf.puc-rio.br> wrote:
> > If a routime called by a lua_CFunction longjmps way back (bellow the
> > point where the lua machine  was called) would the lua machine be
> > still usable?
>
> Not exactly... The thread that did the longjmp should not be used.
> You could use other threads, but I am not sure whether that would
> be completely safe either.
>
> > If it doesn't, Is there a way to protect  the machine from such
> > backward jumps .
>
> How do you protect them in ethereal?

We set a longjump (point A) in the function that calls the frame
dissector (the dissection root). If some of the dissectors bails out,
by either failing an ASSERTION or reading out of bounds in the
curtrent buffer (the packet's one), the control jumps back to point A.

As dissectors use our own *alloc() routines we do not risk leaking
because per packet allocated chunks are safely freed after point A.

BTW I think that what I'll do is to push a "point B" in the function
called by lua before calling any risky code  and hanlde the
"exception" in right there that way I'll avoid the stack been popped
bellow that of the functions called by lua.  It may be clumsy but that
avoids me to modify ethereal code's base, that way the embeded lua can
be "just" another ethereal plugin as I wanted it since the very
beggining.

Thanks for the answer.

--
This information is top security. When you have read it, destroy yourself.
-- Marshall McLuhan