[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [tor-bugs] #2029 [Tor Relay]: Set FD_CLOEXEC on all open file descriptors so that they are closed on exec()
#2029: Set FD_CLOEXEC on all open file descriptors so that they are closed on
exec()
-----------------------+----------------------------------------------------
Reporter: sjmurdoch | Owner: sjmurdoch
Type: defect | Status: needs_review
Priority: normal | Milestone: Tor: 0.2.3.x-final
Component: Tor Relay | Version:
Keywords: | Parent: #1775
-----------------------+----------------------------------------------------
Comment(by sjmurdoch):
I made some changes to my branch
(`cloexec`ÂofÂgit://git.torproject.org/sjm217/tor.git) after experimenting
on MacOS X by seeing which file descriptors tor-fw-helper has open using
lsof.
`786abbd`
`tor-fw-helper`Âhad an open filehandle to the Tor log file; this patch
fixes this
`367794c`
`tor-fw-helper`Âhad open filehandles to the DNS resolvers; this patch
fixes this. Note that by usingÂ`tor_open_socket()`Ârather than
plainÂ`socket()`, the socket accounting code now knows about these
sockets. Is this a problem?
`a961521`
While debugging the issue below, I noted
thatÂ`tor_socketpair()`ÂusesÂ`FD_CLOEXEC`Âbefore it is checked. This
probably isn't an issue, but we check elsewhere so I cleaned this up.
I hoped that tor-fw-helper now would only have file descriptors 0, 1, and
2 open, but there is one left: a unix domain socket to
/var/run/mDNSResponder. I guess this is something created by the MacOS X
DNS code, and I am not sure how to set CLOEXEC on this file descriptor.
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/2029#comment:9>
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