Trac issueshttps://gitlab.torproject.org/legacy/trac/-/issues2020-06-13T15:53:33Zhttps://gitlab.torproject.org/legacy/trac/-/issues/34211Add support for control signals (ex. Ctrl+C) in Windows2020-06-13T15:53:33ZTracAdd support for control signals (ex. Ctrl+C) in WindowsHi everyone!
I am working on a [cross-platform Tor controller/wrapper](https://github.com/DcodingTheWeb/ProxAllium/tree/next-gen), and I encountered a minor inconvenience while writing code for stopping Tor in Windows.
Currently the on...Hi everyone!
I am working on a [cross-platform Tor controller/wrapper](https://github.com/DcodingTheWeb/ProxAllium/tree/next-gen), and I encountered a minor inconvenience while writing code for stopping Tor in Windows.
Currently the only way to gracefully terminate Tor in Windows is to use the control port to issue the `SIGINT` signal, it would be beneficial for 3rd party programs which work with Tor to be able to invoke this procedure by using the native "control signals" provided to console programs in Windows.
I have made a patch which implements this functionality, I will post it soon, I am creating this ticket so that I can create a corresponding file in the `changes` directory :)
Thanks to nickm for some pointers about using the libevent `event_active` function to trigger the event, I decided to use the `activate_signal` function as it internally calls the suggested function and simplifies the code.
**Trac**:
**Username**: TheDcoderTor: 0.4.4.x-finalhttps://gitlab.torproject.org/legacy/trac/-/issues/33768Make tor_inet_pton() handle bad addresses consistently on Windows2020-06-13T15:52:40ZteorMake tor_inet_pton() handle bad addresses consistently on Windowstor_inet_pton() handles bad addresses differently on Windows and Linux/macOS.
For example, the address: "2000::1a00::1000:fc098" (two "::") fails this test on Windows, but succeeds on Linux and macOS:
https://github.com/torproject/tor/p...tor_inet_pton() handles bad addresses differently on Windows and Linux/macOS.
For example, the address: "2000::1a00::1000:fc098" (two "::") fails this test on Windows, but succeeds on Linux and macOS:
https://github.com/torproject/tor/pull/1831/commits/05f4f93722d46c0e8f1d09b4dea4bf5d1743d93f#diff-048243cd6d9ed36dda0944181d8ec8abR1729
Let's fix this bug and backport it.
In general, we should make all the functions in this file behave identically:
* zero any out parameters at the start of the function
* zero any out parameters on failureTor: 0.4.4.x-finalDavid Gouletdgoulet@torproject.orgDavid Gouletdgoulet@torproject.orghttps://gitlab.torproject.org/legacy/trac/-/issues/33673Use the right DLLs and pkg-config path on Appveyor2020-06-13T15:52:26ZteorUse the right DLLs and pkg-config path on AppveyorWe want to future-proof our Appveyor CI against dll and pkg-config issues.
Split off from #33643, which is the urgent CI fix.We want to future-proof our Appveyor CI against dll and pkg-config issues.
Split off from #33643, which is the urgent CI fix.Tor: 0.3.5.x-finalteorteorhttps://gitlab.torproject.org/legacy/trac/-/issues/33643Appveyor: OpenSSL version mismatch in unit tests, 2020 edition2020-06-13T15:52:21ZteorAppveyor: OpenSSL version mismatch in unit tests, 2020 editionIt's happened again:
```
OpenSSL library version 1.1.1d did not begin with header version 1.1.1e.
```
https://ci.appveyor.com/project/torproject/tor/builds/31549942/job/v0i9svtg78gqln1v#L6380
Just like #32449, #28574, #28399 and #25942....It's happened again:
```
OpenSSL library version 1.1.1d did not begin with header version 1.1.1e.
```
https://ci.appveyor.com/project/torproject/tor/builds/31549942/job/v0i9svtg78gqln1v#L6380
Just like #32449, #28574, #28399 and #25942.
We think our tests are fragile, because they are not copying the necessary libraries into `${env:build}/src/test` from `C:/mingw32/lib`:
```
ssl
crypto
lzma
event
zstd
```
We already copy zlib and ssp at https://github.com/ahf/tor/blob/master/.appveyor.yml#L98-L99 .
These libraries might have different dll prefixes or suffixes, for example, OpenSSL is:
```
/mingw32/bin/libcrypto-1_1.dll
/mingw32/bin/libssl-1_1.dll
```
https://packages.msys2.org/package/mingw-w64-i686-openssl
We might also want to copy these libraries into the same directory as the tor executable `${env:build}/src/app`, before we run the tests that launch tor.Tor: 0.3.5.x-finalNick MathewsonNick Mathewsonhttps://gitlab.torproject.org/legacy/trac/-/issues/33554Excessive CPU usage in windows tor_cond_t code?2020-06-13T15:52:05ZNick MathewsonExcessive CPU usage in windows tor_cond_t code?On #33411, gvanem reports excdessive CPU consumption in the windows tor_cond_t code. We should see if we can fix that.On #33411, gvanem reports excdessive CPU consumption in the windows tor_cond_t code. We should see if we can fix that.Tor: unspecifiedhttps://gitlab.torproject.org/legacy/trac/-/issues/33469INTERNAL ERROR: Raw assertion failed at src/lib/malloc/map_anon.c:239: lock_r...2020-06-13T15:51:53ZTracINTERNAL ERROR: Raw assertion failed at src/lib/malloc/map_anon.c:239: lock_result == 0I tried updating to latest stable version and I have this error after a couple of minutes:
```
Feb 27 14:38:04.987 [notice] Tor 0.4.2.6 (git-971a6beff5a53434) running on Windows Server 2003 with Libevent 2.1.8-stable, OpenSSL 1.1.1d, Zli...I tried updating to latest stable version and I have this error after a couple of minutes:
```
Feb 27 14:38:04.987 [notice] Tor 0.4.2.6 (git-971a6beff5a53434) running on Windows Server 2003 with Libevent 2.1.8-stable, OpenSSL 1.1.1d, Zlib 1.2.11, Liblzma N/A, and Libzstd N/A.
Feb 27 14:38:05.003 [notice] Tor can't help you if you use it wrong! Learn how to be safe at https://www.torproject.org/download/download#warning
Feb 27 14:38:05.018 [notice] Read configuration file "U:\2\Server\TOR\tor.ini".
Feb 27 14:38:05.018 [notice] Based on detected system memory, MaxMemInQueues is set to 2048 MB. You can override this by setting MaxMemInQueues by hand.
Feb 27 14:38:05.034 [warn] You specified a public address '0.0.0.0:8080' for SocksPort. Other people on the Internet might find your computer and use it as an open proxy. Please don't allow this unless you have a good reason.
Feb 27 14:38:05.034 [notice] Opening Socks listener on 0.0.0.0:8080
Feb 27 14:38:05.034 [notice] Opened Socks listener on 0.0.0.0:8080
Feb 27 14:38:05.034 [notice] Opening Control listener on 127.0.0.1:9051
Feb 27 14:38:05.049 [notice] Opened Control listener on 127.0.0.1:9051
Feb 27 14:38:05.049 [notice] Opening OR listener on 0.0.0.0:9001
Feb 27 14:38:05.049 [notice] Opened OR listener on 0.0.0.0:9001
Feb 27 14:38:05.049 [notice] Opening Directory listener on 0.0.0.0:9030
Feb 27 14:38:05.049 [notice] Opened Directory listener on 0.0.0.0:9030
============================================================ T= 1582807176
INTERNAL ERROR: Raw assertion failed in Tor 0.4.2.6 (git-971a6beff5a53434) at src/lib/malloc/map_anon.c:239: lock_result == 0
```
**Trac**:
**Username**: m95dTor: unspecifiedhttps://gitlab.torproject.org/legacy/trac/-/issues/33411Make DirCache default to 0 on Windows relays, if we can't fix the mmap issues2020-06-13T15:51:45ZteorMake DirCache default to 0 on Windows relays, if we can't fix the mmap issuesIn #24857, tor's consensus diff cache implementation causes high CPU load on Windows.
As a workaround, we could make DirCache default to 0 on Windows.In #24857, tor's consensus diff cache implementation causes high CPU load on Windows.
As a workaround, we could make DirCache default to 0 on Windows.Tor: 0.4.4.x-finalAlexander Færøyahf@torproject.orgAlexander Færøyahf@torproject.orghttps://gitlab.torproject.org/legacy/trac/-/issues/31352Jenkins failure on windows: ENETUNREACH undeclared.2020-06-13T15:44:04ZNick MathewsonJenkins failure on windows: ENETUNREACH undeclared.On https://jenkins.torproject.org/job/tor-ci-windows-master/22/consoleFull I see:
```
08:59:23 ../tor/src/test/test_util.c:5402:39: error: 'ENETUNREACH' undeclared (first use in this function)
```
This appears to be new in c46e99c43c4e...On https://jenkins.torproject.org/job/tor-ci-windows-master/22/consoleFull I see:
```
08:59:23 ../tor/src/test/test_util.c:5402:39: error: 'ENETUNREACH' undeclared (first use in this function)
```
This appears to be new in c46e99c43c4ee03, which is not in anything before 0.4.2.Tor: 0.4.2.x-finalNick MathewsonNick Mathewsonhttps://gitlab.torproject.org/legacy/trac/-/issues/30784Windows put its timeval definitions in winsock2.h2020-06-13T15:42:14ZteorWindows put its timeval definitions in winsock2.hSee the pull request:
https://github.com/torproject/tor/pull/1085
We'll need to backport this change to 0.2.9, assuming we used winthreads back then.
I'm going to assign this one to ahf, because he has a local windows build.See the pull request:
https://github.com/torproject/tor/pull/1085
We'll need to backport this change to 0.2.9, assuming we used winthreads back then.
I'm going to assign this one to ahf, because he has a local windows build.Tor: 0.4.1.x-finalAlexander Færøyahf@torproject.orgAlexander Færøyahf@torproject.orghttps://gitlab.torproject.org/legacy/trac/-/issues/30187100% cpu usage in winthreads tor_cond_wait2020-06-13T15:40:46ZTrac100% cpu usage in winthreads tor_cond_waitFor years I run relay using self-compiled win64 version of tor.
Compiler mingw64.
Relay runs well for some time but suddenly starts using 100% cpu all cores.
I traced where it happens. The following loop never ends :
```
do {
DWO...For years I run relay using self-compiled win64 version of tor.
Compiler mingw64.
Relay runs well for some time but suddenly starts using 100% cpu all cores.
I traced where it happens. The following loop never ends :
```
do {
DWORD res;
res = WaitForSingleObject(cond->event, ms);
EnterCriticalSection(&cond->lock);
if (cond->n_to_wake &&
cond->generation != generation_at_start) {
--cond->n_to_wake;
--cond->n_waiting;
result = 0;
waiting = 0;
goto out;
} else if (res != WAIT_OBJECT_0) {
result = (res==WAIT_TIMEOUT) ? 1 : -1;
--cond->n_waiting;
waiting = 0;
goto out;
} else if (ms != INFINITE) {
endTime = GetTickCount();
if (startTime + ms_orig <= endTime) {
result = 1; /* Timeout */
--cond->n_waiting;
waiting = 0;
goto out;
} else {
ms = startTime + ms_orig - endTime;
}
}
/* If we make it here, we are still waiting. */
if (cond->n_to_wake == 0) {
/* There is nobody else who should wake up; reset
* the event. */
ResetEvent(cond->event);
}
out:
LeaveCriticalSection(&cond->lock);
} while (waiting);
```
res = WAIT_OBJECT_0;
ms = INFINITE;
cond->n_to_wake=0x11
cond->generation=0x28
generation_at_start=0x28
it means no path with "goto out" ever execute
more than one thread run this loop and each one eat separate core
Some people I shared binaries with report same problem.
Pls check
**Trac**:
**Username**: bolvanTor: unspecifiedAlexander Færøyahf@torproject.orgAlexander Færøyahf@torproject.orghttps://gitlab.torproject.org/legacy/trac/-/issues/29601Drop redundant jobs on Appveyor to speed up builds2020-06-13T15:38:39ZteorDrop redundant jobs on Appveyor to speed up buildsOur Appveyor builds are really slow. We can still get decent coverage if we drop some redundant jobs.
The remaining builds will be:
* 64-bit Windows Server 2016
* 32-bit Windows Server 2012 R2
We can also set fast_finish, so the first ...Our Appveyor builds are really slow. We can still get decent coverage if we drop some redundant jobs.
The remaining builds will be:
* 64-bit Windows Server 2016
* 32-bit Windows Server 2012 R2
We can also set fast_finish, so the first failed job terminates the build immediately.Tor: 0.3.5.x-finalteorteorhttps://gitlab.torproject.org/legacy/trac/-/issues/29345Can't install TOR as a service on Windows 102020-06-13T17:36:42ZTracCan't install TOR as a service on Windows 10When trying to execute
```
tor.exe --service install --options -f C:\absolute\path\to\torrc
```
an <unformattable error> is given:
```
Running on a Post-Win2K OS, so we'll assume that the LocalService account exists.
Done with CreateSe...When trying to execute
```
tor.exe --service install --options -f C:\absolute\path\to\torrc
```
an <unformattable error> is given:
```
Running on a Post-Win2K OS, so we'll assume that the LocalService account exists.
Done with CreateService.
Service installed successfully
Service failed to start : <unformattable error>
```
This bug happens when there is something written in the torrc file, but on other attempts it was happening when using
```
HiddenServiceAuthorizeClient basic PCNAME
```
and so deleting this line it has been starting again.
If I leave the torrc file empty the error doesn't show up and the service is installed and working.
I tried to differently formatting torrc file, so using LF and CRLF, but the result is the same.
**Trac**:
**Username**: JohnnyFroghttps://gitlab.torproject.org/legacy/trac/-/issues/28612Tor start via Windows service fails2020-06-13T15:34:36ZTracTor start via Windows service failsWhen I run `tor --service start` with latest Tor version (0.3.5.5-alpha or 3741f9e5) on Windows 7 SP1 x64, Tor process starts, outputs some info into log file and exits (crashes?).
Latest line in log file: `Nov 25 19:35:20.000 [notice] C...When I run `tor --service start` with latest Tor version (0.3.5.5-alpha or 3741f9e5) on Windows 7 SP1 x64, Tor process starts, outputs some info into log file and exits (crashes?).
Latest line in log file: `Nov 25 19:35:20.000 [notice] Configured to measure statistics. Look for the *-stats files that will first be written to the data directory in 24 hours from now.`
Tor was configured with `--disable-gcc-hardening` and compiled by MSYS2 with following libraries: Libevent 2.1.8-stable, OpenSSL 1.1.1a, Zlib 1.2.11, Liblzma 5.2.4, and Libzstd 1.3.7.
**Trac**:
**Username**: VortTor: 0.3.5.x-finalhttps://gitlab.torproject.org/legacy/trac/-/issues/28574Appveyor: OpenSSL unit test fails with header and library version mismatch2020-06-13T15:52:21ZteorAppveyor: OpenSSL unit test fails with header and library version mismatchI'm guessing that 1.1.1a and 1.1.1 are compatible, though?
```
crypto/openssl_version: [forking]
FAIL ../src/test/test_crypto.c:238: OpenSSL library version 1.1.1 did not begin with header version 1.1.1a.
[openssl_version FAILED]
``...I'm guessing that 1.1.1a and 1.1.1 are compatible, though?
```
crypto/openssl_version: [forking]
FAIL ../src/test/test_crypto.c:238: OpenSSL library version 1.1.1 did not begin with header version 1.1.1a.
[openssl_version FAILED]
```
https://ci.appveyor.com/project/torproject/tor/build/1.0.1625/job/gibgc64fp4hxsf2h?fullLog=true#L3064Tor: 0.3.4.x-finalhttps://gitlab.torproject.org/legacy/trac/-/issues/28459Appveyor: always make the logs into build artifacts2020-06-13T15:34:13ZteorAppveyor: always make the logs into build artifactsThey're only about 50kB, and sometimes we want to have logs for a successful build.They're only about 50kB, and sometimes we want to have logs for a successful build.Tor: 0.3.4.x-finalteorteorhttps://gitlab.torproject.org/legacy/trac/-/issues/28457Appveyor: make doesn't stop when the first child process fails2020-06-13T15:34:13ZteorAppveyor: make doesn't stop when the first child process failsThis is probably a Windows child process handling bug in make.
We might be able to work around it by swapping to the MSYS2 or mingw make.
Discovered in #28399.This is probably a Windows child process handling bug in make.
We might be able to work around it by swapping to the MSYS2 or mingw make.
Discovered in #28399.Tor: unspecifiedhttps://gitlab.torproject.org/legacy/trac/-/issues/28454Actually use zstd on Appveyor2020-06-13T15:34:12ZteorActually use zstd on AppveyorWe install zstd, but configure can't find it.We install zstd, but configure can't find it.Tor: 0.4.0.x-finalteorteorhttps://gitlab.torproject.org/legacy/trac/-/issues/28399Build is broken on Appveyor CI2020-06-13T15:52:21Zrl1987Build is broken on Appveyor CIhttps://ci.appveyor.com/project/torproject/tor/builds/20213306
```
bash.exe : ../src/lib/tls/tortls_openssl.c: In function 'tor_tls_context_new':
At line:2 char:5
+ & $commandPath $args 2>&1
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
+ Cat...https://ci.appveyor.com/project/torproject/tor/builds/20213306
```
bash.exe : ../src/lib/tls/tortls_openssl.c: In function 'tor_tls_context_new':
At line:2 char:5
+ & $commandPath $args 2>&1
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (../src/lib/tls/...s_context_new'::String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
../src/lib/tls/tortls_openssl.c:545:35: error: implicit declaration of function 'TLS_method'; did you mean 'DTLS_method'? [-Werror=implicit-function-declaration]
if (!(result->ctx = SSL_CTX_new(TLS_method())))
^~~~~~~~~~
DTLS_method
../src/lib/tls/tortls_openssl.c:545:35: error: nested extern declaration of 'TLS_method' [-Werror=nested-externs]
../src/lib/tls/tortls_openssl.c:545:35: error: passing argument 1 of 'SSL_CTX_new' makes pointer from integer without a cast [-Werror=int-conversion]
In file included from ../src/lib/tls/tortls_openssl.c:48:0:
C:/OpenSSL-Win32/include/openssl/ssl.h:2131:10: note: expected 'const SSL_METHOD * {aka const struct ssl_method_st *}' but argument is of type 'int'
SSL_CTX *SSL_CTX_new(const SSL_METHOD *meth);
^~~~~~~~~~~
../src/lib/tls/tortls_openssl.c:554:3: error: implicit declaration of function 'SSL_CTX_set_security_level'; did you mean 'SSL_CTX_set_verify_depth'? [-Werror=implicit-function-declaration]
SSL_CTX_set_security_level(result->ctx, 1);
^~~~~~~~~~~~~~~~~~~~~~~~~~
SSL_CTX_set_verify_depth
../src/lib/tls/tortls_openssl.c:554:3: error: nested extern declaration of 'SSL_CTX_set_security_level' [-Werror=nested-externs]
../src/lib/tls/tortls_openssl.c: In function 'prune_v2_cipher_list':
../src/lib/tls/tortls_openssl.c:810:25: error: initialization makes pointer from integer without a cast [-Werror=int-conversion]
const SSL_METHOD *m = TLS_method();
^~~~~~~~~~
../src/lib/tls/tortls_openssl.c: In function 'tor_tls_client_is_using_v2_ciphers':
../src/lib/tls/tortls_openssl.c:919:13: error: implicit declaration of function 'SSL_get_client_ciphers'; did you mean 'SSL_get_current_cipher'? [-Werror=implicit-function-declaration]
ciphers = SSL_get_client_ciphers(ssl);
^~~~~~~~~~~~~~~~~~~~~~
SSL_get_current_cipher
../src/lib/tls/tortls_openssl.c:919:13: error: nested extern declaration of 'SSL_get_client_ciphers' [-Werror=nested-externs]
../src/lib/tls/tortls_openssl.c:919:11: error: assignment makes pointer from integer without a cast [-Werror=int-conversion]
ciphers = SSL_get_client_ciphers(ssl);
^
../src/lib/tls/tortls_openssl.c: In function 'tor_tls_get_tlssecrets':
../src/lib/tls/tortls_openssl.c:1623:36: error: implicit declaration of function 'SSL_get_server_random'; did you mean 'SSL_get_servername'? [-Werror=implicit-function-declaration]
const size_t server_random_len = SSL_get_server_random(ssl, NULL, 0);
^~~~~~~~~~~~~~~~~~~~~
SSL_get_servername
../src/lib/tls/tortls_openssl.c:1623:36: error: nested extern declaration of 'SSL_get_server_random' [-Werror=nested-externs]
../src/lib/tls/tortls_openssl.c:1624:36: error: implicit declaration of function 'SSL_get_client_random'; did you mean 'SSL_get_client_CA_list'? [-Werror=implicit-function-declaration]
const size_t client_random_len = SSL_get_client_random(ssl, NULL, 0);
^~~~~~~~~~~~~~~~~~~~~
SSL_get_client_CA_list
../src/lib/tls/tortls_openssl.c:1624:36: error: nested extern declaration of 'SSL_get_client_random' [-Werror=nested-externs]
../src/lib/tls/tortls_openssl.c:1625:33: error: implicit declaration of function 'SSL_SESSION_get_master_key'; did you mean 'SSL_SESSION_get_time'? [-Werror=implicit-function-declaration]
const size_t master_key_len = SSL_SESSION_get_master_key(session, NULL, 0);
^~~~~~~~~~~~~~~~~~~~~~~~~~
SSL_SESSION_get_time
../src/lib/tls/tortls_openssl.c:1625:33: error: nested extern declaration of 'SSL_SESSION_get_master_key' [-Werror=nested-externs]
```Tor: 0.3.5.x-finalhttps://gitlab.torproject.org/legacy/trac/-/issues/28097Get the actual Windows version from Kernel32.dll2020-06-13T15:33:01ZteorGet the actual Windows version from Kernel32.dllWindows 8.1 and later pretend to be Windows 8 (#28096).
If we want to display the real Windows version, we can use GetFileVersionInfo() to check the version of Kernel32.dll:
https://docs.microsoft.com/en-au/windows/desktop/SysInfo/getti...Windows 8.1 and later pretend to be Windows 8 (#28096).
If we want to display the real Windows version, we can use GetFileVersionInfo() to check the version of Kernel32.dll:
https://docs.microsoft.com/en-au/windows/desktop/SysInfo/getting-the-system-versionTor: unspecifiedhttps://gitlab.torproject.org/legacy/trac/-/issues/28096Windows 8.1 and 10 relays claim to be Windows 82020-06-13T15:33:01ZteorWindows 8.1 and 10 relays claim to be Windows 8In Windows 8.1, Microsoft changed the behaviour of the GetVersionEx function so that it returns 6.2 (Windows 8) for applications without a compatibility manifest. (For applications with a compatibility manifest, it returns the version in...In Windows 8.1, Microsoft changed the behaviour of the GetVersionEx function so that it returns 6.2 (Windows 8) for applications without a compatibility manifest. (For applications with a compatibility manifest, it returns the version in that manifest.)
https://docs.microsoft.com/en-au/windows/desktop/api/sysinfoapi/nf-sysinfoapi-getversionexa
We should change the version returned by Tor's uname function to "Windows 8 or later".Tor: 0.3.4.x-finalteorteor