[tor-bugs] #7308 [Tor]: libevent doesn't work because of faulty code path

Tor Bug Tracker & Wiki torproject-admin at torproject.org
Sun Nov 4 04:06:12 UTC 2012


#7308: libevent doesn't work because of faulty code path
-----------------------+----------------------------------------------------
 Reporter:  ultramage  |          Owner:     
     Type:  defect     |         Status:  new
 Priority:  normal     |      Milestone:     
Component:  Tor        |        Version:     
 Keywords:  msvc       |         Parent:     
   Points:             |   Actualpoints:     
-----------------------+----------------------------------------------------
 {{{[warn] warning from libevent: event_add: event has no event_base
 set.}}}

 The modern libevent provides reentrant functions (base* parameter), but it
 still exposes the old interface and deprecated global state variables.
 Tor's tor_libevent_initialize() decides to use the new interface, and
 completely skips the old event_init() call which would initialize the
 global state.

 In src/ocmmon/compat_libevent.h, the function tor_event_base_loopexit() is
 #ifdefed based on a configure variable called HAVE_EVENT_BASE_LOOPEXIT. If
 it's defined, it forwards to libevent, otherwise it expands to a helper
 function. This function calls one of the old interfaces that rely on
 global state.

 The bug is that current src/win32/orconfig.h defines HAVE_EVENT2_EVENT_H
 but does not define HAVE_EVENT_BASE_LOOPEXIT. This causes the
 abovementioned code to skip initializing the old global libevent state,
 but then later ends up calling a function that depends on it.

 Adding #define HAVE_EVENT_BASE_LOOPEXIT to orconfig.h fixes it.

-- 
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/7308>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list