[tor-bugs] #11302 [Tor]: connection_handle_write_impl() should handle orconns properly if getsockopt() fails

Tor Bug Tracker & Wiki blackhole at torproject.org
Mon Mar 24 22:45:28 UTC 2014


#11302: connection_handle_write_impl() should handle orconns properly if
getsockopt() fails
--------------------+------------------------------------
 Reporter:  andrea  |          Owner:  andrea
     Type:  defect  |         Status:  new
 Priority:  normal  |      Milestone:  Tor: 0.2.5.x-final
Component:  Tor     |        Version:  Tor: 0.2.5.3-alpha
 Keywords:          |  Actual Points:
Parent ID:          |         Points:
--------------------+------------------------------------
 The function connection_handle_write_impl() in connection.c contains this
 code:

 {{{
 /* Sometimes, "writable" means "connected". */
 if (connection_state_is_connecting(conn)) {
   if (getsockopt(conn->s, SOL_SOCKET, SO_ERROR, (void*)&e, &len) < 0) {
     log_warn(LD_BUG, "getsockopt() syscall failed");
     if (CONN_IS_EDGE(conn))
       connection_edge_end_errno(TO_EDGE_CONN(conn));
     connection_mark_for_close(conn);
     return -1;
   }
 }}}

 This might close an orconn out from under the channel layer improperly.
 It should test for orconns and call connection_or_connect_failed() in that
 case rather than connection_mark_for_close() directly.  Created pursuant
 to connection_mark_for_close() audit task #7472.

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


More information about the tor-bugs mailing list