[tor-bugs] #21415 [Core Tor/Tor]: tor_bug_occurred_: Bug: src/or/entrynodes.c:1845: select_entry_guard_for_circuit: Non-fatal assertion !(!guard_has_descriptor(guard)) failed.

Tor Bug Tracker & Wiki blackhole at torproject.org
Tue Feb 28 15:51:21 UTC 2017


#21415: tor_bug_occurred_: Bug: src/or/entrynodes.c:1845:
select_entry_guard_for_circuit: Non-fatal assertion
!(!guard_has_descriptor(guard)) failed.
-----------------------------+------------------------------------
 Reporter:  cypherpunks      |          Owner:  nickm
     Type:  defect           |         Status:  needs_review
 Priority:  Medium           |      Milestone:  Tor: 0.3.0.x-final
Component:  Core Tor/Tor     |        Version:  Tor: 0.3.0.3-alpha
 Severity:  Normal           |     Resolution:
 Keywords:  review-group-16  |  Actual Points:
Parent ID:                   |         Points:
 Reviewer:  asn              |        Sponsor:
-----------------------------+------------------------------------

Comment (by asn):

 I think the bug has been found.

 Here it is:
 {{{
   const int num_primary =
 get_n_primary_guards_to_use(GUARD_USAGE_TRAFFIC);
 ...
   SMARTLIST_FOREACH_BEGIN(gs->primary_entry_guards, entry_guard_t *,
 guard) {
 ...
     n_considered++;
 ...
     if (n_considered >= num_primary)
       break;
   } SMARTLIST_FOREACH_END(guard);
 }}}

 In the above, it seems like `get_n_primary_guards_to_use()` returns 1
 (because of DFLT_N_PRIMARY_GUARDS_TO_USE), and then we only actually check
 the first primary guard for descriptor and `break` after that.

 This way it's possible that the second primary guard actually has no
 descriptor, and if for some reason we end up picking it (e.g. because we
 picked the first primary guard as the exit node) we will get the assert.

 What's the right fix here? Maybe to set `num_primary` to
 `smartlist_len(gs->primary_entry_guards)` and test all guards for
 descriptors before proceeding? What else?

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


More information about the tor-bugs mailing list