[tor-bugs] #15435 [Tor]: Tor should not close stdin on child processes.

Tor Bug Tracker & Wiki blackhole at torproject.org
Fri Mar 27 03:31:04 UTC 2015


#15435: Tor should not close stdin on child processes.
---------------------------+-----------------------------------------------
     Reporter:  yawning    |      Owner:
         Type:             |     Status:  needs_review
  enhancement              |  Milestone:  Tor: 0.2.7.x-final
     Priority:  normal     |    Version:  Tor: unspecified
    Component:  Tor        |   Keywords:  tor-pt, needs-spec-patch pt-wants
   Resolution:             |  Parent ID:
Actual Points:             |
       Points:             |
---------------------------+-----------------------------------------------

Comment (by yawning):

 Replying to [comment:10 dcf]:
 > It's only about 30 lines, so not terrible to copy-paste, but if we add
 interaction with stdin (especially if it's switched through
 TOR_PT_EXIT_ON_STDIN_CLOSE), we should think of a way to librarify it, to
 avoid mistakes. Basically, we want to treat "stdin eof" the same as
 SIGTERM everywhere.

 obfs4proxy's feature branch has a goroutine that SIGTERMs the current
 running process if Stdin ever closes, and exits the process if SIGTERMing
 itself fails (Which it will, always on Windows, because the only signal
 `os.Process.Signal()` can deliver is `SIGKILL`, aka, "it calls
 ProcessTerminate").

 Since I don't have children to clean up, this is fine for me, though I
 will clean up the branch a tad.

 For what it's worth, I don't think tor ever sends SIGINT to pt
 subprocesses ever either, so it might make sense just to rip that out of
 the spec.

 Anyway.  Assuming "tor will sent an env var indicating to PTs that stdin
 is valid and will never be written to" is ok behavior, shouldn't the
 various library side implementations of the handlers be discussed in
 another ticket?

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


More information about the tor-bugs mailing list