[tor-bugs] #28229 [Core Tor/Tor]: Possible race condition opening SOCKS Port in test_rebind.py

Tor Bug Tracker & Wiki blackhole at torproject.org
Fri Jan 18 14:44:43 UTC 2019


#28229: Possible race condition opening SOCKS Port in test_rebind.py
-----------------------------+------------------------------------
 Reporter:  teor             |          Owner:  rl1987
     Type:  defect           |         Status:  new
 Priority:  High             |      Milestone:  Tor: 0.3.5.x-final
Component:  Core Tor/Tor     |        Version:  Tor: 0.3.5.1-alpha
 Severity:  Normal           |     Resolution:
 Keywords:  tor-ci, 035-can  |  Actual Points:
Parent ID:                   |         Points:
 Reviewer:  teor             |        Sponsor:
-----------------------------+------------------------------------

Comment (by rl1987):

 https://travis-ci.org/rl1987/tor/jobs/481321719

 Hmmm....

 {{{
 2019-01-18 11:58:35.059 Tor logged: "Jan 18 11:58:35.059 [info]
 set_max_file_descriptors: Raising max file descriptors from 10208 to
 9223372036854775807.", waiting for "Opened Socks listener"
 2019-01-18 11:58:35.059 Tor logged: "Jan 18 11:58:35.059 [info]
 set_max_file_descriptors: Dropped connection limit to 10208 based on
 OPEN_MAX (10240); Apparently, 9223372036854775807 was too high and rlimit
 lied to us.", waiting for "Opened Socks listener"
 2019-01-18 11:58:35.059 Tor logged: "Jan 18 11:58:35.059 [warn] You
 specified a public address '0.0.0.0:58579' for SocksPort. Other people on
 the Internet might find your computer and use it as an open proxy. Please
 don't allow this unless you have a good reason.", waiting for "Opened
 Socks listener"
 2019-01-18 11:58:35.060 Tor logged: "Jan 18 11:58:35.059 [debug]
 retry_all_listeners: 1 replacements - starting rebinding loop.", waiting
 for "Opened Socks listener"
 2019-01-18 11:58:35.060 Tor logged: "Jan 18 11:58:35.060 [notice] Opening
 Socks listener on 0.0.0.0:58579", waiting for "Opened Socks listener"
 2019-01-18 11:58:35.060 Tor logged: "Jan 18 11:58:35.060 [debug]
 connection_add_impl: new conn type Socks listener, socket 7, address
 0.0.0.0, n_conns 4.", waiting for "Opened Socks listener"
 2019-01-18 11:58:35.060 Tor logged: "Jan 18 11:58:35.060 [debug]
 connection_listener_new: Socks listener listening on port 58579.", waiting
 for "Opened Socks listener"
 2019-01-18 11:58:35.060 Tor logged: "Jan 18 11:58:35.060 [notice] Opened
 Socks listener on 0.0.0.0:58579"
 2019-01-18 11:58:35.060 FAIL
 Cannot connect to SOCKSPort: error Connection reset by peer
 }}}

 `setrlimit()` failed to raise number of open file descriptors we can have.
 Note that it tries to raise it to `LLONG_MAX`
 (http://pubs.opengroup.org/onlinepubs/009604499/basedefs/limits.h.html),
 which is suspicious. Perhaps that causes listener failure to happen?
 Perhaps we should sanity check `rlim.rlim_max` that we get from
 `getrlimit()` before trying to use it?

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


More information about the tor-bugs mailing list