[tor-bugs] #33087 [Core Tor/Tor]: closing stdio fds on exit can interfere with LeakSanitizer, etc

Tor Bug Tracker & Wiki blackhole at torproject.org
Wed Jan 29 21:14:38 UTC 2020

#33087: closing stdio fds on exit can interfere with LeakSanitizer, etc
 Reporter:  catalyst                             |          Owner:  (none)
     Type:  defect                               |         Status:  new
 Priority:  Medium                               |      Milestone:  Tor:
                                                 |  0.4.3.x-final
Component:  Core Tor/Tor                         |        Version:
 Severity:  Normal                               |     Resolution:
 Keywords:  tor-log, 043-should, consider-       |  Actual Points:
  backport-after-0433, 041-backport,             |
  042-backport                                   |
Parent ID:                                       |         Points:
 Reviewer:                                       |        Sponsor:

Comment (by teor):

 fsync() seems to be pretty standard on recent macOS:
      fsync() causes all modified data and attributes of fildes to be moved
      a permanent storage device.  This normally results in all in-core
      fied copies of buffers for the associated file to be written to a

 There are other macOS functions for a complete flush to disk, but they are
 specifically for disks and power failures:
      For applications that require tighter guarantees about the integrity
      their data, Mac OS X provides the F_FULLFSYNC fcntl.  The F_FULLFSYNC
      fcntl asks the drive to flush all buffered data to permanent storage.
      Applications, such as databases, that require a strict ordering of
      should use F_FULLFSYNC to ensure that their data is written in the
      they expect.  Please see fcntl(2) for more detail.

 If fsync() is interrupt-safe, we should use it.

 If it's not, maybe we should do nothing?
 (The other related tickets to#31594 already write an extra newline to all
 of the error fds. So that should flush any line-oriented buffers.)

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

More information about the tor-bugs mailing list