[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [tor-bugs] #16288 [Tor]: The open file limit is not checked before calling tor_accept_socket_nonblocking()



#16288: The open file limit is not checked before calling
tor_accept_socket_nonblocking()
-------------------------+--------------------------------
     Reporter:  dgoulet  |      Owner:
         Type:  defect   |     Status:  needs_review
     Priority:  major    |  Milestone:  Tor: 0.2.7.x-final
    Component:  Tor      |    Version:
   Resolution:           |   Keywords:  026-backport
Actual Points:           |  Parent ID:
       Points:           |
-------------------------+--------------------------------
Changes (by dgoulet):

 * status:  needs_revision => needs_review


Comment:

 Replying to [comment:3 nickm]:
 >
 >  * max_file_descriptors starts out at 0; I think it should start
 somewhere much much higher, so that it can take effect _before_ we call
 nonblocking

 Indeed. I set it to 1024 which is the default value on Debian/Ubuntu. It's
 higher on Redhat and BSD.

 >  * We should call max_file_descriptors "max_sockets" instead, right?  We
 apply this limit to sockets, not fds.

 Better indeed!

 >  * Windows handles socket errno differently; they don't go in errno and
 our code doesn't look in errno. They use WSAGetLastError() instead.

 Hrm, OK so the fix I did here is simply use `conn->s` all the times in the
 case our `news` is invalid which on Linux means basically `errno` and on
 Windows, it will get the latest error and will make sure to handle
 ewouldblock in that case.

 >  * It isn't safe to call tor_socket_errno() on two sockets in succession
 as you do for news and conn->s in connection_handler_listener_read().
 Remember, on Unix it's mostly just an alias for errno.

 The above fixes this.

 See branch: `bug16288_027_02`.

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/16288#comment:4>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs