Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • Trac Trac
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Issues 246
    • Issues 246
    • List
    • Boards
    • Service Desk
    • Milestones
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value stream
  • Wiki
    • Wiki
  • Activity
  • Create a new issue
  • Issue Boards
Collapse sidebar
  • Legacy
  • TracTrac
  • Issues
  • #7308

Closed (moved)
(moved)
Open
Created Nov 04, 2012 by Trac@tracbot

libevent used uninitialized on faulty code path

[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.

Trac:
Username: ultramage

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking