[tor-bugs] #31609 [Core Tor/Tor]: Make CIRCUIT_IS_ORIGIN() look at the base magic number

Tor Bug Tracker & Wiki blackhole at torproject.org
Tue Sep 3 19:22:21 UTC 2019


#31609: Make CIRCUIT_IS_ORIGIN() look at the base magic number
------------------------------+--------------------------------
     Reporter:  dgoulet       |      Owner:  (none)
         Type:  defect        |     Status:  new
     Priority:  Medium        |  Milestone:  Tor: 0.4.2.x-final
    Component:  Core Tor/Tor  |    Version:
     Severity:  Normal        |   Keywords:  tor-circuit
Actual Points:                |  Parent ID:
       Points:  0.1           |   Reviewer:
      Sponsor:                |
------------------------------+--------------------------------
 Currently, `CIRCUIT_IS_ORIGIN()` actually looks at the purpose, not the
 base magic number:

 {{{
 #define CIRCUIT_IS_ORIGIN(c) (CIRCUIT_PURPOSE_IS_ORIGIN((c)->purpose))
 }}}

 We should move it to look at the `magic` like `CIRCUIT_IS_ORCIRC()` is
 doing.

 The reason is because I was adding tracing events to the circuit subsystem
 and I kept having state transition event with a circuit global identifier
 of 0 which can't be because that value is set just after allocation.

 But at that point, the purpose has not been set so `CIRCUIT_IS_ORIGIN()`
 wasn't returning true.

 Furthermore, this made me discover another issue documented in #31608
 where if we do make this change, we _must_ fix this ticket else we have a
 NULL deref.

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


More information about the tor-bugs mailing list