[tor-bugs] #2572 [Tor Relay]: Bridge authority crashes on SIGHUP

Tor Bug Tracker & Wiki torproject-admin at torproject.org
Wed Feb 16 12:08:46 UTC 2011


#2572: Bridge authority crashes on SIGHUP
------------------------+---------------------------------------------------
  Reporter:  rransom    |              Owner:  rransom           
      Type:  defect     |             Status:  assigned          
  Priority:  critical   |          Milestone:  Tor: 0.2.2.x-final
 Component:  Tor Relay  |            Version:                    
  Keywords:             |             Parent:                    
    Points:             |   Actualpointsdone:                    
Pointsdone:             |       Actualpoints:                    
------------------------+---------------------------------------------------
Changes (by rransom):

  * owner:  => rransom
  * status:  new => assigned


Comment:

 Replying to [comment:3 rransom]:
 >
 [https://gitweb.torproject.org/tor.git/commitdiff/851a980065e6b2df8d7cb35a22d0675b8918214b
 851a980065e6b2df8d] could be the culprit.
 No.

 We know that the following control flow led to the "Unable to add own
 descriptor to directory: Skipping router descriptor: not in consensus."
 log message, and to the crash:
 * `logrotate` sent SIGHUP to Tor, which caused a call to
 [https://gitweb.torproject.org/tor.git/blob/refs/tags/tor-0.2.2.22-alpha:/src/or/config.c#l641
 set_options in src/or/config.c].
 *
 [https://gitweb.torproject.org/tor.git/blob/refs/tags/tor-0.2.2.22-alpha:/src/or/config.c#l652
 set_options] called
 [https://gitweb.torproject.org/tor.git/blob/refs/tags/tor-0.2.2.22-alpha:/src/or/config.c#l1145
 options_act in src/or/config.c].
 *
 [https://gitweb.torproject.org/tor.git/blob/refs/tags/tor-0.2.2.22-alpha:/src/or/config.c#l1301
 options_act] called
 [https://gitweb.torproject.org/tor.git/blob/refs/tags/tor-0.2.2.22-alpha:/src/or/router.c#l486
 init_keys in src/or/router.c].
 *
 [https://gitweb.torproject.org/tor.git/blob/refs/tags/tor-0.2.2.22-alpha:/src/or/router.c#l632
 Because Tonga considered itself an authoritative directory],
 [https://gitweb.torproject.org/tor.git/blob/refs/tags/tor-0.2.2.22-alpha:/src/or/router.c#l647
 init_keys] called
 [https://gitweb.torproject.org/tor.git/blob/refs/tags/tor-0.2.2.22-alpha:/src/or/dirserv.c#l688
 dirserv_add_descriptor in src/or/dirserv.c].
 *
 [https://gitweb.torproject.org/tor.git/blob/refs/tags/tor-0.2.2.22-alpha:/src/or/dirserv.c#l743
 dirserv_add_descriptor] called
 [https://gitweb.torproject.org/tor.git/blob/refs/tags/tor-0.2.2.22-alpha:/src/or/routerlist.c#l3208
 router_add_to_routerlist in src/or/routerlist.c].
 * Because Tonga's descriptor's purpose was `general`, Tonga was '''not'''
 an authoritative directory ''for `@purpose general` descriptors'', Tonga
 had a current consensus already, and
 [https://gitweb.torproject.org/tor.git/blob/refs/tags/tor-0.2.2.22-alpha:/src/or/routerlist.c#l3300
 Tonga's identity digest was not listed in that consensus],
 [https://gitweb.torproject.org/tor.git/blob/refs/tags/tor-0.2.2.22-alpha:/src/or/routerlist.c#l3313
 router_add_to_routerlist rejected Tonga's new descriptor].
 * `dirserv_add_descriptor` returned failure, so
 * `init_keys` failed, so `options_act` failed, so `set_options` ended the
 Tor process.

 This bug seems to have been caused by two problems:
 * The fix for #2433 caused Tor to call `init_keys` more frequently than it
 was originally intended to be called.  This part is why Tonga crashed
 while running 0.2.2.22-alpha and not while running 0.2.1.29.
 * `init_keys` insisted on adding Tonga's own descriptor to its routerlist
 because Tonga was an authority for descriptors with ''some'' purpose, but
 Tonga couldn't force its own descriptor into its routerlist because it was
 ''not'' an authority for descriptors with purpose `general`.  This part is
 why the other directory authorities never crash in this manner.

 Additionally, in 0.2.1.29, `init_keys` would have been called only during
 startup, before Tor had loaded or obtained a consensus, so
 `router_add_to_routerlist` would not have failed even in a bridge
 authority not listed in the current network consensus.

 The fix for this bug is to replace `authdir_mode(options)` with
 `authdir_mode_handles_descs(options, ROUTER_PURPOSE_GENERAL)` in
 `init_keys` (on line 632 of src/or/router.c as of `tor-0.2.2.22-alpha` and
 current `maint-0.2.2` HEAD).

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


More information about the tor-bugs mailing list