We should use Unix domain sockets by default in Tor Browser. The patch for #14272 (moved) takes care of doing that for the control port (via the extensions.torlauncher.control_port_use_socket = true default preference). For the SOCKS port we need additional changes in tor-browser and builders/tor-browser-bundle at least.
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Child items
0
Show closed items
No child items are currently assigned. Use child items to break down this issue into smaller parts.
Linked items
0
Link issues together to show that they're related.
Learn more.
Kathy and I looked at this and soon realized that we cannot simply modify torrc-defaults (SocksPort) and the browser default preferences (network.proxy.socks) to use a socket path. This approach will not work because we need to insert a full path, and we do not know what the path is until the browser is starting up (it won't work to use a relative path, at least not on OSX where the TorBrowser-Data directory may be located in one of two different locations). Possibly solutions:
Modify Tor Launcher to Do The Right Thing and configure tor and the browser correctly. This is how we handled the ControlPort.
Modify the browser and tor (possibly with help from Tor Launcher) so we can use a placeholder within network.proxy.socks and SocksPort, e.g.,
network.proxy.socks="file:///--PROFILEDIR--/../../Tor/socks.socket"
Comments? Do you have a better idea? Kathy and I favor the first approach.
Trac: Status: new to needs_information Cc: brade, gk to brade, gk, arthuredelstein
Kathy and I looked at this and soon realized that we cannot simply modify torrc-defaults (SocksPort) and the browser default preferences (network.proxy.socks) to use a socket path. This approach will not work because we need to insert a full path, and we do not know what the path is until the browser is starting up (it won't work to use a relative path, at least not on OSX where the TorBrowser-Data directory may be located in one of two different locations). Possibly solutions:
Modify Tor Launcher to Do The Right Thing and configure tor and the browser correctly. This is how we handled the ControlPort.
Modify the browser and tor (possibly with help from Tor Launcher) so we can use a placeholder within network.proxy.socks and SocksPort, e.g.,
network.proxy.socks="file:///--PROFILEDIR--/../../Tor/socks.socket"
Comments? Do you have a better idea? Kathy and I favor the first approach.
To use a ControlPort via a domain socket, Tor Launcher will need to specify the ControlPort socket path as a command argument, correct? So the first approach sounds pretty natural and simple to me, where you also specify a path for the SocksPort and then set the network.proxy.socks pref in the browser.
What will be the name of the environment variable to define the path to the socket file? TOR_SOCKS_SOCKET?
Yes, we will probably use TOR_SOCKS_SOCKET. We have not created a patch yet though, so suggestions are welcome. We will also add a Boolean preference which will be true by default, maybe extensions.torlauncher.socks_port_use_socket
Kathy and I propose that we leave the browser defaults as-is. Inside tor-browser/browser/app/profile/000-tor-browser.js, we have:
pref("network.proxy.socks", "127.0.0.1");
pref("network.proxy.socks_port", 9150);
That means that a TCP SOCKS port will be used if Tor Launcher is not installed, which seems okay since we do not know what path to use for the socket.
When testing your patches in a clean, new hardened build I got the following issue:
Sep 28 11:34:45.000 [warn] tor_bug_occurred_(): Bug: src/common/address.c:1119: tor_addr_compare_masked: This line should not have been reached. (Future instances of this warning will be silenced.) (on Tor 0.2.9.2-alpha 00ec701f8343f552)Sep 28 11:34:45.000 [warn] Bug: Line unexpectedly reached at tor_addr_compare_masked at src/common/address.c:1119. Stack trace: (on Tor 0.2.9.2-alpha 00ec701f8343f552)Sep 28 11:34:45.000 [warn] Bug: /home/thomas/Arbeit/Tor/debugging/20111/tor-browser/Browser/TorBrowser/Tor/libasan.so.2(+0x4bc88) [0x7fa4d26eac88] (on Tor 0.2.9.2-alpha 00ec701f8343f552)Sep 28 11:34:45.000 [warn] Bug: /home/thomas/Arbeit/Tor/debugging/20111/tor-browser/Browser/TorBrowser/Tor/tor(log_backtrace+0x46) [0x560e0b946df6] (on Tor 0.2.9.2-alpha 00ec701f8343f552)Sep 28 11:34:45.000 [warn] Bug: /home/thomas/Arbeit/Tor/debugging/20111/tor-browser/Browser/TorBrowser/Tor/tor(tor_bug_occurred_+0x13b) [0x560e0b99423b] (on Tor 0.2.9.2-alpha 00ec701f8343f552)Sep 28 11:34:45.000 [warn] Bug: /home/thomas/Arbeit/Tor/debugging/20111/tor-browser/Browser/TorBrowser/Tor/tor(tor_addr_compare_masked+0x455) [0x560e0b941105] (on Tor 0.2.9.2-alpha 00ec701f8343f552)Sep 28 11:34:45.000 [warn] Bug: /home/thomas/Arbeit/Tor/debugging/20111/tor-browser/Browser/TorBrowser/Tor/tor(connection_edge_compatible_with_circuit+0x2a3) [0x560e0b866873] (on Tor 0.2.9.2-alpha 00ec701f8343f552)Sep 28 11:34:45.000 [warn] Bug: /home/thomas/Arbeit/Tor/debugging/20111/tor-browser/Browser/TorBrowser/Tor/tor(+0x73a276) [0x560e0b7d5276] (on Tor 0.2.9.2-alpha 00ec701f8343f552)Sep 28 11:34:45.000 [warn] Bug: /home/thomas/Arbeit/Tor/debugging/20111/tor-browser/Browser/TorBrowser/Tor/tor(+0x749a3a) [0x560e0b7e4a3a] (on Tor 0.2.9.2-alpha 00ec701f8343f552)Sep 28 11:34:45.000 [warn] Bug: /home/thomas/Arbeit/Tor/debugging/20111/tor-browser/Browser/TorBrowser/Tor/tor(connection_ap_handshake_attach_circuit+0x722) [0x560e0b7e6e22] (on Tor 0.2.9.2-alpha 00ec701f8343f552)Sep 28 11:34:45.000 [warn] Bug: /home/thomas/Arbeit/Tor/debugging/20111/tor-browser/Browser/TorBrowser/Tor/tor(connection_ap_attach_pending+0x4ac) [0x560e0b85707c] (on Tor 0.2.9.2-alpha 00ec701f8343f552)Sep 28 11:34:45.000 [warn] Bug: /home/thomas/Arbeit/Tor/debugging/20111/tor-browser/Browser/TorBrowser/Tor/tor(circuit_build_needed_circs+0xe7) [0x560e0b7e38a7] (on Tor 0.2.9.2-alpha 00ec701f8343f552)Sep 28 11:34:45.000 [warn] Bug: /home/thomas/Arbeit/Tor/debugging/20111/tor-browser/Browser/TorBrowser/Tor/tor(+0x552488) [0x560e0b5ed488] (on Tor 0.2.9.2-alpha 00ec701f8343f552)Sep 28 11:34:45.000 [warn] Bug: /home/thomas/Arbeit/Tor/debugging/20111/tor-browser/Browser/TorBrowser/Tor/libevent-2.0.so.5(event_base_loop+0x937) [0x7fa4d1f488d7] (on Tor 0.2.9.2-alpha 00ec701f8343f552)Sep 28 11:34:45.000 [warn] Bug: /home/thomas/Arbeit/Tor/debugging/20111/tor-browser/Browser/TorBrowser/Tor/tor(do_main_loop+0x398) [0x560e0b5ee898] (on Tor 0.2.9.2-alpha 00ec701f8343f552)Sep 28 11:34:45.000 [warn] Bug: /home/thomas/Arbeit/Tor/debugging/20111/tor-browser/Browser/TorBrowser/Tor/tor(tor_main+0x140d) [0x560e0b5f3a3d] (on Tor 0.2.9.2-alpha 00ec701f8343f552)Sep 28 11:34:45.000 [warn] Bug: /home/thomas/Arbeit/Tor/debugging/20111/tor-browser/Browser/TorBrowser/Tor/tor(main+0x1c) [0x560e0b5e102c] (on Tor 0.2.9.2-alpha 00ec701f8343f552)Sep 28 11:34:45.000 [warn] Bug: /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0) [0x7fa4d0195700] (on Tor 0.2.9.2-alpha 00ec701f8343f552)Sep 28 11:34:45.000 [warn] Bug: /home/thomas/Arbeit/Tor/debugging/20111/tor-browser/Browser/TorBrowser/Tor/tor(+0x547dcd) [0x560e0b5e2dcd] (on Tor 0.2.9.2-alpha 00ec701f8343f552)
Do you see the same on your machines? It seems we are hitting a tor bug or is there something wrong with your patches (they looked reasonable to me after the first code-review pass).
Do you see the same on your machines? It seems we are hitting a tor bug or is there something wrong with your patches (they looked reasonable to me after the first code-review pass).
I see the same messages, although I do not remember seeing them before (maybe Kathy and I failed to notice them or maybe we tested with a different version or tor). This could be a tor bug; the tor_addr_compare_masked() function does not seem to support Unix domain sockets (but I have not had time to debug it yet).
Yes, and tor's a885271c08d2337b35c203c0b27509d0aa32dbf6 made it just visible... Want to file a bug against tor with the tbb-needs keyword once you debugged the issue?
Yes, and tor's a885271c08d2337b35c203c0b27509d0aa32dbf6 made it just visible... Want to file a bug against tor with the tbb-needs keyword once you debugged the issue?
I created #20261 (moved). I also talked to Yawning and teor about this issue.
We had to include a copy of Tor Launcher's string unescape code in Torbutton, which is a little annoying but seems like the best alternative for now (eventually, we should make it so everything uses Arthur's tor-control-port.js module or its successor).