[tor-bugs] #22565 [Core Tor/Tor]: Refactor tor's signal handler to avoid undefined behaviour

Tor Bug Tracker & Wiki blackhole at torproject.org
Sun Jun 11 01:16:43 UTC 2017


#22565: Refactor tor's signal handler to avoid undefined behaviour
------------------------------+-------------------------------------------
     Reporter:  teor          |      Owner:
         Type:  defect        |     Status:  new
     Priority:  Medium        |  Milestone:  Tor: unspecified
    Component:  Core Tor/Tor  |    Version:
     Severity:  Normal        |   Keywords:  memory-safety, technical-debt
Actual Points:                |  Parent ID:
       Points:  2             |   Reviewer:
      Sponsor:                |
------------------------------+-------------------------------------------
 A signal handler can be called at any time, including when Tor's data
 structures are in an inconsistent state.

 The C standard says that setting anything other than a sig_atomic_t flag
 in a signal handler is undefined behaviour. POSIX is slightly more
 permissive, but we still do far too much in our signal handler.

 Could we set flags and check them at the top of the event loop instead?
 Or are there things we must handle right away?

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


More information about the tor-bugs mailing list