[Click] [PATCH] do not access deleted timers

Nadi Sarrar nadi at net.t-labs.tu-berlin.de
Sun Apr 12 13:42:56 EDT 2009


Hi,

a problem with the current timer implementation in Click leads to execution of
unscheduled timers or access to already deleted timers, which can result in any
kind of unexpected behavior including segmentation faults at unrelated code
sections, which made it fun to debug :) Possible patch attached.

The problem occurs only under certain conditions:

  1) A lot of timers (more than max_timers = 64) must be used that are
     scheduled with close expiration times.
  2) Timer handler functions delete (or unschedule) other timers.
  3) High load helps to trigger this bug fast.

The problematic code section is in Master::run_timers(), right after the usual
handling of scheduled timers. There, all scheduled and expired timers are taken
out of the heap, stored in a vector and then run sequentially, while missing a
check whether the current timer is still alive (could be deleted/unscheduled by
one of the previously run timers).

Nadi

-------------- next part --------------
A non-text attachment was scrubbed...
Name: click-access-deleted-timer.patch
Type: text/x-diff
Size: 2952 bytes
Desc: not available
Url : http://amsterdam.lcs.mit.edu/pipermail/click/attachments/20090412/19081248/attachment.patch 


More information about the click mailing list