[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[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: new
Priority: major | Milestone: Tor: 0.2.7.x-final
Component: Tor | Version:
Keywords: 026-backport | Actual Points:
Parent ID: | Points:
--------------------------+------------------------------------
Tor keeps a buffer amount of file descriptor to avoid running out when
trying to do critical operation such as updating crypto keys or saving the
state file. See `ULIMIT_BUFFER` for this which is set to 32. For example,
if the system running tor is allowed to open `4096` files, only `4064` of
them will be used for network connections.
The `tor_accept_socket_nonblocking()` call is done in
`connection_handle_listener_read()` which creates a new file descriptor
from a listener connection but the open file limit is currently _not_
checked before. Because of that, we accept connection well beyond our
limit (set in `ConnLimit_`) which is bad because if we ran out, we can't
update for instance our ed25519 keys which results in a violent `exit()`
:).
I propose we put the open file limit just before we call `socket()`, in
`tor_open_socket_with_extensions()` and in
`tor_accept_socket_with_extensions()`. This way we centralize the limit
check and avoid future issues when adding a new open/accept socket call.
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/16288>
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