[tor-bugs] #7164 [Tor]: microdesc.c:378: Bug: microdesc_free() called, but md was still referenced 1 node(s); held_by_nodes == 1

Tor Bug Tracker & Wiki blackhole at torproject.org
Thu Dec 18 16:39:03 UTC 2014


#7164: microdesc.c:378: Bug: microdesc_free() called, but md was still referenced
1 node(s); held_by_nodes == 1
------------------------+-------------------------------------------------
     Reporter:  jaj123  |      Owner:
         Type:  defect  |     Status:  needs_review
     Priority:  major   |  Milestone:  Tor: 0.2.6.x-final
    Component:  Tor     |    Version:  Tor: 0.2.4.19
   Resolution:          |   Keywords:  tor-client 024-backport 025-triaged
Actual Points:          |  Parent ID:
       Points:          |
------------------------+-------------------------------------------------

Comment (by cypherpunks):

 Next patch tries to resolve last edge case:
 {{{
 --- microdesc.c.original        2014-12-16 10:16:08.393137000 -0800
 +++ microdesc.c 2014-12-18 08:30:27.637096984 -0800
 @@ -847,6 +847,8 @@
  we_use_microdescriptors_for_circuits(const or_options_t *options)
  {
    int ret = options->UseMicrodescriptors;
 +  static int prev_ret_we_use_md = -1;
 +  networkstatus_t ns = NULL;
    if (ret == -1) {
      /* UseMicrodescriptors is "auto"; we need to decide: */
      /* If we are configured to use bridges and none of our bridges
 @@ -859,6 +861,24 @@
       * a partitioning issue here where bridges differ from clients. */
      ret = !server_mode(options) && !options->FetchUselessDescriptors;
    }
 +  /* Detect if preferable consensus flavor changed,
 +   * update nodelist according to choosen consensus then. */
 +  if (prev_ret_we_use_md != -1 && prev_ret_we_use_md != ret) {
 +
 +     /* We can't to call networkstatus_get_latest_consensus(),
 +      * it returns current_consensus that depends
 +      * call of we_use_microdescriptors_for_circuits() */
 +    if (ret) /* we use microdescriptors, we need md-consensus */
 +      ns = networkstatus_get_latest_consensus_by_flavor(FLAV_MICRODESC);
 +    else
 +      ns = networkstatus_get_latest_consensus_by_flavor(FLAV_NS);
 +
 +    /* update nodelist with any latest consensus */
 +    if (ns)
 +      nodelist_set_consensus(ns);
 +  }
 +
 +  prev_ret_we_use_md = ret;
    return ret;
  }
 }}}
 {{{
 --- nodelist.c.original 2014-10-10 06:06:24.000000000 -0700
 +++ nodelist.c  2014-12-18 08:23:30.969080066 -0800
 @@ -229,6 +229,11 @@
          if (node->md)
            node->md->held_by_nodes++;
        }
 +    } else { /* No md-consensus used, releasing md used by node if need
 */
 +      if (node->md) {
 +        node->md->held_by_nodes--;
 +        node->md = NULL;
 +      }
      }

      node_set_country(node);
 }}}

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


More information about the tor-bugs mailing list