[tor-bugs] #22102 [Core Tor/Tor]: Can't HUP with a relative path in Log line

Tor Bug Tracker & Wiki blackhole at torproject.org
Mon Jun 26 23:56:37 UTC 2017


#22102: Can't HUP with a relative path in Log line
----------------------------------------------+----------------------------
 Reporter:  pastly                            |          Owner:  Jigsaw52
     Type:  defect                            |         Status:
                                              |  needs_review
 Priority:  Medium                            |      Milestone:  Tor:
                                              |  0.3.2.x-final
Component:  Core Tor/Tor                      |        Version:
 Severity:  Normal                            |     Resolution:
 Keywords:  review-group-18, review-group-19  |  Actual Points:
Parent ID:  #22101                            |         Points:
 Reviewer:                                    |        Sponsor:
----------------------------------------------+----------------------------

Comment (by arma):

 Diagnosis: this bug happens because Tor opens its log file before it
 switches to the DataDirectory, *and* because Tor calls
 {{{check_private_dir(options->DataDirectory)}}} before it opens its logs
 (otherwise Tor would have failed to open the file because the directory
 does not exist).

 So when you HUP, Tor closes that original log file, and tries to open it
 again, but by now its cwd is its datadirectory, so now it can't open it
 because that (relative) directory does not exist.

 Specifically, they are two parts to dropping privs, and Tor does the first
 part before opening its log files, but doesn't do the finish_daemon() part
 (which includes the chdir) until later.

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


More information about the tor-bugs mailing list