[tor-bugs] #28312 [Core Tor/Tor]: Tor exits when configuring a PidFile containing ~ (was: Crash when configuring a PidFile containing ~)

Tor Bug Tracker & Wiki blackhole at torproject.org
Sun Nov 4 14:10:54 UTC 2018


#28312: Tor exits when configuring a PidFile containing ~
--------------------------+------------------------------------
 Reporter:  teor          |          Owner:  (none)
     Type:  defect        |         Status:  reopened
 Priority:  Medium        |      Milestone:  Tor: unspecified
Component:  Core Tor/Tor  |        Version:  Tor: 0.3.2.1-alpha
 Severity:  Normal        |     Resolution:
 Keywords:                |  Actual Points:
Parent ID:  #28298        |         Points:
 Reviewer:                |        Sponsor:
--------------------------+------------------------------------
Changes (by teor):

 * status:  closed => reopened
 * priority:  High => Medium
 * milestone:  Tor: 0.3.5.x-final => Tor: unspecified
 * keywords:  memory-safety, regression, security-low =>
 * resolution:  duplicate =>


Old description:

> The patch in #28298 may avoids the "~" bug in DataDirectory, but adding ~
> to many other configured path crashes tor:
> {{{
> tor DisableNetwork 1 PidFile "~/.torpid"
> }}}
> with this error:
> {{{
> Nov 04 15:35:10.740 [notice] Tor 0.3.4.8 (git-da95b91355248ad8) running
> on Darwin with Libevent 2.1.8-stable, OpenSSL 1.0.2p, Zlib 1.2.11,
> Liblzma N/A, and Libzstd N/A.
> ...
> Nov 04 15:35:10.744 [warn] Path for PidFile (~/.torpid) is relative and
> will resolve to /Users/base/~/.torpid. Is this what you wanted?
> ...
> Nov 04 15:35:10.000 [warn] Unable to open "~/.torpid" for writing: No
> such file or directory
> Nov 04 15:35:10.000 [err] Unable to write PIDFile "~/.torpid"
> Nov 04 15:35:10.000 [err] set_options: Bug: Acting on config options left
> us in a broken state. Dying. (on Tor 0.3.4.8 da95b91355248ad8)
> Nov 04 15:35:10.000 [err] Reading config failed--see warnings above.
> tor(79983,0x7fffa9c06380) malloc: *** error for object 0x7: pointer being
> freed was not allocated
> *** set a breakpoint in malloc_error_break to debug
> Abort trap: 6
> Exit 134
> }}}

New description:

 The patch in #28298 may avoids the "~" bug in DataDirectory, but adding ~
 to many other configured path makes tor exit:
 {{{
 tor DisableNetwork 1 PidFile "~/.torpid"
 }}}
 with this error:
 {{{
 Nov 05 00:07:29.465 [notice] Tor 0.3.4.9 (git-4ac3ccf2863b86e7) running on
 Darwin with Libevent 2.1.8-stable, OpenSSL 1.0.2p, Zlib 1.2.11, Liblzma
 5.2.4, and Libzstd 1.3.7.
 Nov 05 00:07:29.466 [notice] Tor can't help you if you use it wrong! Learn
 how to be safe at https://www.torproject.org/download/download#warning
 Nov 05 00:07:29.467 [notice] Configuration file "/usr/local/etc/tor/torrc"
 not present, using reasonable defaults.
 Nov 05 00:07:29.473 [warn] Path for PidFile (~/.torpid) is relative and
 will resolve to /Users/base/tor-034/build-c/~/.torpid. Is this what you
 wanted?
 Nov 05 00:07:29.475 [notice] Scheduler type KISTLite has been enabled.
 Nov 05 00:07:29.475 [notice] Opening Socks listener on 127.0.0.1:9050
 Nov 05 00:07:29.000 [warn] Unable to open "~/.torpid" for writing: No such
 file or directory
 Nov 05 00:07:29.000 [err] Unable to write PIDFile "~/.torpid"
 Nov 05 00:07:29.000 [err] set_options: Bug: Acting on config options left
 us in a broken state. Dying. (on Tor 0.3.4.9 4ac3ccf2863b86e7)
 Nov 05 00:07:29.000 [err] Reading config failed--see warnings above.
 }}}

--

Comment:

 Replying to [comment:1 arma]:
 > First issue is that our PidFile handling never calls expand_filename().
 If we want it to, we could fix that. We probably should.
 >
 > Also, this might be a good time to wonder if there is a better way to
 call expand_filename more uniformly on config options that should expect
 it. Maybe want a new config type FILENAME, rather than the current
 ambiguous choice STRING ? Oh wait, we *have* one of those already, e.g.
 DirPortFrontPage is one. So the bug here is that PidFile is a STRING not a
 FILENAME? And the second bug is that we don't uniformly run
 expand_filename() on config options of type FILENAME?

 Let's deal with these issues, then.

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


More information about the tor-bugs mailing list