[Bro-Dev] #946: Async scriptland functions stack explosion

Bro Tracker bro at tracker.bro.org
Sun Mar 10 22:16:29 PDT 2013


#946: Async scriptland functions stack explosion
----------------------------+------------------------
  Reporter:  seth           |      Owner:  robin
      Type:  Merge Request  |     Status:  closed
  Priority:  Medium         |  Milestone:  Bro2.2
 Component:  Bro            |    Version:  git/master
Resolution:  fixed          |   Keywords:
----------------------------+------------------------

Comment (by amannb):

 In [changeset:df96e2703dc123df0542f401521afefc92bbcff6/bro]:
 {{{
 #!CommitTicketReference repository="bro"
 revision="df96e2703dc123df0542f401521afefc92bbcff6"
 Fix three bugs with 'when' and 'return when' statements. Addresses #946

 - 'when' statements were problematic when used in a function/event/hook
   that had local variables with an assigned function value.  This was
   because 'when' blocks operate on a clone of the frame and the cloning
   process serializes locals and the serialization of functions had an
   infinite cycle in it (ID -> BroFunc -> ID -> BroFunc ...).  The ID
   was only used for the function name and type information, so
   refactoring Func and subclasses to depend on those two things instead
   fixes the issue.

 - 'return when' blocks, specifically, didn't work whenever execution
   of the containing function's body does another function call before
   reaching the 'return when' block, because of an assertion.  This was
   was due to logic in CallExpr::Eval always clearing the CallExpr
   associated with the Frame after doing the call, instead of restoring
   any previous CallExpr, which the code in Trigger::Eval expected to
   have available.

 - An assert could be reached when the condition of a 'when' statement
   depended on checking the value of global state variables.  The assert
   in Trigger::QueueTrigger that checks that the Trigger isn't disabled
   would get hit because Trigger::Eval/Timeout disable themselves after
   running, but don't unregister themselves from the NotifierRegistry,
   which keeps calling QueueTrigger for every state access of the global.
 }}}

-- 
Ticket URL: <http://tracker.bro.org/bro/ticket/946#comment:6>
Bro Tracker <http://tracker.bro.org/bro>
Bro Issue Tracker



More information about the bro-dev mailing list